Skip to main content
Glama

read_note

Retrieve the full text content of a note file from your personal knowledge management system by specifying its relative path.

Instructions

Read the complete contents of a note file from your notes directory. Specify the path relative to your notes directory (e.g., 'Log/2023-01-01.md'). Returns the full text content of the note file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe path to the note file, relative to your notes directory

Implementation Reference

  • The handler function that executes the read_note tool logic: validates args, constructs file path, reads file content, handles errors.
    export async function handleReadNote(notesPath: string, args: ReadNoteArgs): Promise<ToolCallResult> {
      try {
        // Validate path is provided
        if (!args.path) {
          throw new Error("'path' parameter is required");
        }
        
        const filePath = path.join(notesPath, args.path);
        
        // Ensure the path is within allowed directory
        if (!filePath.startsWith(notesPath)) {
          throw new Error("Access denied - path outside notes directory");
        }
        
        try {
          const content = await fs.readFile(filePath, 'utf-8');
          
          return {
            content: [{ type: "text", text: content }]
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          throw new Error(`Error reading file: ${errorMessage}`);
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [{ type: "text", text: `Error reading note: ${errorMessage}` }],
          isError: true
        };
      }
  • Tool definition including name, description, and input schema for read_note
    {
      name: "read_note",
      description: "Read the complete contents of a note file from your notes directory. " +
        "Specify the path relative to your notes directory (e.g., 'Log/2023-01-01.md'). " +
        "Returns the full text content of the note file.",
      inputSchema: {
        type: "object",
        properties: {
          path: { 
            type: "string",
            description: "The path to the note file, relative to your notes directory" 
          }
        },
        required: ["path"]
      },
  • Type definition for the input arguments of read_note
    interface ReadNoteArgs {
      path: string;
    }
  • Dispatch/registration of read_note handler in the main tool call switch statement
    case "read_note":
      return await handleReadNote(notesPath, args);
  • Import of handleReadNote and tool definitions from filesystem module
      ensureDirectory,
      initializeNotesDirectory,
      handleSearchFiles,
      handleReadNote,
      handleReadMultipleNotes,
      handleListDirectory,
      handleCreateDirectory,
      getFilesystemToolDefinitions
    } from './filesystem.js';

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