Skip to main content
Glama

read_doc

Access Laravel documentation files to retrieve specific implementation details, coding rules, or design system guides for development tasks.

Instructions

Read a specific documentation file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the documentation file relative to docs root

Implementation Reference

  • The read_doc tool handler function that reads a specific documentation file. It takes a file_path parameter, validates the file exists, reads its content using fs.readFileSync, and returns it as text content.
    async ({ file_path }) => {
      const filePath = path.join(DOCS_PATH, file_path);
    
      if (!fs.existsSync(filePath)) {
        throw new Error(`Documentation file not found: ${file_path}`);
      }
    
      const content = fs.readFileSync(filePath, 'utf-8');
    
      return {
        content: [{
          type: 'text',
          text: content,
        }],
      };
    }
  • index.js:97-121 (registration)
    Complete registration of the read_doc tool with the MCP server, including the tool name, description, input schema, and handler function.
    server.registerTool(
      'read_doc',
      {
        description: 'Read a specific documentation file',
        inputSchema: {
          file_path: z.string().describe('Path to the documentation file relative to docs root'),
        },
      },
      async ({ file_path }) => {
        const filePath = path.join(DOCS_PATH, file_path);
    
        if (!fs.existsSync(filePath)) {
          throw new Error(`Documentation file not found: ${file_path}`);
        }
    
        const content = fs.readFileSync(filePath, 'utf-8');
    
        return {
          content: [{
            type: 'text',
            text: content,
          }],
        };
      }
    );
  • Input schema definition for the read_doc tool, specifying that it requires a file_path string parameter.
    inputSchema: {
      file_path: z.string().describe('Path to the documentation file relative to docs root'),
    },

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/pujandan/mcp-laravel'

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