search_docs
Find specific documentation content using Elasticsearch queries, specifying keywords and syntax (e.g., "install AND guide"). Supports pagination for organized results.
Instructions
Search documentation using the probe search engine.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Optional page number for pagination of results (e.g., 1, 2, 3...). Default is 1. | |
| query | Yes | Elasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal"). |
Implementation Reference
- src/index.js:178-203 (handler)The core handler function that executes the 'search_docs' tool logic by calling the external 'search' function from '@probelabs/probe' with the query on the configured data directory.async executeDocsSearch(args) { try { // Always use the configured data directory const searchPath = config.dataDir; // Create a clean options object const options = { path: searchPath, query: args.query, maxTokens: 10000 // Set default maxTokens // Removed filesOnly, maxResults, session }; console.error("Executing search with options:", JSON.stringify(options, null, 2)); // Call search with the options object const result = await search(options); return result; } catch (error) { console.error('Error executing docs search:', error); throw new McpError( ErrorCode.MethodNotFound, `Error executing docs search: ${error.message || String(error)}` ); } }
- src/index.js:102-116 (schema)The input schema definition for the 'search_docs' tool, specifying the expected arguments (query required, page optional).inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Elasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal").', }, page: { type: 'number', description: 'Optional page number for pagination of results (e.g., 1, 2, 3...). Default is 1.', default: 1, // Set a default value } }, required: ['query'] // 'page' is optional },
- src/index.js:97-119 (registration)Registration of the 'search_docs' tool via the ListToolsRequestSchema handler, which lists the tool with its name, description, and schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: config.toolName, // Use configured tool name description: config.toolDescription, // Use configured description inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Elasticsearch query string. Focus on keywords and use ES syntax (e.g., "install AND guide", "configure OR setup", "api NOT internal").', }, page: { type: 'number', description: 'Optional page number for pagination of results (e.g., 1, 2, 3...). Default is 1.', default: 1, // Set a default value } }, required: ['query'] // 'page' is optional }, }, ], }));
- src/config.js:28-29 (registration)Default configuration defining the tool name 'search_docs' and its description, used in registration.toolName: 'search_docs', toolDescription: 'Search documentation using the probe search engine.',
- src/index.js:59-61 (schema)TypeScript-style typedef for SearchDocsArgs used in the handler documentation.* @typedef {Object} SearchDocsArgs * @property {string|string[]} query - The search query using Elasticsearch syntax. Focus on keywords. */