Skip to main content
Glama

bear_edit_note

Edit a Bear note by appending text, replacing its body, or updating its YAML front matter fields.

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 buildArgs function for bear_edit_note: translates tool input parameters into bcli command-line arguments. Supports four editing modes: front matter edits (--set-fm/--remove-fm), section replacement (--replace-section), text appending (--append), and body replacement (--stdin).
    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;
    },
  • The usesStdin function for bear_edit_note: when 'body' is provided (not append_text), it returns the body content to be piped via stdin to the bcli process for a full body replacement. Otherwise returns null (no stdin needed).
    usesStdin: (input) => {
      if (input.body && !input.append_text) {
        return String(input.body);
      }
      return null;
    },
  • The inputSchema for bear_edit_note: defines the JSON schema with required 'id' (string) and optional parameters including append_text, body, after, replace_section, section_content, set_frontmatter (object), and 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 full tool definition and registration for bear_edit_note in the tools registry. It is a key in the exported 'tools' Record with the name 'bear_edit_note' and its tool metadata includes name, description, inputSchema, and annotations.
    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;
      },
    },
  • Direct validation logic for bear_edit_note in the MCP server request handler: ensures at least one edit operation is provided (append_text, body, set_frontmatter, or remove_frontmatter) and that append_text and body are not both specified. Returns error messages for invalid combinations.
    // 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 indicate readOnlyHint=false, destructiveHint=false, idempotentHint=false. The description confirms mutation but adds no details on permanence, undo, or error conditions. The 'replace content' behavior could be destructive, but the description doesn't clarify.

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 core purpose, second sentence adds critical constraints. No redundant or unnecessary text.

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?

Given the complexity (8 parameters, nested objects) and no output schema, the description covers the main operations and constraints. It lacks details on response format or error handling but is sufficient for common use cases.

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 the description adds value by explaining parameter roles (e.g., 'append_text to add text', 'body to replace content') and constraints (front matter edits can be combined but not with body/append). This goes beyond the schema's own descriptions.

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 clearly states it edits an existing Bear note and lists specific operations (append_text, body, set_frontmatter, remove_frontmatter). It distinguishes from siblings like bear_create_note (create) and bear_get_note (read) by focusing on modification.

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?

The description provides clear guidance on when to use each operation and explicitly notes that front matter edits can be combined but not with body/append. However, it does not mention when to avoid this tool or suggest alternative tools for specific scenarios.

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

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