read_file
Retrieve the content of a specific file from an Obsidian vault using its path, enabling direct access to notes and data through a structured API.
Instructions
Read content of a specific file from the vault
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file |
Implementation Reference
- src/index.ts:112-114 (handler)The core handler function in ObsidianApiClient that executes the tool logic by making a GET request to the Obsidian REST API `/files/{path}` endpoint to read the file content.async readFile(path: string) { return this.request(`/files/${encodeURIComponent(path)}`); }
- src/index.ts:290-300 (registration)Registration of the "read_file" MCP tool, including its name, description, and input schema definition in the tools list for ListToolsRequestHandler.{ name: "read_file", description: "Read content of a specific file from the vault", inputSchema: { type: "object", properties: { path: { type: "string", description: "Path to the file" }, }, required: ["path"], }, },
- src/index.ts:293-299 (schema)Input schema definition for the "read_file" tool, specifying the required 'path' parameter as a string.inputSchema: { type: "object", properties: { path: { type: "string", description: "Path to the file" }, }, required: ["path"], },
- src/index.ts:460-462 (handler)Tool dispatch handler in the CallToolRequestSchema switch statement that invokes the readFile method for "read_file" tool calls.case "read_file": result = await this.client.readFile(args?.path as string); break;