search_vault
Search across Obsidian vault content, filenames, and metadata using queries with scope filtering and path restrictions.
Instructions
Search vault content across files, filenames, and metadata with advanced filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| scope | No | Search scope - where to look for the query | |
| path_filter | No | Limit search to specific path prefix |
Implementation Reference
- src/index.ts:152-160 (handler)Core implementation of the search_vault tool in ObsidianApiClient class. Constructs query parameters and calls the REST API endpoint `/vault/search`.async searchVault(query: string, scope: string[] = ["content", "filename", "tags"], pathFilter?: string) { const params = new URLSearchParams({ query, scope: scope.join(","), }); if (pathFilter) { params.append("path_filter", pathFilter); } return this.request(`/vault/search?${params}`);
- src/index.ts:365-378 (schema)Input schema for the search_vault tool, defining the expected parameters: query (required), scope (array with enum), and optional path_filter.inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, scope: { type: "array", items: { type: "string", enum: ["content", "filename", "tags"] }, description: "Search scope - where to look for the query", default: ["content", "filename", "tags"] }, path_filter: { type: "string", description: "Limit search to specific path prefix" }, }, required: ["query"], },
- src/index.ts:362-379 (registration)Registration of the search_vault tool in the ListTools response, including name, description, and input schema.{ name: "search_vault", description: "Search vault content across files, filenames, and metadata with advanced filtering", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, scope: { type: "array", items: { type: "string", enum: ["content", "filename", "tags"] }, description: "Search scope - where to look for the query", default: ["content", "filename", "tags"] }, path_filter: { type: "string", description: "Limit search to specific path prefix" }, }, required: ["query"], }, },
- src/index.ts:492-498 (handler)MCP tool call handler in ObsidianMcpServer's switch statement that dispatches search_vault requests to the client.searchVault method.case "search_vault": result = await this.client.searchVault( args?.query as string, args?.scope as string[], args?.path_filter as string ); break;
- src/index.ts:512-512 (helper)Helper usage of searchVault within the legacy 'list_notes' tool handler for search functionality.result = await this.client.searchVault(searchQuery, ["content", "filename", "tags"]);