get_notes
Retrieve multiple notes by their identifiers using optional vault ID and specific fields. Works with Flint Note's markdown-based vault system for organized note-taking and AI collaboration.
Instructions
Retrieve multiple notes by their identifiers
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Optional 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. | |
| identifiers | Yes | Array of note identifiers in format "type/filename" or full path | |
| vault_id | No | Optional vault ID to operate on. If not provided, uses the current active vault. |
Input Schema (JSON Schema)
{
"properties": {
"fields": {
"description": "Optional 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.",
"items": {
"type": "string"
},
"type": "array"
},
"identifiers": {
"description": "Array of note identifiers in format \"type/filename\" or full path",
"items": {
"type": "string"
},
"type": "array"
},
"vault_id": {
"description": "Optional vault ID to operate on. If not provided, uses the current active vault.",
"type": "string"
}
},
"required": [
"identifiers"
],
"type": "object"
}
Implementation Reference
- src/server/note-handlers.ts:131-186 (handler)The handler function for the 'get_notes' MCP tool. Validates input, retrieves multiple notes using noteManager.getNote(), applies field filtering, handles errors per note, and returns a structured JSON response with success/failure counts.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) } ] }; };
- src/server/tool-schemas.ts:178-207 (schema)JSON schema definition for the input parameters of the 'get_notes' tool, specifying identifiers (required array of strings), 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'] } },
- src/server.ts:1242-1245 (registration)MCP tool registration in the main server: maps tool name 'get_notes' to the noteHandlers.handleGetNotes method in the CallToolRequestSchema handler.case 'get_notes': return await this.noteHandlers.handleGetNotes( args as unknown as GetNotesArgs );
- src/server/types.ts:44-48 (schema)TypeScript interface definition for GetNotesArgs used by the get_notes handler.export interface GetNotesArgs { identifiers: string[]; vault_id?: string; fields?: string[]; }
- src/server/validation.ts:209-243 (helper)Validation rules for 'get_notes' tool arguments, including custom validators for identifier format in the identifiers array.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 } ],