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