Skip to main content
Glama

readNote

Retrieve and display the contents of a specific note from your Obsidian vault using the Obsidian MCP server. Simplify accessing and managing your notes with structured input.

Instructions

Read the contents of a specific note

Input Schema

NameRequiredDescriptionDefault
pathYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "path": { "minLength": 1, "type": "string" } }, "required": [ "path" ], "type": "object" }

Implementation Reference

  • Factory function that returns the tool handler executing the readNote logic: reads note via ObsidianAPI, handles errors, formats response.
    export function createReadNoteTool(api: ObsidianAPI): ToolHandler { return async (params: { path: string }): Promise<ToolResponse> => { try { const note = await api.readNote(params.path); return formatSuccessResponse(note); } catch (error) { return formatErrorResponse(`Error reading note: ${(error as Error).message}`); } }; }
  • Zod input schema and ToolDefinition for the readNote tool.
    // Schema for read-note tool parameters export const ReadNoteSchema = { path: z.string().min(1, "Note path is required") }; /** * Tool definition for reading a note */ export const readNoteDefinition: ToolDefinition = { name: "readNote", description: "Read the contents of a specific note", schema: ReadNoteSchema };
  • src/server.ts:46-52 (registration)
    Registers the readNote tool on the MCP server using its definition and handler factory.
    // 1. readNote - Read the contents of a specific note this.server.tool( readNoteDefinition.name, readNoteDefinition.description, readNoteDefinition.schema, createReadNoteTool(this.api) );
  • Low-level helper method in ObsidianAPI that fetches note content via HTTP GET to the vault endpoint.
    async readNote(path: string): Promise<NoteJson> { const normalizedPath = path.startsWith("/") ? path.substring(1) : path; const response = await this.client.get( `/vault/${encodeURIComponent(normalizedPath)}`, { headers: { ...this.defaultHeaders, "Content-Type": "application/json", accept: "application/vnd.olrapi.note+json", }, } ); return response.data as NoteJson; }

Other Tools

Related Tools

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/takuya0206/obsidian-mcp'

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