docs_search
Search through project documentation on CastPlan MCP to quickly find relevant information, enabling context-aware coding assistance and streamlined project workflow.
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)MCP tool handler for 'docs_search'. Receives args, calls documentationService.searchDocumentation with the query, and returns an object containing the query and search results.tools.set('docs_search', async (args: any) => { const searchResults = await documentationService.searchDocumentation(args.query); return { query: args.query, results: searchResults }; });
- Input schema for the 'docs_search' tool, defining a required '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:411-412 (registration)Registration of all documentation tools (including 'docs_search') in the main server by calling registerDocumentationTools and adding the tool definitions.const docTools = registerDocumentationTools(this.tools, this.documentationService); this.toolDefinitions.push(...docTools);
- Implementation of searchDocumentation method that performs case-insensitive search through .md files in documentation directories, collecting matching files with metadata.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; }