Skip to main content
Glama

bear_get_note

Read-onlyIdempotent

Retrieve a Bear note's full content and metadata by its ID, including title, tags, and markdown. Optionally return only raw markdown content.

Instructions

Get a single Bear note's full content and metadata by ID. Returns the note title, tags, full markdown text, and dates. The response includes 'tags' (CloudKit index, may contain ancestor tags like 'parent' for a note tagged '#parent/child') and 'attached_tags' (leaves only). If the note is locked/private, 'locked: true' will be included in the response. Use the 'raw' option to get just the markdown without metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesNote ID (uniqueIdentifier)
rawNoReturn only the raw markdown content

Implementation Reference

  • Registration of the bear_get_note tool in the tools registry. Defines the tool name, description, input schema (id required, raw optional), annotations, and the buildArgs function that constructs the CLI arguments: ['get', id, '--json'] with optional '--raw' flag.
    bear_get_note: {
      tool: {
        name: "bear_get_note",
        description:
          "Get a single Bear note's full content and metadata by ID. Returns the note title, tags, full markdown text, and dates. The response includes 'tags' (CloudKit index, may contain ancestor tags like 'parent' for a note tagged '#parent/child') and 'attached_tags' (leaves only). If the note is locked/private, 'locked: true' will be included in the response. Use the 'raw' option to get just the markdown without metadata.",
        inputSchema: {
          type: "object" as const,
          properties: {
            id: {
              type: "string",
              description: "Note ID (uniqueIdentifier)",
            },
            raw: {
              type: "boolean",
              description: "Return only the raw markdown content",
            },
          },
          required: ["id"],
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
        },
      },
      buildArgs: (input) => {
        const args = ["get", String(input.id), "--json"];
        if (input.raw) args.push("--raw");
        return args;
      },
    },
  • The CallToolRequestSchema handler that dispatches tool calls. For bear_get_note, it calls handler.buildArgs(params) to produce CLI args, then executes them via execBcliWithReauth() (no stdin), parses JSON output, and returns it as the tool result.
    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);
        }
  • execBcliWithReauth - the execution helper that runs the bcli CLI command (e.g., 'bcli get <id> --json') and handles automatic re-authentication if the session has expired.
    export async function execBcliWithReauth(
      args: string[],
    ): Promise<{ stdout: string; stderr: string }> {
      try {
        return await execBcli(args);
      } catch (error) {
        if (error instanceof AuthError) {
          await performReauth();
          return await execBcli(args);
        }
        throw error;
      }
    }
  • execBcli - the base execution helper that spawns the bcli binary with given args via execFile, supporting the bear_get_note tool which uses non-stdin command execution.
    export function execBcli(
      args: string[],
    ): Promise<{ stdout: string; stderr: string }> {
      return new Promise(async (resolve, reject) => {
        const bcliPath = await findBcli();
        execFile(
          bcliPath,
          args,
          { timeout: TIMEOUT_MS, maxBuffer: MAX_BUFFER },
          (error, stdout, stderr) => {
            if (error) {
              reject(classifyError(stderr || error.message, error.code ? null : 1));
            } else {
              resolve({ stdout, stderr });
            }
          },
        );
      });
    }
  • Input schema for bear_get_note: requires 'id' (string), optional 'raw' (boolean). Defines the validation contract for the tool.
    inputSchema: {
      type: "object" as const,
      properties: {
        id: {
          type: "string",
          description: "Note ID (uniqueIdentifier)",
        },
        raw: {
          type: "boolean",
          description: "Return only the raw markdown content",
        },
      },
      required: ["id"],
    },
Behavior5/5

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

Annotations already indicate read-only, idempotent, non-destructive. Description adds critical details about locked notes behavior, tag vs attached_tags distinction, and raw option, going beyond annotations.

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

Conciseness4/5

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

Four sentences, front-loaded with main action, no redundant information. Could be slightly more concise but very clear.

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 tool's simplicity (2 params, no output schema), the description adequately explains return contents and options. Could mention response structure more explicitly, but sufficient.

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

Parameters3/5

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

Input schema covers both parameters with 100% description coverage. Description adds minimal extra meaning: clarifies raw option returns markdown without metadata, but schema already states that. Baseline of 3 is appropriate.

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

Purpose4/5

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

Clearly states it retrieves a single note's full content and metadata by ID, listing specific fields returned. Does not explicitly differentiate from sibling tools like search or list_notes, but the purpose is specific enough.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like bear_search or bear_list_notes. No exclusions or prerequisites 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