Skip to main content
Glama

Obsidian MCP

by takuya0206
read-note.ts1.05 kB
import { z } from "zod"; import { ObsidianAPI } from "../api/obsidian-api.js"; import { formatErrorResponse, formatSuccessResponse } from "../utils/response-utils.js"; import { ToolDefinition, ToolHandler, ToolResponse } from "../types.js"; // 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 }; /** * Creates a tool handler for reading a note * @param api ObsidianAPI instance * @returns Tool handler function */ 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}`); } }; }

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