docs_search
Search project documentation to find relevant information for development tasks within the CastPlan MCP server.
Instructions
Search through project documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find relevant documentation |
Implementation Reference
- src/tools/documentation/index.ts:112-115 (handler)The handler function for the 'docs_search' MCP tool. It receives arguments, calls the DocumentationService.searchDocumentation method with the query, and returns the results wrapped with the original query.tools.set('docs_search', async (args: any) => { const searchResults = await documentationService.searchDocumentation(args.query); return { query: args.query, results: searchResults }; });
- The input schema definition for the 'docs_search' tool, specifying that it requires a 'query' string parameter.{ name: 'docs_search', description: 'Search through project documentation', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query to find relevant documentation' } }, required: ['query'] } },
- src/index.ts:410-412 (registration)Top-level registration of documentation tools (including 'docs_search') into the main tools map and toolDefinitions array during server initialization.if (this.config.services.documentation && this.documentationService) { const docTools = registerDocumentationTools(this.tools, this.documentationService); this.toolDefinitions.push(...docTools);
- Core implementation of documentation search in DocumentationService. Scans markdown files in documentation directories for matches to the query string and returns matching DocumentInfo objects.async searchDocumentation(query: string): Promise<DocumentInfo[]> { const allDocs: DocumentInfo[] = []; // Search in all documentation directories const searchDirs = [this.docsRoot, this.masterDocs]; for (const searchDir of searchDirs) { if (this.fs.existsSync(searchDir)) { const files = await this.scanDirectory(searchDir, '.md'); for (const file of files) { try { const content = this.fs.readFileSync(file, 'utf8'); if (content.toLowerCase().includes(query.toLowerCase())) { allDocs.push({ path: file, category: this.path.relative(this.projectRoot, this.path.dirname(file)), relevance: 'medium', lastModified: this.fs.statSync(file).mtime }); } } catch (error: any) { console.warn(`Error searching file ${file}: ${error.message}`); } } } } return allDocs; }