Skip to main content
Glama

Obsidian MCP

by takuya0206
list-notes.ts1.2 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 list-notes tool parameters export const ListNotesSchema = { path: z.string().optional().describe("Optional folder path to list notes from") }; /** * Tool definition for listing notes */ export const listNotesDefinition: ToolDefinition = { name: "listNotes", description: "Recursively lists files and folders in the entire Vault or under a specified folder and returns the result as a tree-format string", schema: ListNotesSchema }; /** * Creates a tool handler for listing notes * @param api ObsidianAPI instance * @returns Tool handler function */ export function createListNotesTool(api: ObsidianAPI): ToolHandler { return async (params: { path?: string }): Promise<ToolResponse> => { try { const result = await api.listAllItemsAsTree(params.path); return formatSuccessResponse(result); } catch (error) { return formatErrorResponse(`Error listing notes: ${(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