Skip to main content
Glama
crazyrabbitLTC

Vibe-Coder MCP Server

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
NameRequiredDescriptionDefault
featureIdYes
documentTypeYes

Implementation Reference

  • 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 }; } }
  • 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) },
  • 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 }; } } );
  • 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); }
  • 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); }
  • Type definition enum for document types used in path generation and validation.
    export enum DocumentType { PRD = 'prd', IMPLEMENTATION_PLAN = 'implementation-plan' }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/crazyrabbitLTC/mcp-vibecoder'

If you have feedback or need assistance with the MCP directory API, please join our Discord server