Skip to main content
Glama
bazylhorsey
by bazylhorsey

get_note_metadata

Retrieve metadata for specific notes in your Obsidian vault to access file properties, tags, and frontmatter information for better organization and analysis.

Instructions

Get metadata for a specific note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesNote path
vaultYesVault name

Implementation Reference

  • src/index.ts:327-338 (registration)
    Registration of the get_note_metadata tool including its input schema in the ListTools handler.
    {
      name: 'get_note_metadata',
      description: 'Get metadata for a specific note',
      inputSchema: {
        type: 'object',
        properties: {
          vault: { type: 'string', description: 'Vault name' },
          path: { type: 'string', description: 'Note path' },
        },
        required: ['vault', 'path'],
      },
    },
  • Handler implementation that loads all notes from the vault, updates the DataviewService, retrieves metadata for the specified note path, and returns it as JSON.
    case 'get_note_metadata': {
      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 metadata = this.dataviewService.getMetadata(args?.path as string);
      if (!metadata) {
        throw new Error(`Note not found: ${args?.path}`);
      }
    
      return {
        content: [{ type: 'text', text: JSON.stringify(metadata, null, 2) }],
      };
    }
  • Core helper function in DataviewService that finds the note by path and delegates to extractMetadata.
    getMetadata(notePath: string): NoteMetadata | null {
      const note = this.notes.find(n => n.path === notePath);
      if (!note) return null;
    
      return this.extractMetadata(note);
    }
  • Extracts comprehensive metadata including file info, frontmatter, and inline fields from a note.
    extractMetadata(note: Note): NoteMetadata {
      const metadata: NoteMetadata = {
        path: note.path,
        title: note.title,
        created: note.createdAt,
        modified: note.modifiedAt,
        tags: note.tags,
        aliases: note.frontmatter?.aliases,
      };
    
      // Add all frontmatter fields
      if (note.frontmatter) {
        Object.assign(metadata, note.frontmatter);
      }
    
      // Extract inline fields
      const inlineFields = this.extractInlineFields(note.content);
      for (const field of inlineFields) {
        if (!metadata[field.key]) {
          metadata[field.key] = this.parseFieldValue(field.value);
        }
      }
    
      return metadata;
    }
  • Type definition for NoteMetadata, the return type of get_note_metadata.
    export interface NoteMetadata {
      // File properties
      path: string;
      title: string;
    
      // Dates
      created?: Date;
      modified?: Date;
    
      // Content properties
      tags?: string[];
      aliases?: string[];
    
      // Custom frontmatter
      [key: string]: any;
    }
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 of behavioral disclosure. It states it's a 'get' operation, implying read-only and non-destructive, but doesn't confirm safety aspects like permissions, rate limits, or error handling. For a tool with zero annotation coverage, this is a significant gap—it lacks details on what 'metadata' includes (e.g., creation date, tags, links) or how it behaves with invalid inputs.

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 zero waste—'Get metadata for a specific note' is front-loaded and directly conveys the core purpose. It's appropriately sized for a simple tool, avoiding unnecessary elaboration. Every word earns its place, making it easy for an agent to parse quickly.

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 tool's moderate complexity (2 required parameters, no output schema, and no annotations), the description is incomplete. It doesn't explain what 'metadata' entails (e.g., fields returned), how errors are handled, or how it differs from similar tools. With no output schema to clarify returns, the description should provide more context to help the agent understand the tool's full behavior and use cases.

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%, with both parameters ('path' and 'vault') well-documented in the schema as 'Note path' and 'Vault name'. The description adds no additional meaning beyond this, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate—the description doesn't compensate but doesn't need to given high coverage.

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

Purpose3/5

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

The description 'Get metadata for a specific note' clearly states the action (get) and resource (note metadata), which is adequate. However, it doesn't differentiate from sibling tools like 'get_note' (which likely retrieves full content) or 'get_periodic_note_info' (which might provide structured metadata for periodic notes), leaving the scope vague. It's not tautological but lacks specificity about what 'metadata' entails compared to alternatives.

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' (for full content), 'get_periodic_note_info' (for periodic note details), and 'get_related_notes' (for connections), there's no indication of context, prerequisites, or exclusions. It implies usage for metadata retrieval but offers no comparative advice, leaving the agent to guess based on tool names alone.

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