Skip to content

Commit a55bc9f

Browse files
author
zho
committed
changed the logic to use a submodule
1 parent d268bac commit a55bc9f

1 file changed

Lines changed: 10 additions & 41 deletions

File tree

src/constants.ts

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Constants for Pinecone Read-Only MCP
33
*/
44

5-
import { createRequire } from 'node:module';
6-
75
export const DEFAULT_INDEX_NAME = 'rag-hybrid';
86
export const DEFAULT_RERANK_MODEL = 'bge-reranker-v2-m3';
97
export const DEFAULT_TOP_K = 10;
@@ -34,52 +32,23 @@ export const MAX_QUERY_DOCUMENTS_TOP_K = 20;
3432
export const QUERY_DOCUMENTS_MAX_CHUNKS = 500;
3533

3634
export const SERVER_NAME = 'Pinecone Read-Only MCP';
35+
export { SERVER_VERSION } from './server-version.js';
3736

38-
/**
39-
* Read package.json at runtime so SERVER_VERSION (advertised via MCP serverInfo)
40-
* always matches the published package version.
41-
*
42-
* `createRequire` is used because:
43-
* - JSON imports with `with { type: 'json' }` clash with `rootDir: ./src`.
44-
* - Reading at runtime avoids a build-time codegen step.
45-
*
46-
* Falls back to `0.0.0-dev` only if package.json is unreachable (e.g. when
47-
* dist files are copied without the manifest); operators see a clearly fake
48-
* version instead of a stale hardcoded number.
49-
*/
50-
function readPackageVersion(): string {
51-
try {
52-
const require = createRequire(import.meta.url);
53-
const pkg = require('../package.json') as { version?: string };
54-
return typeof pkg.version === 'string' && pkg.version.length > 0 ? pkg.version : '0.0.0-dev';
55-
} catch {
56-
return '0.0.0-dev';
57-
}
58-
}
59-
60-
export const SERVER_VERSION: string = readPackageVersion();
61-
62-
export const SERVER_INSTRUCTIONS = `Quickstart for AI clients: for most user questions, call \`guided_query\` with the user's question — it does namespace routing, suggestion, and execution in one shot and returns a decision_trace you can show the user. For manual flows, call \`list_namespaces\` -> \`suggest_query_params\` -> \`query_fast\` / \`query_detailed\` / \`count\` (the suggest step is a mandatory gate). Use \`query_documents\` for full-document reading, \`keyword_search\` for exact-keyword retrieval against the sparse index, and \`generate_urls\` when records need URLs synthesized from metadata.
63-
64-
A semantic search server that provides hybrid search capabilities over Pinecone vector indexes with automatic namespace discovery.
37+
export const SERVER_INSTRUCTIONS = `A semantic search server that provides hybrid search capabilities over Pinecone vector indexes with automatic namespace discovery.
6538
6639
Features:
6740
- Hybrid Search: Combines dense and sparse embeddings for superior recall
68-
- Semantic Reranking: Uses a configurable reranker model (default bge-reranker-v2-m3) for improved precision
41+
- Semantic Reranking: Uses BGE reranker model for improved precision
6942
- Dynamic Namespace Discovery: Automatically discovers available namespaces
7043
- Metadata Filtering: Supports optional metadata filters for refined searches
7144
- Namespace Router: Suggests likely namespace(s) from natural-language intent
7245
- Count: Use the count tool for "how many X?" questions; it uses semantic search only and minimal fields (no content) for performance, returning unique document count.
73-
- URL Generation: Use generate_urls to synthesize URLs for namespaces that have a registered generator when metadata lacks url.
74-
- Document reassembly: Use query_documents to get whole documents (chunks grouped and merged by document_number/doc_id/url) for content analysis or summarization. query_documents always reranks for best document-level relevance.
75-
- Keyword search: Use keyword_search to query the sparse index for lexical/keyword-only retrieval without reranking.
46+
- URL Generation: Use generate_urls to synthesize URLs for namespaces that support it when metadata lacks url.
47+
- Document reassembly: Use query_documents to get whole documents (chunks grouped and merged by document_number/doc_id/url) for content analysis or summarization.
48+
- Keyword search: Use keyword_search to query the sparse index (default: rag-hybrid-sparse) for lexical/keyword-only retrieval without reranking.
7649
7750
Usage:
78-
1. Use list_namespaces (cached) to discover available namespaces in the index. The response includes \`expires_at_iso\` so you know when to refresh.
79-
2. Optionally use namespace_router to choose candidate namespace(s) from user intent.
80-
3. Call suggest_query_params before query/count/query_documents tools (mandatory flow gate) to get suggested_fields and recommended_tool.
81-
4. Use count for count questions, query_fast/query_detailed for chunk-level retrieval, or query_documents for full-document content.
82-
83-
Notes:
84-
- Result rows include both \`document_id\` (canonical) and \`paper_number\` (deprecated alias kept for one minor cycle; will be removed in the next major release). Prefer \`document_id\` in new code.
85-
- The server emits structured logs to stderr (text by default, set PINECONE_READ_ONLY_MCP_LOG_FORMAT=json for log aggregation).`;
51+
1. Use list_namespaces (cached for 30 minutes) to discover available namespaces in the index
52+
2. Optionally use namespace_router to choose candidate namespace(s) from user intent
53+
3. Call suggest_query_params before query/count/query_documents tools (mandatory flow gate) to get suggested_fields and recommended tool
54+
4. Use count for count questions, query_fast/query_detailed for chunk-level retrieval, or query_documents for full-document content`;

0 commit comments

Comments
 (0)