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