Skip to main content
Glama

read_note

Read a markdown note by providing its relative path. Returns file location, YAML frontmatter, and content.

Instructions

Returns { root, path, frontmatter, content }. Pass a relative path. Use list_directory first if unsure of the path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for the read_note tool. Uses file.readNote() to parse a markdown note, returning root, path, frontmatter, and content. Handles errors with helpful messages.
    function makeReadNoteTool(container: ServiceContainer): ToolHandler {
      return {
        name: "read_note",
        description: "Returns `{ root, path, frontmatter, content }`. Pass a relative path. Use `list_directory` first if unsure of the path.",
        inputSchema: ReadNoteSchema,
        async handler(args): Promise<ToolResponse> {
          const services = requireServices(container);
          const { path } = ReadNoteSchema.parse(args);
          log.info({ path }, "read_note called");
          try {
            const note = await services.file.readNote(path);
            log.info({ path }, "read_note complete");
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify({
                    root: getRoot(container),
                    path: note.path,
                    frontmatter: note.frontmatter,
                    content: note.content,
                  }),
                },
              ],
            };
          } catch (err) {
            log.error({ err, path }, "read_note failed");
            return {
              content: [{ type: "text", text: JSON.stringify({
                root: getRoot(container),
                error: err instanceof Error ? err.message : String(err),
                possibleSolutions: ["Check the path with list_directory", "Verify the file exists with list_directory", "Ensure the path is root-relative (not absolute)"],
              }) }],
              isError: true,
            };
          }
        },
      };
    }
  • Zod input schema for read_note tool. Defines a single 'path' field (string, min 1 char) as required input.
    const ReadNoteSchema = z.object({
      path: z.string().min(1, "path is required"),
    });
  • Registration function that registers read_note (along with other note tools) into the tool registry map.
    export function registerNoteTools(
      registry: Map<string, ToolHandler>,
      container: ServiceContainer,
    ): void {
      const tools = [
        makeReadNoteTool(container),
        makeWriteNoteTool(container),
        makePatchNoteTool(container),
        makeDeleteNoteTool(container),
        makeMoveNoteTool(container),
        makeReadMultipleNotesTool(container),
      ];
    
      for (const tool of tools) {
        registry.set(tool.name, tool);
      }
    }
  • Top-level registration that calls registerNoteTools to add read_note to the global registry.
    export function registerTools(
      registry: Map<string, ToolHandler>,
      container: ServiceContainer,
      rebuildServices: RebuildServices,
      options: RegisterToolsOptions = {},
    ): void {
      registerNoteTools(registry, container);
      registerDirectoryTools(registry, container, rebuildServices);
      registerFrontmatterTools(registry, container);
      registerSearchTools(registry, container);
      registerSchemaTools(registry, container);
      registerCreateNoteTool(registry, container);
      registerLinkTools(registry, container);
    
      if (options.lite) {
        for (const name of registry.keys()) {
          if (!LITE_TOOL_NAMES.has(name)) registry.delete(name);
        }
      }
    }
  • The underlying FileService.readNote() implementation that reads the file from disk, parses frontmatter using gray-matter, and returns a ParsedNote object.
    async readNote(relativePath: string): Promise<ParsedNote> {
      const fullPath = this.resolvePath(relativePath);
      log.info({ path: relativePath }, "readNote");
    
      const raw = await fs.readFile(fullPath, "utf-8");
      const parsed = matter(raw);
    
      return {
        path: relativePath,
        frontmatter: parsed.data as Record<string, unknown>,
        content: parsed.content,
        raw,
      };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but the description fully covers the read operation's behavior: it returns a structured object and no side effects are implied. Could be more explicit about error handling, but for a read tool this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with return value and path requirement, no extraneous information. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read tool with one parameter and no output schema, the description is complete: it tells what is returned, how to pass the path, and what to do if unsure. Could mention path separator expectations, but not necessary.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the description adds meaning beyond the schema by specifying 'relative path', which clarifies the expected format.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool returns { root, path, frontmatter, content } and accepts a relative path. It distinguishes from sibling tools like list_directory by advising to use it first if unsure.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear usage: 'Pass a relative path. Use list_directory first if unsure of the path.' This gives both when-to-use and when-not-to-use with an explicit alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Erodenn/markscribe'

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