get_document_path
Retrieve file paths for specific feature documentation by providing feature ID and document type to locate development resources.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| featureId | Yes | ||
| documentType | Yes |
Implementation Reference
- src/mcp-server.ts:637-681 (handler)The main handler function for the 'get_document_path' MCP tool. It validates the feature and document existence, maps the document type string to the DocumentType enum, and returns the default file path obtained from documentStorage.getDefaultFilePath.async ({ featureId, documentType }) => { try { // Check if the feature exists const feature = getFeature(featureId); if (!feature) { throw new Error(`Feature ${featureId} not found`); } // Map the string to DocumentType enum let docType: DocumentType; if (documentType === 'prd') { docType = DocumentType.PRD; } else if (documentType === 'implementation-plan') { docType = DocumentType.IMPLEMENTATION_PLAN; } else { throw new Error(`Invalid document type: ${documentType}. Expected 'prd' or 'implementation-plan'`); } // Check if the document exists if (!documentStorage.hasDocument(feature.id, docType)) { throw new Error(`Document of type ${documentType} not found for feature ${feature.id}`); } // Get the default file path for the document const filePath = documentStorage.getDefaultFilePath(feature.id, docType); // Get the document to check if it's been saved const document = documentStorage.getDocument(feature.id, docType); return { content: [{ type: "text", text: `Document path: ${filePath}\nSaved to disk: ${document?.metadata.isSaved ? 'Yes' : 'No'}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving document path: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/mcp-server.ts:633-636 (schema)Zod input schema defining parameters: featureId (string, min length 1) and documentType (string, min length 1).{ featureId: z.string().min(1), documentType: z.string().min(1) },
- src/mcp-server.ts:631-682 (registration)Registration of the 'get_document_path' tool using server.tool() with name, input schema, and handler function.server.tool( "get_document_path", { featureId: z.string().min(1), documentType: z.string().min(1) }, async ({ featureId, documentType }) => { try { // Check if the feature exists const feature = getFeature(featureId); if (!feature) { throw new Error(`Feature ${featureId} not found`); } // Map the string to DocumentType enum let docType: DocumentType; if (documentType === 'prd') { docType = DocumentType.PRD; } else if (documentType === 'implementation-plan') { docType = DocumentType.IMPLEMENTATION_PLAN; } else { throw new Error(`Invalid document type: ${documentType}. Expected 'prd' or 'implementation-plan'`); } // Check if the document exists if (!documentStorage.hasDocument(feature.id, docType)) { throw new Error(`Document of type ${documentType} not found for feature ${feature.id}`); } // Get the default file path for the document const filePath = documentStorage.getDefaultFilePath(feature.id, docType); // Get the document to check if it's been saved const document = documentStorage.getDocument(feature.id, docType); return { content: [{ type: "text", text: `Document path: ${filePath}\nSaved to disk: ${document?.metadata.isSaved ? 'Yes' : 'No'}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving document path: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
- src/document-storage.ts:113-117 (helper)Private helper method in DocumentStorage class that constructs the file path for a document based on feature ID, document type, root directory, and .md extension.private getDocumentPath(featureId: string, type: DocumentType): string { const featureDir = path.join(this.options.rootDir, featureId); const filename = `${type}.md`; return path.join(featureDir, filename); }
- src/document-storage.ts:306-308 (helper)Public helper method that delegates to the private getDocumentPath method to retrieve the default file path for a document.public getDefaultFilePath(featureId: string, type: DocumentType): string { return this.getDocumentPath(featureId, type); }
- src/document-storage.ts:30-33 (schema)Type definition enum for document types used in path generation and validation.export enum DocumentType { PRD = 'prd', IMPLEMENTATION_PLAN = 'implementation-plan' }