From 846143ebe52f6cbfd26ce15c01a0e1efc36d7731 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 10 Sep 2026 17:22:40 +0200 Subject: [PATCH] refactor: ped-ai calls clinical_semantic_search only The nc_semantic_search alias is gone from the MCP server, so accepting it here would point retrieval at a tool that no longer exists. A stale override now stops the app at startup instead of silently retrieving nothing. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU --- docs/CLINICAL_ASSISTANT.md | 2 +- src/utils/clinicalMcpClient.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/CLINICAL_ASSISTANT.md b/docs/CLINICAL_ASSISTANT.md index ec448696..2ca5d727 100644 --- a/docs/CLINICAL_ASSISTANT.md +++ b/docs/CLINICAL_ASSISTANT.md @@ -16,7 +16,7 @@ The Clinical Assistant is a retrieval-grounded assistant for pediatric clinical ```txt User asks a question -> browser posts to Ped-AI - -> Ped-AI calls MCP `nc_semantic_search` + -> Ped-AI calls MCP `clinical_semantic_search` -> MCP returns source excerpts and metadata -> Ped-AI builds an answer prompt with source constraints -> LiteLLM model returns answer text diff --git a/src/utils/clinicalMcpClient.js b/src/utils/clinicalMcpClient.js index 3fae5326..c5468030 100644 --- a/src/utils/clinicalMcpClient.js +++ b/src/utils/clinicalMcpClient.js @@ -3,13 +3,12 @@ var sleep = require('node:timers/promises').setTimeout; var MCP_URLS = buildMcpUrls(); var _lastGoodMcpUrl = MCP_URLS[0]; -// Search tool name is env-driven; invalid values stop the app before any MCP call. +// The server names this tool clinical_semantic_search. The old nc_ alias is +// gone from both sides; a stale override would silently retrieve nothing, so it +// stops the app here rather than at the first search. var SEARCH_TOOL_NAME = process.env.CLINICAL_ASSISTANT_SEARCH_TOOL || 'clinical_semantic_search'; -if (SEARCH_TOOL_NAME !== 'clinical_semantic_search' && SEARCH_TOOL_NAME !== 'nc_semantic_search') { - throw new Error('CLINICAL_ASSISTANT_SEARCH_TOOL must be clinical_semantic_search or nc_semantic_search'); -} -if (SEARCH_TOOL_NAME === 'nc_semantic_search') { - console.warn('[clinical-mcp] CLINICAL_ASSISTANT_SEARCH_TOOL=nc_semantic_search is deprecated; prefer clinical_semantic_search'); +if (SEARCH_TOOL_NAME !== 'clinical_semantic_search') { + throw new Error('CLINICAL_ASSISTANT_SEARCH_TOOL must be clinical_semantic_search (the nc_semantic_search alias was removed)'); } var MCP_INITIALIZE_TIMEOUT_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_INITIALIZE_TIMEOUT_MS, 30000); var MCP_REQUEST_TIMEOUT_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_REQUEST_TIMEOUT_MS, 90000);