Skip to main content
Glama
j-shelfwood

Obsidian Local REST API MCP Server

by j-shelfwood

get_metadata_values

Retrieve all unique values for a specific frontmatter key in your Obsidian vault to analyze metadata and organize notes.

Instructions

Get all unique values for a specific frontmatter key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesFrontmatter key

Implementation Reference

  • Core implementation of the get_metadata_values tool in the ObsidianApiClient class. This method makes an HTTP request to the Obsidian REST API endpoint `/metadata/values/{key}` to retrieve unique values for the specified frontmatter key.
    async getMetadataValues(key: string) {
      return this.request(`/metadata/values/${encodeURIComponent(key)}`);
    }
  • Dispatch logic in the MCP server's CallToolRequest handler that routes calls to 'get_metadata_values' to the client implementation.
    case "get_metadata_values":
      result = await this.client.getMetadataValues(args?.key as string);
      break;
  • Input schema definition and tool registration for 'get_metadata_values' in the ListToolsRequest response.
    {
      name: "get_metadata_values",
      description: "Get all unique values for a specific frontmatter key",
      inputSchema: {
        type: "object",
        properties: {
          key: { type: "string", description: "Frontmatter key" },
        },
        required: ["key"],
      },
    },
  • src/index.ts:272-440 (registration)
    Registration of all tools including get_metadata_values via the ListToolsRequest handler in setupTools method.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        // Directory Operations
        {
          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 },
            },
          },
        },
    
        // File Operations
        {
          name: "read_file",
          description: "Read content of a specific file from the vault",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path to the file" },
            },
            required: ["path"],
          },
        },
        {
          name: "write_file",
          description: "Write file content with different modes: overwrite (default), append, or prepend. Handles both create and update operations.",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path to the file" },
              content: { type: "string", description: "Content to write" },
              mode: { type: "string", enum: ["overwrite", "append", "prepend"], description: "Write mode", default: "overwrite" },
            },
            required: ["path", "content"],
          },
        },
        {
          name: "delete_item",
          description: "Delete a file or directory from the vault",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path to the item to delete" },
            },
            required: ["path"],
          },
        },
    
        // AI-Native Note Operations
        {
          name: "create_or_update_note",
          description: "Create or update a note with content and frontmatter. Performs upsert operation - creates if doesn't exist, updates if it does.",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path for the note (without .md extension)" },
              content: { type: "string", description: "Note content" },
              frontmatter: { type: "object", description: "Frontmatter metadata", default: {} },
            },
            required: ["path", "content"],
          },
        },
        {
          name: "get_daily_note",
          description: "Get daily note for a specific date. Handles common daily note naming conventions and file locations.",
          inputSchema: {
            type: "object",
            properties: {
              date: { type: "string", description: "Date (today, yesterday, tomorrow, or YYYY-MM-DD)", default: "today" },
            },
          },
        },
        {
          name: "get_recent_notes",
          description: "Get recently modified notes, ordered by modification time",
          inputSchema: {
            type: "object",
            properties: {
              limit: { type: "number", description: "Number of recent notes to return", default: 5 },
            },
          },
        },
    
        // Enhanced Search and Discovery
        {
          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"],
          },
        },
        {
          name: "find_related_notes",
          description: "Find notes related to a given note based on shared tags, links, or backlinks",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path to the source note" },
              on: {
                type: "array",
                items: { type: "string", enum: ["tags", "links"] },
                description: "Relationship criteria to use for finding related notes",
                default: ["tags", "links"]
              },
            },
            required: ["path"],
          },
        },
    
        // Legacy Tools (for backward compatibility)
        {
          name: "get_note",
          description: "Get a specific note with its content and metadata (legacy)",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string", description: "Path to the note" },
            },
            required: ["path"],
          },
        },
        {
          name: "list_notes",
          description: "List all notes in the vault with optional search filter (legacy with search support)",
          inputSchema: {
            type: "object",
            properties: {
              search: { type: "string", description: "Optional search query to filter notes" },
            },
          },
        },
        {
          name: "get_metadata_keys",
          description: "Get all available frontmatter keys from notes",
          inputSchema: {
            type: "object",
            properties: {},
          },
        },
        {
          name: "get_metadata_values",
          description: "Get all unique values for a specific frontmatter key",
          inputSchema: {
            type: "object",
            properties: {
              key: { type: "string", description: "Frontmatter key" },
            },
            required: ["key"],
          },
        },
      ],
    }));
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on permissions, rate limits, or output format (e.g., whether values are returned as a list, sorted, or deduplicated). This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It is front-loaded and clearly conveys the core functionality without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain the return values (e.g., format, structure) or behavioral aspects like error handling, making it inadequate for a tool that retrieves data without structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'key' fully documented in the schema. The description adds minimal value by mentioning 'frontmatter key' but doesn't provide additional context like examples or constraints beyond what the schema already states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('unique values for a specific frontmatter key'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_metadata_keys' or 'search_vault', which might also involve metadata operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this is for retrieving all values across notes or in a specific context, or how it differs from 'get_metadata_keys' or 'search_vault' for metadata-related queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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