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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The absolute path to the file to read |
Implementation Reference
- src/index.ts:486-497 (handler)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"], }, },