Skip to main content
Glama
bazylhorsey
by bazylhorsey

get_unique_values

Retrieve all distinct values for a metadata field in your Obsidian vault to analyze content patterns and organize information effectively.

Instructions

Get all unique values for a metadata field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldYesMetadata field name
vaultYesVault name

Implementation Reference

  • Core implementation of get_unique_values tool: iterates over all notes, extracts metadata, collects unique values for the specified field using a Set, handles arrays, and returns sorted array.
    getUniqueValues(field: string): any[] {
      const values = new Set<any>();
    
      for (const note of this.notes) {
        const metadata = this.extractMetadata(note);
        const value = this.getNestedValue(metadata, field);
    
        if (value !== undefined && value !== null) {
          if (Array.isArray(value)) {
            value.forEach(v => values.add(v));
          } else {
            values.add(value);
          }
        }
      }
    
      return Array.from(values);
    }
  • Input schema definition for the get_unique_values tool, requiring 'vault' and 'field' parameters.
    inputSchema: {
      type: 'object',
      properties: {
        vault: { type: 'string', description: 'Vault name' },
        field: { type: 'string', description: 'Metadata field name' },
      },
      required: ['vault', 'field'],
    },
  • src/index.ts:339-350 (registration)
    Tool registration in the list of tools returned by ListToolsRequestHandler.
    {
      name: 'get_unique_values',
      description: 'Get all unique values for a metadata field',
      inputSchema: {
        type: 'object',
        properties: {
          vault: { type: 'string', description: 'Vault name' },
          field: { type: 'string', description: 'Metadata field name' },
        },
        required: ['vault', 'field'],
      },
    },
  • Top-level dispatch handler for get_unique_values: loads notes from vault connector, updates DataviewService, calls getUniqueValues, and formats response.
    case 'get_unique_values': {
      const connector = this.connectors.get(args?.vault as string);
      if (!connector) {
        throw new Error(`Vault "${args?.vault}" not found`);
      }
    
      const notesResult = await connector.getAllNotes();
      if (!notesResult.success || !notesResult.data) {
        throw new Error('Failed to get notes');
      }
    
      this.dataviewService.updateNotes(notesResult.data);
    
      const values = this.dataviewService.getUniqueValues(args?.field as string);
    
      return {
        content: [{ type: 'text', text: JSON.stringify(values, null, 2) }],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states a read operation ('Get') but lacks details on permissions, rate limits, return format, or any behavioral traits like pagination or error handling. This is inadequate 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 directly states the tool's function, making it highly concise and well-structured.

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 no annotations and no output schema, the description is incomplete. It fails to explain what the return values look like (e.g., list of strings, JSON structure) or any operational context, which is crucial for a tool that retrieves data. This leaves significant gaps for an AI agent.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('field' and 'vault') adequately. The description adds no additional meaning beyond implying the tool operates on metadata fields, which aligns with the schema but doesn't provide extra context like examples or constraints.

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 the resource 'unique values for a metadata field', making the purpose understandable. However, it does not differentiate from sibling tools like 'get_note_metadata' or 'list_tags', which might also retrieve metadata-related information, so it misses full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_note_metadata' and 'list_tags' that might overlap in metadata retrieval, there is no explicit or implied context for selection, leaving usage unclear.

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/bazylhorsey/obsidian-mcp-server'

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