MCPcopy Create free account
hub / github.com/Noumena-Network/code / call

Function call

src/services/mcp/client.ts:1836–1974  ·  view source on GitHub ↗
(
              args: Record<string, unknown>,
              context,
              _canUseTool,
              parentMessage,
              onProgress?: ToolCallProgress<MCPProgress>,
            )

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 5

extractToolUseIdFunction · 0.85
ensureConnectedClientFunction · 0.85
logMCPDebugFunction · 0.85
onProgressFunction · 0.50

Tested by

no test coverage detected