Skip to main content
Glama

Obsidian MCP

by takuya0206
read-active-note.ts1.08 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-active-note tool parameters (empty as no parameters are required) export const ReadActiveNoteSchema = {}; /** * Tool definition for reading the active note */ export const readActiveNoteDefinition: ToolDefinition = { name: "readActiveNote", description: "Read the contents of the current active note", schema: ReadActiveNoteSchema }; /** * Creates a tool handler for reading the active note * @param api ObsidianAPI instance * @returns Tool handler function */ export function createReadActiveNoteTool(api: ObsidianAPI): ToolHandler { return async (): Promise<ToolResponse> => { try { const note = await api.readActiveNote(); return formatSuccessResponse(note); } catch (error) { return formatErrorResponse(`Error reading active 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