Skip to main content
Glama

bear_edit_note

Edit existing Bear notes by appending text, replacing body, or modifying YAML front matter fields. Combine front matter edits or use body/append options.

Instructions

Edit an existing Bear note. Provide 'append_text' to add text, 'body' to replace content, or 'set_frontmatter'/'remove_frontmatter' to edit YAML front matter fields. Front matter edits can be combined with each other but not with body/append.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesNote ID (uniqueIdentifier)
append_textNoText to append to the end of the note
bodyNoNew content to replace the entire note body
afterNoInsert appended text after the line containing this text (use with append_text)
replace_sectionNoReplace content under this heading (replaces until next heading of same or higher level)
section_contentNoNew content for the section (use with replace_section)
set_frontmatterNoFront matter fields to set or update (key-value pairs)
remove_frontmatterNoFront matter field keys to remove

Implementation Reference

  • The main handler for bear_edit_note — includes the tool definition (name, description, inputSchema, annotations), the buildArgs function that constructs CLI arguments for the bcli binary (supporting front matter edits, section replacement, append, and full body replacement via stdin), and the usesStdin function that pipes body content through stdin.
    bear_edit_note: {
      tool: {
        name: "bear_edit_note",
        description:
          "Edit an existing Bear note. Provide 'append_text' to add text, 'body' to replace content, or 'set_frontmatter'/'remove_frontmatter' to edit YAML front matter fields. Front matter edits can be combined with each other but not with body/append.",
        inputSchema: {
          type: "object" as const,
          properties: {
            id: {
              type: "string",
              description: "Note ID (uniqueIdentifier)",
            },
            append_text: {
              type: "string",
              description: "Text to append to the end of the note",
            },
            body: {
              type: "string",
              description:
                "New content to replace the entire note body",
            },
            after: {
              type: "string",
              description:
                "Insert appended text after the line containing this text (use with append_text)",
            },
            replace_section: {
              type: "string",
              description:
                "Replace content under this heading (replaces until next heading of same or higher level)",
            },
            section_content: {
              type: "string",
              description:
                "New content for the section (use with replace_section)",
            },
            set_frontmatter: {
              type: "object",
              description:
                "Front matter fields to set or update (key-value pairs)",
              additionalProperties: { type: "string" },
            },
            remove_frontmatter: {
              type: "array",
              items: { type: "string" },
              description: "Front matter field keys to remove",
            },
          },
          required: ["id"],
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: false,
        },
      },
      buildArgs: (input) => {
        // Front matter editing mode
        const hasFm =
          (input.set_frontmatter &&
            Object.keys(input.set_frontmatter as object).length > 0) ||
          (Array.isArray(input.remove_frontmatter) &&
            input.remove_frontmatter.length > 0);
    
        if (hasFm && !input.append_text && !input.body) {
          const args = ["edit", String(input.id), "--json"];
          if (input.set_frontmatter && typeof input.set_frontmatter === "object") {
            const fm = input.set_frontmatter as Record<string, string>;
            args.push(
              "--set-fm",
              ...Object.entries(fm).map(([k, v]) => `${k}=${v}`),
            );
          }
          if (Array.isArray(input.remove_frontmatter)) {
            args.push(
              "--remove-fm",
              ...input.remove_frontmatter.map(String),
            );
          }
          return args;
        }
    
        // Section replacement mode
        if (input.replace_section) {
          const args = ["edit", String(input.id), "--replace-section", String(input.replace_section), "--json"];
          if (input.section_content) args.push("--section-content", String(input.section_content));
          return args;
        }
    
        if (input.append_text) {
          const args = [
            "edit",
            String(input.id),
            "--append",
            String(input.append_text),
            "--json",
          ];
          if (input.after) args.push("--after", String(input.after));
          return args;
        }
        // --stdin case handled separately via usesStdin
        return ["edit", String(input.id), "--stdin", "--json"];
      },
      usesStdin: (input) => {
        if (input.body && !input.append_text) {
          return String(input.body);
        }
        return null;
      },
    },
  • Input schema for bear_edit_note: requires 'id' (string), with optional fields append_text, body, after, replace_section, section_content, set_frontmatter (object), remove_frontmatter (array of strings).
    inputSchema: {
      type: "object" as const,
      properties: {
        id: {
          type: "string",
          description: "Note ID (uniqueIdentifier)",
        },
        append_text: {
          type: "string",
          description: "Text to append to the end of the note",
        },
        body: {
          type: "string",
          description:
            "New content to replace the entire note body",
        },
        after: {
          type: "string",
          description:
            "Insert appended text after the line containing this text (use with append_text)",
        },
        replace_section: {
          type: "string",
          description:
            "Replace content under this heading (replaces until next heading of same or higher level)",
        },
        section_content: {
          type: "string",
          description:
            "New content for the section (use with replace_section)",
        },
        set_frontmatter: {
          type: "object",
          description:
            "Front matter fields to set or update (key-value pairs)",
          additionalProperties: { type: "string" },
        },
        remove_frontmatter: {
          type: "array",
          items: { type: "string" },
          description: "Front matter field keys to remove",
        },
      },
      required: ["id"],
    },
  • The tool is registered as part of the exported 'tools' Record on line 9, with the key 'bear_edit_note' at line 200.
    export const tools: Record<string, ToolHandler> = {
  • Validation logic in the server's CallToolRequestSchema handler — checks that at least one edit operation is provided and that append_text and body are not both supplied for bear_edit_note.
    // Validate bear_edit_note: need at least one edit operation
    if (name === "bear_edit_note") {
      const hasAppend = params.append_text !== undefined;
      const hasBody = params.body !== undefined;
      const hasSetFm = params.set_frontmatter !== undefined &&
        Object.keys(params.set_frontmatter as object).length > 0;
      const hasRemoveFm = Array.isArray(params.remove_frontmatter) &&
        (params.remove_frontmatter as unknown[]).length > 0;
      const hasFm = hasSetFm || hasRemoveFm;
    
      if (!hasAppend && !hasBody && !hasFm) {
        return {
          content: [
            {
              type: "text",
              text: "Provide 'append_text', 'body', 'set_frontmatter', or 'remove_frontmatter'.",
            },
          ],
          isError: true,
        };
      }
      if (hasAppend && hasBody) {
        return {
          content: [
            {
              type: "text",
              text: "Provide either 'append_text' or 'body', not both.",
            },
          ],
          isError: true,
        };
      }
    }
Behavior3/5

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

Annotations are sparse (readOnlyHint=false, destructiveHint=false). Description adds constraint on combining edits but doesn't disclose other behaviors like side effects or response format. Adequate but not extensive.

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 concise sentences. First sentence sets purpose, second elaborates on parameters and constraints. No redundant words.

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?

Covers key use cases and limitations for an edit tool with 8 parameters and no output schema. Missing details on error handling or return behavior, but acceptable given complexity.

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 coverage is 100%, but description adds value by explaining parameter relationships and combination rules (e.g., 'after' with append_text, front matter edits exclusive of body/append).

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?

Description clearly states 'Edit an existing Bear note' with specific actions (append, replace, front matter edits). Differentiates from sibling tools like bear_create_note and bear_trash_note.

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

Usage Guidelines4/5

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

Provides explicit instructions on when to use each parameter and notes incompatibility between front matter edits and body/append. Lacks explicit contrast with alternatives but is contextually clear.

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/mreider/better-bear'

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