docs_reference
Locate and reference essential documentation based on file paths, work context, and category to streamline development tasks on the CastPlan MCP server.
Instructions
Find and reference relevant documentation for development work
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Primary category of work (optional, auto-detected if not provided) | |
| context | Yes | Context or description of the work being done | |
| files | Yes | Array of file paths being worked on | |
| workType | No | Type of work being done (optional, auto-detected if not provided) |
Implementation Reference
- src/tools/documentation/index.ts:93-101 (handler)Handler function for the 'docs_reference' tool. It delegates to DocumentationService.processDocumentationRequest with action 'reference' and the provided arguments.tools.set('docs_reference', async (args: any) => { return await documentationService.processDocumentationRequest({ action: 'reference', files: args.files, context: args.context, category: args.category, workType: args.workType }); });
- Input schema definition for the 'docs_reference' tool, defining parameters like files, context, category, and workType.{ name: 'docs_reference', description: 'Find and reference relevant documentation for development work', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'Array of file paths being worked on' }, context: { type: 'string', description: 'Context or description of the work being done' }, category: { type: 'string', enum: ['frontend', 'backend', 'electron', 'database', 'testing'], description: 'Primary category of work (optional, auto-detected if not provided)' }, workType: { type: 'string', enum: ['implement', 'fix', 'refactor', 'optimize', 'test', 'deploy', 'security'], description: 'Type of work being done (optional, auto-detected if not provided)' } }, required: ['files', 'context'] } },
- src/tools/documentation/index.ts:8-122 (registration)Function that registers the 'docs_reference' tool handler and returns tool definitions including its schema. Called from main MCP server.export function registerDocumentationTools( tools: Map<string, Function>, documentationService: DocumentationService ): MCPTool[] { // Tool definitions const documentationTools: MCPTool[] = [ { name: 'docs_reference', description: 'Find and reference relevant documentation for development work', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'Array of file paths being worked on' }, context: { type: 'string', description: 'Context or description of the work being done' }, category: { type: 'string', enum: ['frontend', 'backend', 'electron', 'database', 'testing'], description: 'Primary category of work (optional, auto-detected if not provided)' }, workType: { type: 'string', enum: ['implement', 'fix', 'refactor', 'optimize', 'test', 'deploy', 'security'], description: 'Type of work being done (optional, auto-detected if not provided)' } }, required: ['files', 'context'] } }, { name: 'docs_update', description: 'Update documentation after completing development work', inputSchema: { type: 'object', properties: { files: { type: 'array', items: { type: 'string' }, description: 'Array of file paths that were modified' }, context: { type: 'string', description: 'Description of changes made' }, category: { type: 'string', enum: ['frontend', 'backend', 'electron', 'database', 'testing'], description: 'Primary category of work (optional, auto-detected if not provided)' } }, required: ['files', 'context'] } }, { name: 'docs_search', description: 'Search through project documentation', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query to find relevant documentation' } }, required: ['query'] } }, { name: 'docs_validate', description: 'Validate documentation structure and completeness', inputSchema: { type: 'object', properties: {}, required: [] } } ]; // Register tool handlers tools.set('docs_reference', async (args: any) => { return await documentationService.processDocumentationRequest({ action: 'reference', files: args.files, context: args.context, category: args.category, workType: args.workType }); }); tools.set('docs_update', async (args: any) => { return await documentationService.processDocumentationRequest({ action: 'update', files: args.files, context: args.context, category: args.category }); }); tools.set('docs_search', async (args: any) => { const searchResults = await documentationService.searchDocumentation(args.query); return { query: args.query, results: searchResults }; }); tools.set('docs_validate', async () => { return await documentationService.validateDocumentationStructure(); }); return documentationTools; }
- Core helper method in DocumentationService that handles the 'reference' action for docs_reference by building context and finding relevant docs.async processDocumentationRequest(request: DocumentationRequest): Promise<DocumentationResponse> { try { const context = this.buildDocumentationContext(request); if (request.action === 'reference') { return await this.referenceDocumentation(context); } else if (request.action === 'update') { return await this.updateDocumentation(context, request.context); } else { throw new Error(`Unknown action: ${request.action}`); } } catch (error: any) { return { success: false, message: `Documentation processing failed: ${error.message}` }; } }