read_file
Retrieve the complete contents of a specified file by providing its path. Enables Claude AI to access and process file data within allowed filesystem operations.
Instructions
Read complete contents of a file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file to read |
Implementation Reference
- src/index.ts:237-250 (handler)Handler function for the 'read_file' tool: extracts path, validates access, reads file content with fs.readFile, returns as text content.case 'read_file': { const { path: filePath } = request.params.arguments as { path: string }; validatePath(filePath); const content = await fs.readFile(filePath, 'utf8'); return { content: [ { type: 'text', text: content, }, ], }; }
- src/index.ts:98-107 (schema)Input schema for read_file tool defining the required 'path' parameter.inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the file to read', }, }, required: ['path'], },
- src/index.ts:95-108 (registration)Registration of the read_file tool in the ListTools response, including name, description, and schema.{ name: 'read_file', description: 'Read complete contents of a file', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the file to read', }, }, required: ['path'], }, },