From 99e30fcae50da161b28ce424bdfea2c9ba753b42 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Tue, 28 Apr 2026 20:10:07 +0530 Subject: [PATCH] feat(mcp-server): enhance session metadata with method and tool information --- src/mcp-server-http.ts | 6 +++++- src/mcp-server-stdio.ts | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mcp-server-http.ts b/src/mcp-server-http.ts index d9baa4a..4860863 100644 --- a/src/mcp-server-http.ts +++ b/src/mcp-server-http.ts @@ -304,7 +304,11 @@ export async function main() { const mcpInfo = extractMcpToolInfo(parsedBody); // Handle request within trace context (passing trace ID from header if available) - const sessionMetadata = getSessionMetadata("http"); + const sessionMetadata = { + ...getSessionMetadata("http"), + mcp_method: mcpInfo.method, + tool: mcpInfo.tool, + }; return await withSpan( "mcp_http_request", { diff --git a/src/mcp-server-stdio.ts b/src/mcp-server-stdio.ts index 7216eed..70529a1 100644 --- a/src/mcp-server-stdio.ts +++ b/src/mcp-server-stdio.ts @@ -187,7 +187,11 @@ export async function main() { isError: false, }; }, - getSessionMetadata("stdio"), + { + ...getSessionMetadata("stdio"), + mcp_method: "tools/call", + tool: searchSpecToolName, + }, ); }, ); @@ -245,7 +249,11 @@ export async function main() { isError: false, }; }, - getSessionMetadata("stdio"), + { + ...getSessionMetadata("stdio"), + mcp_method: "tools/call", + tool: sectionContentToolName, + }, ); }, ); @@ -299,7 +307,11 @@ export async function main() { isError, }; }, - getSessionMetadata("stdio"), + { + ...getSessionMetadata("stdio"), + mcp_method: "tools/call", + tool: evaluateToolName, + }, ); }, );