get_note_info
Retrieve detailed note data, including filename for link creation, by specifying the title or filename. Optionally filter by note type or vault ID to enhance search precision.
Instructions
Get detailed information about a note including filename for link creation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title_or_filename | Yes | Note title or filename to look up | |
| type | No | Optional: note type to narrow search | |
| vault_id | No | Optional vault ID to operate on. If not provided, uses the current active vault. |
Input Schema (JSON Schema)
{
"properties": {
"title_or_filename": {
"description": "Note title or filename to look up",
"type": "string"
},
"type": {
"description": "Optional: note type to narrow search",
"type": "string"
},
"vault_id": {
"description": "Optional vault ID to operate on. If not provided, uses the current active vault.",
"type": "string"
}
},
"required": [
"title_or_filename"
],
"type": "object"
}
Implementation Reference
- src/server/note-handlers.ts:250-305 (handler)The core handler function `handleGetNoteInfo` that implements the logic for the 'get_note_info' tool. It validates arguments, resolves the vault context, searches for notes matching the title_or_filename (optionally filtered by type), and returns structured information including filename, wikilink formats, and suggested wikilinks.handleGetNoteInfo = async (args: GetNoteInfoArgs) => { // Validate arguments validateToolArgs('get_note_info', args); const { noteManager } = await this.resolveVaultContext(args.vault_id); // Try to find the note by title or filename const searchResults = await noteManager.searchNotes({ query: args.title_or_filename, type_filter: args.type, limit: 5 }); if (searchResults.length === 0) { return { content: [ { type: 'text', text: JSON.stringify( { found: false, message: `No note found with title or filename: ${args.title_or_filename}` }, null, 2 ) } ] }; } // Return the best match with filename info const bestMatch = searchResults[0]; const filename = bestMatch.filename.replace('.md', ''); return { content: [ { type: 'text', text: JSON.stringify( { found: true, filename: filename, title: bestMatch.title, type: bestMatch.type, path: bestMatch.path, wikilink_format: `${bestMatch.type}/${filename}`, suggested_wikilink: `[[${bestMatch.type}/${filename}|${bestMatch.title}]]` }, null, 2 ) } ] }; };
- src/server.ts:1296-1299 (registration)Registration of the 'get_note_info' tool in the MCP server's CallToolRequestHandler switch statement, mapping the tool name to the NoteHandlers.handleGetNoteInfo method.case 'get_note_info': return await this.noteHandlers.handleGetNoteInfo( args as unknown as GetNoteInfoArgs );
- src/server.ts:982-1004 (schema)MCP tool schema definition for 'get_note_info' provided in the ListTools response, defining input parameters: title_or_filename (required), type (optional), vault_id (optional).name: 'get_note_info', description: 'Get detailed information about a note including filename for link creation', inputSchema: { type: 'object', properties: { title_or_filename: { type: 'string', description: 'Note title or filename to look up' }, type: { type: 'string', description: 'Optional: note type to narrow search' }, vault_id: { type: 'string', description: 'Optional vault ID to operate on. If not provided, uses the current active vault.' } }, required: ['title_or_filename'] } },
- src/server/types.ts:154-158 (schema)TypeScript interface defining the input arguments for the get_note_info handler.export interface GetNoteInfoArgs { title_or_filename: string; type?: string; vault_id?: string; }
- src/server/validation.ts:537-556 (schema)Validation rules for get_note_info tool arguments used by validateToolArgs function.get_note_info: [ { field: 'title_or_filename', required: true, type: 'string', allowEmpty: false }, { field: 'type', required: false, type: 'string', allowEmpty: false }, { field: 'vault_id', required: false, type: 'string', allowEmpty: false } ],