read_file
Retrieve file contents from Windows systems for automation workflows. Specify the file path to access text or data within files programmatically.
Instructions
读取文件内容
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "read_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 文件路径 |
Implementation Reference
- src/tools/filesystem.js:138-145 (handler)The core handler function for the 'read_file' tool. It asynchronously reads the file content using Node.js fs.promises.readFile and returns a structured response with success status, content or error.
async readFile(filePath) { try { const content = await fs.readFile(filePath, 'utf-8'); return { success: true, content, path: filePath }; } catch (error) { return { success: false, error: error.message }; } } - src/tools/filesystem.js:14-24 (schema)The tool schema definition returned by getToolDefinitions(), including name, description, and inputSchema specifying a required 'path' string parameter.
{ name: 'read_file', description: '读取文件内容', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '文件路径' }, }, required: ['path'], }, }, - src/tools/filesystem.js:117-118 (registration)Registration of the 'read_file' tool within the executeTool switch statement, which delegates to the readFile handler method.
case 'read_file': return await this.readFile(args.path); - src/server.js:44-44 (registration)Instantiation of FileSystemTools class in the main server, which provides the 'read_file' tool among others.
filesystem: new FileSystemTools(),