Skip to main content
Glama

test_docs_path

Tests the document path configuration for the MCP Document Server to ensure proper access to markdown files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler logic for the 'test_docs_path' tool. It attempts to list all .md files in the '../documents/' directory using the listMarkdownFiles helper, resolves the directory path, and returns a text content block with the results or an error message if the directory cannot be read.
    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)}` 
          }]
        };
      }
    }
  • Empty input schema for 'test_docs_path', indicating the tool takes no parameters.
    {},
  • tools/index.js:15-36 (registration)
    Registration of the 'test_docs_path' tool within the registerTools function, specifying the name, schema, and handler.
    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)}` 
            }]
          };
        }
      }
    );
  • Helper function imported and used by the test_docs_path handler to list Markdown files (.md) in the specified base directory, filtering out dotfiles.
    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);
        }
      }
  • server.js:21-21 (registration)
    Invocation of registerTools which includes the registration of test_docs_path among other tools.
    registerTools(mcpServer);

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other 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