(
args: Record<string, unknown>,
context,
_canUseTool,
parentMessage,
onProgress?: ToolCallProgress<MCPProgress>,
)
| 1831 | } |
| 1832 | }, |
| 1833 | async call( |
| 1834 | args: Record<string, unknown>, |
| 1835 | context, |
| 1836 | _canUseTool, |
| 1837 | parentMessage, |
| 1838 | onProgress?: ToolCallProgress<MCPProgress>, |
| 1839 | ) { |
| 1840 | const toolUseId = extractToolUseId(parentMessage) |
| 1841 | const meta = toolUseId |
| 1842 | ? { 'claudecode/toolUseId': toolUseId } |
| 1843 | : {} |
| 1844 | |
| 1845 | // Emit progress when tool starts |
| 1846 | if (onProgress && toolUseId) { |
| 1847 | onProgress({ |
| 1848 | toolUseID: toolUseId, |
| 1849 | data: { |
| 1850 | type: 'mcp_progress', |
| 1851 | status: 'started', |
| 1852 | serverName: client.name, |
| 1853 | toolName: tool.name, |
| 1854 | }, |
| 1855 | }) |
| 1856 | } |
| 1857 | |
| 1858 | const startTime = Date.now() |
| 1859 | const MAX_SESSION_RETRIES = 1 |
| 1860 | for (let attempt = 0; ; attempt++) { |
| 1861 | try { |
| 1862 | const connectedClient = await ensureConnectedClient(client) |
| 1863 | const mcpResult = await callMCPToolWithUrlElicitationRetry({ |
| 1864 | client: connectedClient, |
| 1865 | clientConnection: client, |
| 1866 | tool: tool.name, |
| 1867 | args, |
| 1868 | meta, |
| 1869 | signal: context.abortController.signal, |
| 1870 | setAppState: context.setAppState, |
| 1871 | onProgress: |
| 1872 | onProgress && toolUseId |
| 1873 | ? progressData => { |
| 1874 | onProgress({ |
| 1875 | toolUseID: toolUseId, |
| 1876 | data: progressData, |
| 1877 | }) |
| 1878 | } |
| 1879 | : undefined, |
| 1880 | handleElicitation: context.handleElicitation, |
| 1881 | }) |
| 1882 | |
| 1883 | // Emit progress when tool completes successfully |
| 1884 | if (onProgress && toolUseId) { |
| 1885 | onProgress({ |
| 1886 | toolUseID: toolUseId, |
| 1887 | data: { |
| 1888 | type: 'mcp_progress', |
| 1889 | status: 'completed', |
| 1890 | serverName: client.name, |
nothing calls this directly
no test coverage detected