@razorpay/blade-mcp
Version:
Model Context Protocol server for Blade
24 lines • 1.16 kB
JavaScript
import { readFileSync } from 'fs';
import { resolve } from 'path';
import { KNOWLEDGEBASE_DIRECTORY } from './tokens.js';
const getBladeDocsResponseText = ({ docsList, documentationType, }) => {
// Parse the comma-separated string into an array of component names
const docNames = docsList.split(',').map((name) => name.trim());
// Build the formatted documentation text
let responseText = `Blade ${documentationType} documentation for: ${docsList}\n\n`;
// Process each component
for (const docName of docNames) {
responseText += `# ${docName}\n`;
try {
const filePath = resolve(KNOWLEDGEBASE_DIRECTORY, documentationType, `${docName}.md`);
const content = readFileSync(filePath, 'utf8');
responseText += `${content}\n\n`;
}
catch (error) {
responseText += `⚠️ Error: Could not read documentation for ${docName} in ${documentationType}. The documentation may not exist or there may be an issue with the file.\n\n`;
}
}
return responseText;
};
export { getBladeDocsResponseText };
//# sourceMappingURL=getBladeDocsResponseText.js.map