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

Function doneTool

packages/opencode/src/cli/cmd/run/demo.ts:503–538  ·  view source on GitHub ↗
(
  state: State,
  ref: Ref,
  output: {
    title: string
    output: string
    metadata?: Record<string, unknown>
  },
)

Source from the content-addressed store, hash-verified

501}
502
503function doneTool(
504 state: State,
505 ref: Ref,
506 output: {
507 title: string
508 output: string
509 metadata?: Record<string, unknown>
510 },
511): void {
512 feed(state, {
513 type: "message.part.updated",
514 properties: {
515 sessionID: state.id,
516 time: Date.now(),
517 part: {
518 id: ref.part,
519 sessionID: state.id,
520 messageID: ref.msg,
521 type: "tool",
522 callID: ref.call,
523 tool: ref.tool,
524 state: {
525 status: "completed",
526 input: ref.input,
527 output: output.output,
528 title: output.title,
529 metadata: output.metadata ?? {},
530 time: {
531 start: ref.start,
532 end: Date.now(),
533 },
534 },
535 },
536 },
537 } as Event)
538}
539
540function failTool(state: State, ref: Ref, error: string): void {
541 feed(state, {

Callers 9

emitBashFunction · 0.70
emitWriteFunction · 0.70
emitEditFunction · 0.70
emitPatchFunction · 0.70
emitTaskFunction · 0.70
emitTodoFunction · 0.70
emitQuestionToolFunction · 0.70
permissionFunction · 0.70
questionReplyFunction · 0.70

Calls 1

feedFunction · 0.70

Tested by

no test coverage detected