koala73/worldmonitor · error
tools/list failed: HTTP ${listResp.status}
Error message
tools/list failed: HTTP ${listResp.status} What it means
Thrown by mcpListTools after a successful initialize when the follow-up tools/list request to the MCP server returned a non-2xx HTTP status. The session was established but the tools enumeration call was rejected (expired/missing Mcp-Session-Id, auth, or upstream failure).
Source
Thrown at api/mcp-proxy.ts:322
}, headers, sessionId);
} catch (error) {
if (error instanceof McpProxySsrfError) throw error;
/* non-fatal */
}
}
async function mcpListTools(serverUrl, customHeaders) {
const headers = buildHeaders(customHeaders);
const initResp = await postJson(serverUrl, buildInitPayload(), headers, null);
if (!initResp.ok) throw new Error(`Initialize failed: HTTP ${initResp.status}`);
const sessionId = initResp.headers.get('Mcp-Session-Id') || initResp.headers.get('mcp-session-id');
const initData = await parseJsonRpcResponse(initResp);
if (initData.error) throw new Error(`Initialize error: ${initData.error.message}`);
await sendInitialized(serverUrl, headers, sessionId);
const listResp = await postJson(serverUrl, {
jsonrpc: '2.0', id: 2, method: 'tools/list', params: {},
}, headers, sessionId);
if (!listResp.ok) throw new Error(`tools/list failed: HTTP ${listResp.status}`);
const listData = await parseJsonRpcResponse(listResp);
if (listData.error) throw new Error(`tools/list error: ${listData.error.message}`);
return listData.result?.tools || [];
}
async function mcpCallTool(serverUrl, toolName, toolArgs, customHeaders) {
const headers = buildHeaders(customHeaders);
const initResp = await postJson(serverUrl, buildInitPayload(), headers, null);
if (!initResp.ok) throw new Error(`Initialize failed: HTTP ${initResp.status}`);
const sessionId = initResp.headers.get('Mcp-Session-Id') || initResp.headers.get('mcp-session-id');
const initData = await parseJsonRpcResponse(initResp);
if (initData.error) throw new Error(`Initialize error: ${initData.error.message}`);
await sendInitialized(serverUrl, headers, sessionId);
const callResp = await postJson(serverUrl, {
jsonrpc: '2.0', id: 3, method: 'tools/call',
params: { name: toolName, arguments: toolArgs || {} },
}, headers, sessionId);
if (!callResp.ok) throw new Error(`tools/call failed: HTTP ${callResp.status}`);View on GitHub (pinned to 9361220cc0)
Solutions
- Check the returned status: a 404 often means the Mcp-Session-Id expired or was not forwarded
- Ensure custom headers required by the server are applied to every request, not just initialize
- Retry the whole connect-and-list flow to obtain a fresh session
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at api/mcp-proxy.ts:320 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-08-21).
Data as JSON: /api/errors/f3c36082aba08d8c.
Report an issue: GitHub.