MCPcopy Create free account
hub / github.com/anomalyco/opencode / createToolPart

Function createToolPart

packages/opencode/test/cli/github-action.test.ts:29–61  ·  view source on GitHub ↗
(tool: string, title: string, status: "completed" | "running" = "completed")

Source from the content-addressed store, hash-verified

27}
28
29function createToolPart(tool: string, title: string, status: "completed" | "running" = "completed"): SessionV1.Part {
30 if (status === "completed") {
31 return {
32 id: PartID.ascending(),
33 sessionID: SessionID.make("ses_test"),
34 messageID: MessageID.make("msg_test"),
35 type: "tool" as const,
36 callID: "c1",
37 tool,
38 state: {
39 status: "completed",
40 input: {},
41 output: "",
42 title,
43 metadata: {},
44 time: { start: 0, end: 1 },
45 },
46 }
47 }
48 return {
49 id: PartID.ascending(),
50 sessionID: SessionID.make("ses_test"),
51 messageID: MessageID.make("msg_test"),
52 type: "tool" as const,
53 callID: "c1",
54 tool,
55 state: {
56 status: "running",
57 input: {},
58 time: { start: 0 },
59 },
60 }
61}
62
63function createStepStartPart(): SessionV1.Part {
64 return {

Callers 1

Calls 1

makeMethod · 0.45

Tested by

no test coverage detected