Skip to main content
Glama

get_notes

Retrieve multiple notes by their identifiers from a local vault, with optional field selection and vault specification for AI collaboration workflows.

Instructions

Retrieve multiple notes by their identifiers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifiersYesArray of note identifiers in format "type/filename" or full path
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.
fieldsNoOptional array of field names to include in response. Supports dot notation for nested fields (e.g. "metadata.tags") and wildcard patterns (e.g. "metadata.*"). If not specified, all fields are returned.

Implementation Reference

  • The primary handler for the 'get_notes' MCP tool. Validates input arguments, resolves the vault context to obtain a noteManager, fetches multiple notes concurrently using Promise.allSettled for error resilience, applies optional field filtering, and returns a structured JSON response with success/failure statistics.
    handleGetNotes = async (args: GetNotesArgs) => { // Validate arguments validateToolArgs('get_notes', args); const { noteManager } = await this.resolveVaultContext(args.vault_id); const results = await Promise.allSettled( args.identifiers.map(async identifier => { try { const note = await noteManager.getNote(identifier); if (!note) { throw new Error(`Note not found: ${identifier}`); } // Apply field filtering if specified const filteredNote = filterNoteFields(note, args.fields); return { success: true, note: filteredNote }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { success: false, error: errorMessage }; } }) ); const processedResults = results.map((result, index) => { if (result.status === 'fulfilled') { return result.value; } else { return { success: false, error: `Failed to retrieve note ${args.identifiers[index]}: ${result.reason}` }; } }); const successful = processedResults.filter(r => r.success).length; const failed = processedResults.filter(r => !r.success).length; const responseData = { success: true, results: processedResults, total_requested: args.identifiers.length, successful, failed }; return { content: [ { type: 'text', text: JSON.stringify(responseData, null, 2) } ] }; };
  • Registers the 'get_notes' tool within the MCP server's CallToolRequestSchema handler, routing calls to the NoteHandlers instance's handleGetNotes method.
    return await this.noteHandlers.handleGetNotes( args as unknown as GetNotesArgs );
  • Defines the JSON schema for the 'get_notes' tool input, specifying required 'identifiers' array and optional 'vault_id' and 'fields'.
    name: 'get_notes', description: 'Retrieve multiple notes by their identifiers', inputSchema: { type: 'object', properties: { identifiers: { type: 'array', items: { type: 'string' }, description: 'Array of note identifiers in type/filename format' }, vault_id: { type: 'string', description: 'Optional vault ID to search in. If not provided, uses the current active vault.' }, fields: { type: 'array', items: { type: 'string' }, description: 'Optional list of fields to include in response (id, title, content, type, filename, path, created, updated, size, metadata)' } }, required: ['identifiers'] } },
  • TypeScript interface defining the expected arguments for the get_notes handler.
    export interface GetNotesArgs { identifiers: string[]; vault_id?: string; fields?: string[]; }
  • Validation rules for 'get_notes' tool arguments, ensuring identifiers are non-empty arrays of valid 'type/filename' strings.
    get_notes: [ { field: 'identifiers', required: true, type: 'array', arrayItemType: 'string', allowEmpty: false, minLength: 1, customValidator: (value: any) => { for (const identifier of value) { if (!identifier.includes('/')) { return `identifier "${identifier}" must be in format "type/filename"`; } const parts = identifier.split('/'); if (parts.length !== 2 || !parts[0] || !parts[1]) { return `identifier "${identifier}" must be in format "type/filename" with both parts non-empty`; } } return null; } }, { field: 'vault_id', required: false, type: 'string', allowEmpty: false }, { field: 'fields', required: false, type: 'array', arrayItemType: 'string', allowEmpty: true } ],

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/disnet/flint-note'

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