search-docs
Submit a text query to search Pinecone documentation and retrieve relevant information. Use this tool to find answers for your development questions.
Instructions
Search Pinecone documentation for relevant information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The text to search for. |
Implementation Reference
- src/tools/docs/search-docs.ts:44-56 (handler)The addSearchDocsTool function registers the 'search-docs' tool on the server. The handler connects to a Pinecone documentation MCP client, calls the 'get_context' tool with the query, and returns the result.
export function addSearchDocsTool(server: McpServer) { server.registerTool( 'search-docs', {description: INSTRUCTIONS, inputSchema: SCHEMA}, async ({query}) => { const client = await getDocsClient(); return (await client.callTool({ name: 'get_context', arguments: {query}, })) as SearchDocsResult; }, ); - src/tools/docs/search-docs.ts:10-12 (schema)Input schema for the 'search-docs' tool: a single required 'query' string parameter.
const SCHEMA = { query: z.string().describe('The text to search for.'), }; - src/tools/docs/search-docs.ts:44-57 (registration)The tool is registered via server.registerTool() with the name 'search-docs'.
export function addSearchDocsTool(server: McpServer) { server.registerTool( 'search-docs', {description: INSTRUCTIONS, inputSchema: SCHEMA}, async ({query}) => { const client = await getDocsClient(); return (await client.callTool({ name: 'get_context', arguments: {query}, })) as SearchDocsResult; }, ); } - src/tools/docs/search-docs.ts:33-42 (helper)getDocsClient() lazily initializes and caches the docs MCP client (singleton pattern with retry on failure).
function getDocsClient(): Promise<Client> { if (!clientPromise) { clientPromise = initializeClient().catch((error) => { // Reset on failure so next call can retry clientPromise = null; throw error; }); } return clientPromise; } - src/tools/docs/search-docs.ts:23-31 (helper)initializeClient() creates a StreamableHTTPClientTransport connected to DOCS_MCP_URL and a Client named 'pinecone-docs'.
async function initializeClient(): Promise<Client> { const httpTransport = new StreamableHTTPClientTransport(new URL(DOCS_MCP_URL)); const client = new Client({ name: 'pinecone-docs', version: PINECONE_MCP_VERSION, }); await client.connect(httpTransport); return client; }