| 74 | } |
| 75 | |
| 76 | function createFakeTool(): Tool { |
| 77 | return { |
| 78 | name: 'FakeTool', |
| 79 | inputSchema: z.object({}), |
| 80 | outputSchema: z.unknown(), |
| 81 | description: async () => 'fake', |
| 82 | isEnabled: () => true, |
| 83 | isConcurrencySafe: () => false, |
| 84 | isReadOnly: () => false, |
| 85 | isDestructive: () => false, |
| 86 | userFacingName: () => 'FakeTool', |
| 87 | checkPermissions: async input => ({ |
| 88 | behavior: 'allow', |
| 89 | updatedInput: input, |
| 90 | }), |
| 91 | toAutoClassifierInput: () => '', |
| 92 | call: async () => ({ |
| 93 | data: 'ok', |
| 94 | }), |
| 95 | mapToolResultToToolResultBlockParam: (data, toolUseId) => ({ |
| 96 | type: 'tool_result', |
| 97 | tool_use_id: toolUseId, |
| 98 | content: String(data), |
| 99 | }), |
| 100 | } as unknown as Tool |
| 101 | } |
| 102 | |
| 103 | function registerStopHook( |
| 104 | toolUseContext: ReturnType<typeof createToolUseContext>, |