Skip to main content
Glama

read_multiple_notes

Retrieve contents of multiple note files at once by specifying their paths relative to your notes directory. Useful for accessing and organizing related notes quickly in personal knowledge management systems.

Instructions

Read the contents of multiple note files simultaneously. Specify paths relative to your notes directory (e.g., ['Log/2023-01-01.md', 'Rollups/2023-01-01-rollup.md']). Returns each file's content with its path as a reference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArray of paths to note files, relative to your notes directory

Implementation Reference

  • The core handler function that implements the logic for reading multiple note files. It validates input, reads each file ensuring path security, handles errors per file, and returns formatted content separated by ---.
    export async function handleReadMultipleNotes(notesPath: string, args: ReadMultipleNotesArgs): Promise<ToolCallResult> { try { // Validate paths is provided and is an array if (!args.paths || !Array.isArray(args.paths)) { throw new Error("'paths' parameter is required and must be an array"); } // Process each file path const results = await Promise.all( args.paths.map(async (notePath) => { try { const filePath = path.join(notesPath, notePath); // Ensure the path is within allowed directory if (!filePath.startsWith(notesPath)) { return `${notePath}: Error - Access denied - path outside notes directory`; } try { const content = await fs.readFile(filePath, 'utf-8'); return `${notePath}:\n${content}\n`; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return `${notePath}: Error - ${errorMessage}`; } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return `${notePath}: Error - ${errorMessage}`; } }) ); return { content: [{ type: "text", text: results.join("\n---\n") }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error reading notes: ${errorMessage}` }], isError: true }; } }
  • Type definition for the input arguments of the read_multiple_notes tool.
    interface ReadMultipleNotesArgs { paths: string[]; }
  • Tool schema definition including name, description, and input schema for validation.
    { name: "read_multiple_notes", description: "Read the contents of multiple note files simultaneously. " + "Specify paths relative to your notes directory (e.g., ['Log/2023-01-01.md', 'Rollups/2023-01-01-rollup.md']). " + "Returns each file's content with its path as a reference.", inputSchema: { type: "object", properties: { paths: { type: "array", items: { type: "string" }, description: "Array of paths to note files, relative to your notes directory" } }, required: ["paths"] }, },
  • Registration of the tool in the main dispatch switch statement within handleToolCall function.
    case "read_multiple_notes": return await handleReadMultipleNotes(notesPath, args);
  • Import of the handler function from filesystem.js for use in index.ts.
    handleReadMultipleNotes,

Other Tools

Related 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/mikeysrecipes/mcp-notes'

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