Skip to main content
Glama

bear_create_note

Creates a Bear note with title, markdown body, tags, and YAML front matter. Hashtags written inline are automatically registered as real tags. Returns the note ID.

Instructions

Create a new Bear note with a title, optional body text, tags, and YAML front matter. Hashtags written inline in the body (e.g. '#my_tag' or '#parent/child') are extracted and registered as real tags on the note, matching Bear's desktop-app behaviour. Tags from the 'tags' array are indexed regardless of whether they appear in the body. Hierarchical tags like '#parent/child' also index every ancestor (so they show up under #parent in Bear's sidebar). Front matter is stored as a collapsed metadata block at the top of the note. Returns the new note's ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesNote title
bodyNoNote body text (markdown)
tagsNoTags to assign to the note
frontmatterNoYAML front matter fields as key-value pairs (e.g. {status: 'draft', project: 'alpha'})

Implementation Reference

  • Registration: All tools (including bear_create_note) are registered via ListToolsRequestSchema handler, which maps over `tools` object values and exposes their .tool definitions.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: Object.values(tools).map((t) => t.tool),
    }));
  • Handler & Schema: The complete definition of bear_create_note. Contains both the tool schema (name, description, inputSchema with title/body/tags/frontmatter properties, and annotations) and the buildArgs function that constructs the bcli command-line arguments.
    bear_create_note: {
      tool: {
        name: "bear_create_note",
        description:
          "Create a new Bear note with a title, optional body text, tags, and YAML front matter. Hashtags written inline in the body (e.g. '#my_tag' or '#parent/child') are extracted and registered as real tags on the note, matching Bear's desktop-app behaviour. Tags from the 'tags' array are indexed regardless of whether they appear in the body. Hierarchical tags like '#parent/child' also index every ancestor (so they show up under #parent in Bear's sidebar). Front matter is stored as a collapsed metadata block at the top of the note. Returns the new note's ID.",
        inputSchema: {
          type: "object" as const,
          properties: {
            title: {
              type: "string",
              description: "Note title",
            },
            body: {
              type: "string",
              description: "Note body text (markdown)",
            },
            tags: {
              type: "array",
              items: { type: "string" },
              description: "Tags to assign to the note",
            },
            frontmatter: {
              type: "object",
              description:
                "YAML front matter fields as key-value pairs (e.g. {status: 'draft', project: 'alpha'})",
              additionalProperties: { type: "string" },
            },
          },
          required: ["title"],
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: false,
        },
      },
      buildArgs: (input) => {
        const args = ["create", String(input.title), "--json"];
        if (input.body) args.push("--body", String(input.body));
        if (Array.isArray(input.tags) && input.tags.length > 0) {
          args.push("--tags", input.tags.join(","));
        }
        if (input.frontmatter && typeof input.frontmatter === "object") {
          const fm = input.frontmatter as Record<string, string>;
          args.push(
            "--fm",
            ...Object.entries(fm).map(([k, v]) => `${k}=${v}`),
          );
        }
        return args;
      },
  • Type definition for ToolHandler interface that bear_create_note implements.
    export interface ToolHandler {
      tool: Tool;
      buildArgs: (input: Record<string, unknown>) => string[];
      usesStdin?: (input: Record<string, unknown>) => string | null;
    }
  • Dispatch: The CallToolRequestSchema handler looks up the tool by name in the `tools` map (which contains bear_create_note), calls buildArgs to get CLI args, then executes bcli via execBcliWithReauth.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: input } = request.params;
      const handler = tools[name];
    
      if (!handler) {
        return {
          content: [{ type: "text", text: `Unknown tool: ${name}` }],
          isError: true,
        };
      }
    
      const params = (input ?? {}) as Record<string, unknown>;
    
      // 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,
          };
        }
      }
    
      try {
        const args = handler.buildArgs(params);
        let result: { stdout: string; stderr: string };
    
        // Check if this tool needs stdin piping
        const stdinData = handler.usesStdin?.(params) ?? null;
        if (stdinData !== null) {
          result = await execBcliWithStdinAndReauth(args, stdinData);
        } else {
          result = await execBcliWithReauth(args);
        }
    
        // Parse JSON output from bcli
        const stdout = result.stdout.trim();
        if (!stdout) {
          return {
            content: [{ type: "text", text: "Command completed successfully." }],
          };
        }
    
        // Validate it's JSON and pretty-print
        try {
          const parsed = JSON.parse(stdout);
          return {
            content: [
              { type: "text", text: JSON.stringify(parsed, null, 2) },
            ],
          };
        } catch {
          // If bcli returned non-JSON, pass it through
          return {
            content: [{ type: "text", text: stdout }],
          };
        }
      } catch (error) {
        const message =
          error instanceof BcliError ? error.message : String(error);
        return {
          content: [{ type: "text", text: message }],
          isError: true,
        };
      }
Behavior5/5

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

The description discloses important behavioral traits beyond annotations: inline hashtag extraction, hierarchical tag indexing, front matter as collapsed metadata, and return of note ID. Annotations only provide readOnlyHint, destructiveHint, idempotentHint, which are correctly set, and no contradiction.

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?

The description is concise with no extraneous sentences. Each sentence adds value, and the primary purpose is front-loaded.

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

Completeness5/5

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

Given no output schema, the description specifies the return value (note ID). It covers all key aspects: creation, parameter details, and edge cases like inline tags and front matter, making it complete for an agent.

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 meaning beyond schema: explains inline hashtag behavior, hierarchical indexing, and front matter storage. This enriches understanding of how parameters interact.

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 'Create a new Bear note' with a specific verb and resource, and lists what can be included (title, body, tags, frontmatter). It distinguishes from siblings like bear_edit_note and bear_add_tag by focusing on creation.

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

Usage Guidelines3/5

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

The description implies the tool is for creating notes but does not explicitly state when to use it versus alternative tools like bear_edit_note or bear_add_tag. No exclusions or alternatives are mentioned.

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