feat: env-driven clinical search tool name with hard stop and deprecation warning
This commit is contained in:
parent
f1ac24a17d
commit
2dbb446a9c
1 changed files with 9 additions and 1 deletions
|
|
@ -3,6 +3,14 @@ var sleep = require('node:timers/promises').setTimeout;
|
||||||
|
|
||||||
var MCP_URLS = buildMcpUrls();
|
var MCP_URLS = buildMcpUrls();
|
||||||
var _lastGoodMcpUrl = MCP_URLS[0];
|
var _lastGoodMcpUrl = MCP_URLS[0];
|
||||||
|
// Search tool name is env-driven; invalid values stop the app before any MCP call.
|
||||||
|
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');
|
||||||
|
}
|
||||||
var MCP_INITIALIZE_TIMEOUT_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_INITIALIZE_TIMEOUT_MS, 30000);
|
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);
|
var MCP_REQUEST_TIMEOUT_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_REQUEST_TIMEOUT_MS, 90000);
|
||||||
var MCP_SESSION_TTL_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_SESSION_TTL_MS, 10 * 60 * 1000);
|
var MCP_SESSION_TTL_MS = positiveInt(process.env.CLINICAL_ASSISTANT_MCP_SESSION_TTL_MS, 10 * 60 * 1000);
|
||||||
|
|
@ -65,7 +73,7 @@ function closeMcpSession() {
|
||||||
|
|
||||||
async function semanticSearch(query, opts) {
|
async function semanticSearch(query, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
return callMcpTool('nc_semantic_search', {
|
return callMcpTool(SEARCH_TOOL_NAME, {
|
||||||
query: query,
|
query: query,
|
||||||
limit: opts.limit,
|
limit: opts.limit,
|
||||||
doc_types: ['file'],
|
doc_types: ['file'],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue