Skip to main content
Glama

read_note

Retrieve the full text content of a note file from your personal notes directory by specifying its relative path. Ideal for accessing organized, searchable knowledge within the MCP Notes system.

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 "read_note" tool is registered here in the handleToolCall switch statement, delegating execution to the handleReadNote function.
    case "read_note":
      return await handleReadNote(notesPath, args);
  • Imports the handleReadNote handler function from './filesystem.js', which contains the exact implementation of the read_note tool logic.
    import {
      ensureDirectory,
      initializeNotesDirectory,
      handleSearchFiles,
      handleReadNote,
      handleReadMultipleNotes,
      handleListDirectory,
      handleCreateDirectory,
      getFilesystemToolDefinitions
    } from './filesystem.js';
  • Imports getFilesystemToolDefinitions from './filesystem.js', which provides the input schema and description for the read_note tool.
    import {
      ensureDirectory,
      initializeNotesDirectory,
      handleSearchFiles,
      handleReadNote,
      handleReadMultipleNotes,
      handleListDirectory,
      handleCreateDirectory,
      getFilesystemToolDefinitions
    } from './filesystem.js';
  • The Note.load() method provides the core file reading and frontmatter parsing logic, likely used within the handleReadNote implementation.
    async load(): Promise<boolean> {
      try {
        const content = await fs.readFile(this.fullPath, 'utf8');
        this.exists = true;
        
        // Parse frontmatter if it exists
        if (content.startsWith('---')) {
          const frontmatterEnd = content.indexOf('---', 3);
          if (frontmatterEnd !== -1) {
            const frontmatter = content.substring(3, frontmatterEnd);
            
            // Extract created date
            const createdMatch = frontmatter.match(/created: (.*)/);
            if (createdMatch) {
              const createdDate = new Date(createdMatch[1]);
              this.dateInfo = this._formatDate(createdDate);
            }
            
            // Extract tags
            const tagMatch = frontmatter.match(/tags:\n(?:  - .*\n)*/);
            if (tagMatch) {
              this.tags = tagMatch[0].split('\n')
                .slice(1) // Skip the "tags:" line
                .map(line => line.replace('  - ', ''))
                .filter(tag => tag); // Remove empty strings
            }
            
            // Store content without frontmatter
            this.content = content.substring(frontmatterEnd + 4);
          } else {
            this.content = content;
          }
        } else {
          this.content = content;
        }
        
        return true;
      } catch (error) {
        if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
          this.exists = false;
          return false;
        }
        throw error;
      }
    }
Install Server

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

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