Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(web-app): send the server and connection generation with MCP tool calls
thinhlpg50cfcf34b4ac
diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsxindex b1ac6c881..5b5b52377 100644--- a/web-app/src/routes/threads/$threadId.tsx+++ b/web-app/src/routes/threads/$threadId.tsx@@ -321,6 +321,7 @@ function toolOriginOf(toolName: string) {origin: 'extension' as const,server: extensionTool.server,extensionTool,+ mcpGeneration: undefined,}}const mcpTool = useAppState@@ -330,6 +331,10 @@ function toolOriginOf(toolName: string) {origin: 'mcp' as const,server: mcpTool?.server,extensionTool: undefined,+ // The connection that listed the tool. The call carries it, so a server+ // restarted between the call arriving and it running refuses it rather+ // than the new process running a call it never offered.+ mcpGeneration: mcpTool?.generation,}}@@ -1113,6 +1118,8 @@ function ThreadDetail() {// Stop ends the call on the backend as well as in this loop.const call = serviceHub.mcp().callToolWithCancellation({toolName,+ serverName: origin.server,+ serverGeneration: origin.mcpGeneration,arguments: toolCall.input,maxOutputChars,})diff --git a/web-app/src/services/mcp/tauri.ts b/web-app/src/services/mcp/tauri.tsindex db8c59f7f..c9661106e 100644--- a/web-app/src/services/mcp/tauri.ts+++ b/web-app/src/services/mcp/tauri.ts@@ -91,6 +91,7 @@ export class TauriMCPService extends DefaultMCPService {callToolWithCancellation(args: {toolName: stringserverName?: string+ serverGeneration?: numberarguments: objectcancellationToken?: stringmaxOutputChars?: numberdiff --git a/web-app/src/services/mcp/types.ts b/web-app/src/services/mcp/types.tsindex 695fbccf5..f445814c0 100644--- a/web-app/src/services/mcp/types.ts+++ b/web-app/src/services/mcp/types.ts@@ -74,6 +74,8 @@ export interface MCPService {callToolWithCancellation(args: {toolName: stringserverName?: string+ /** `MCPTool.generation` of the tool being called. */+ serverGeneration?: numberarguments: objectcancellationToken?: stringmaxOutputChars?: numberdiff --git a/web-app/src/types/completion.ts b/web-app/src/types/completion.tsindex 98e210eee..03f01bf62 100644--- a/web-app/src/types/completion.ts+++ b/web-app/src/types/completion.ts@@ -7,4 +7,7 @@ export type MCPTool = {description: stringinputSchema: Record<string, unknown>server: string+ /** The connection the tool was listed from. A call passes it back so a+ * server restarted since cannot run it. */+ generation?: number}