Skip to main content
Glama

read_file

Read file contents to analyze project structures and generate comprehensive README documentation with proper formatting and sections.

Instructions

Read the contents of a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe absolute path to the file to read

Implementation Reference

  • The handler function for the 'read_file' tool. It extracts the file path from arguments, reads the file content using Node.js fs/promises.readFile, and returns it formatted as MCP tool content response (text type).
    case "read_file": { const { path } = args as { path: string }; const content = await readFile(path, "utf-8"); return { content: [ { type: "text", text: content, }, ], }; }
  • src/index.ts:410-423 (registration)
    The registration of the 'read_file' tool in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (requiring a 'path' string parameter).
    { name: "read_file", description: "Read the contents of a file", inputSchema: { type: "object", properties: { path: { type: "string", description: "The absolute path to the file to read", }, }, required: ["path"], }, },

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/JojoSlice/README-Gen-MCP-Server'

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