Skip to main content
Glama
j-shelfwood

Obsidian Local REST API MCP Server

by j-shelfwood

list_directory

List directory contents with pagination to prevent overload. Specify path, recursion, and limits to retrieve files efficiently within an Obsidian vault using a local REST API.

Instructions

List directory contents with pagination to prevent context overflow. Shows immediate contents by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum items to return
offsetNoPagination offset
pathNoDirectory path to list.
recursiveNoInclude subdirectories recursively

Implementation Reference

  • Core implementation of the list_directory tool in ObsidianApiClient. Makes a paginated GET request to the Obsidian REST API /vault/directory endpoint.
    async listDirectory(path: string = ".", recursive: boolean = false, limit: number = 50, offset: number = 0) { const params = new URLSearchParams({ path, recursive: recursive.toString(), limit: limit.toString(), offset: offset.toString(), }); return this.request(`/vault/directory?${params}`); }
  • Input schema and metadata definition for the list_directory tool, registered in ListToolsRequestSchema handler.
    name: "list_directory", description: "List directory contents with pagination to prevent context overflow. Shows immediate contents by default.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Directory path to list", default: "." }, recursive: { type: "boolean", description: "Include subdirectories recursively", default: false }, limit: { type: "number", description: "Maximum items to return", default: 50 }, offset: { type: "number", description: "Pagination offset", default: 0 }, }, }, },
  • src/index.ts:451-458 (registration)
    Tool handler registration in the MCP CallToolRequestSchema switch dispatcher, mapping tool calls to the client.listDirectory method.
    case "list_directory": result = await this.client.listDirectory( args?.path as string, args?.recursive as boolean, args?.limit as number, args?.offset as number ); break;

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/j-shelfwood/obsidian-local-rest-api-mcp'

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