(toolName: string)
| 51 | * local CLI doesn't know about. The stub routes to FallbackPermissionRequest. |
| 52 | */ |
| 53 | export function createToolStub(toolName: string): Tool { |
| 54 | return { |
| 55 | name: toolName, |
| 56 | inputSchema: {} as Tool['inputSchema'], |
| 57 | isEnabled: () => true, |
| 58 | userFacingName: () => toolName, |
| 59 | renderToolUseMessage: (input: Record<string, unknown>) => { |
| 60 | const entries = Object.entries(input) |
| 61 | if (entries.length === 0) return '' |
| 62 | return entries |
| 63 | .slice(0, 3) |
| 64 | .map(([key, value]) => { |
| 65 | const valueStr = |
| 66 | typeof value === 'string' ? value : jsonStringify(value) |
| 67 | return `${key}: ${valueStr}` |
| 68 | }) |
| 69 | .join(', ') |
| 70 | }, |
| 71 | call: async () => ({ data: '' }), |
| 72 | description: async () => '', |
| 73 | prompt: () => '', |
| 74 | isReadOnly: () => false, |
| 75 | isMcp: false, |
| 76 | needsPermissions: () => true, |
| 77 | } as unknown as Tool |
| 78 | } |
| 79 |
no test coverage detected