MCPcopy Index your code
hub / github.com/anus-dev/ANUS / MockModifiableToolInvocation

Class MockModifiableToolInvocation

packages/core/src/test-utils/tools.ts:93–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93export class MockModifiableToolInvocation extends BaseToolInvocation<
94 Record<string, unknown>,
95 ToolResult
96> {
97 constructor(
98 private readonly tool: MockModifiableTool,
99 params: Record<string, unknown>,
100 ) {
101 super(params);
102 }
103
104 async execute(_abortSignal: AbortSignal): Promise<ToolResult> {
105 const result = this.tool.executeFn(this.params);
106 return (
107 result ?? {
108 llmContent: `Tool ${this.tool.name} executed successfully.`,
109 returnDisplay: `Tool ${this.tool.name} executed successfully.`,
110 }
111 );
112 }
113
114 override async shouldConfirmExecute(
115 _abortSignal: AbortSignal,
116 ): Promise<ToolCallConfirmationDetails | false> {
117 if (this.tool.shouldConfirm) {
118 return {
119 type: 'edit',
120 title: 'Confirm Mock Tool',
121 fileName: 'test.txt',
122 filePath: 'test.txt',
123 fileDiff: 'diff',
124 originalContent: 'originalContent',
125 newContent: 'newContent',
126 onConfirm: async () => {},
127 };
128 }
129 return false;
130 }
131
132 getDescription(): string {
133 return `A mock modifiable tool invocation for ${this.tool.name}`;
134 }
135}
136
137/**
138 * Configurable mock modifiable tool for testing.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected