Skip to main content
Glama

test_docs_path

Validate and test document paths on the MCP Document Server to ensure proper access and management of markdown files in local development environments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler for 'test_docs_path' MCP tool: resolves the documents directory, lists markdown files using helper, and returns formatted text response or error.
    async () => { const baseDir = '../documents/'; try { const files = await listMarkdownFiles(baseDir); return { content: [{ type: "text", text: `Directory path: ${path.resolve(baseDir)}\n\nFiles found:\n${files.join('\n')}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error reading directory: ${error.message}\n\nAttempted path: ${path.resolve(baseDir)}` }] }; } }
  • tools/index.js:15-36 (registration)
    Registration of the 'test_docs_path' tool on the MCP server, with empty input schema and inline handler function.
    mcpServer.tool("test_docs_path", {}, async () => { const baseDir = '../documents/'; try { const files = await listMarkdownFiles(baseDir); return { content: [{ type: "text", text: `Directory path: ${path.resolve(baseDir)}\n\nFiles found:\n${files.join('\n')}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error reading directory: ${error.message}\n\nAttempted path: ${path.resolve(baseDir)}` }] }; } } );
  • Supporting utility function listMarkdownFiles that reads a directory, filters for .md files (excluding dotfiles), and handles common FS errors with custom FileSystemError.
    export async function listMarkdownFiles(baseDir) { try { const dirents = await fs.readdir(baseDir, { withFileTypes: true }); return dirents .filter(dirent => dirent.isFile() && dirent.name.toLowerCase().endsWith('.md') && !dirent.name.startsWith('.') ) .map(dirent => dirent.name); } catch (error) { if (error.code === 'ENOENT') { throw new FileSystemError('Directory not found', 'ENOENT'); } if (error.code === 'EACCES') { throw new FileSystemError('Permission denied', 'EACCES'); } throw new FileSystemError(`Error listing files: ${error.message}`, error.code); } }

Other Tools

Related Tools

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/motiondesignlv/MCP_server'

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