Skip to main content
Glama

read_doc

Access and read documentation files from a project directory to enable updates. Input project path and file name to retrieve the required document for modification or review.

Instructions

Read a documentation file (required before updating)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docFileYesName of the documentation file to read
projectPathYesPath to the project root directory

Implementation Reference

  • The handler function for the 'read_doc' tool. It reads the specified documentation file from the .handoff_docs directory, updates the global state with the file content and metadata, and returns the file content as text.
    case "read_doc": {
      const { projectPath, docFile } = request.params.arguments as {
        projectPath: string;
        docFile: string;
      };
    
      try {
        const filePath = `${projectPath}/.handoff_docs/${docFile}`;
        const content = await fs.readFile(filePath, "utf8");
    
        state.lastReadFile = docFile;
        state.lastReadContent = content;
        state.currentFile = docFile;
        state.inProgress = true;
    
        return {
          content: [
            {
              type: "text",
              text: content
            }
          ]
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(
          ErrorCode.InternalError,
          `Error reading documentation: ${errorMessage}`
        );
      }
    }
  • src/index.ts:432-449 (registration)
    The registration of the 'read_doc' tool in the listTools response, including its name, description, and input schema definition.
    {
      name: "read_doc",
      description: "Read a documentation file (required before updating)",
      inputSchema: {
        type: "object",
        properties: {
          projectPath: {
            type: "string",
            description: "Path to the project root directory"
          },
          docFile: {
            type: "string",
            description: "Name of the documentation file to read"
          }
        },
        required: ["projectPath", "docFile"]
      }
    },
  • The input schema definition for the 'read_doc' tool, specifying parameters projectPath and docFile as required strings.
    inputSchema: {
      type: "object",
      properties: {
        projectPath: {
          type: "string",
          description: "Path to the project root directory"
        },
        docFile: {
          type: "string",
          description: "Name of the documentation file to read"
        }
      },
      required: ["projectPath", "docFile"]
    }
Install Server

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/ryanjoachim/mcp-rtfm'

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