Skip to main content
Glama

bear_list_notes

Read-onlyIdempotent

List Bear notes, optionally filtered by tag, returning ID, title, tags (hierarchical and leaf), pin status, and modification date.

Instructions

List Bear notes with optional tag filtering. Returns an array of notes with IDs, titles, tags, pin status, and modification dates. Each note includes two tag fields: 'tags' mirrors Bear's CloudKit index verbatim (includes ancestor expansions — a note tagged #parent/child will show both 'parent' and 'parent/child'); 'attached_tags' shows only leaf tags (the most-specific tag on each branch). Notes with 'locked: true' are private/encrypted in Bear and their body content is not searchable — if a search returns no results, check whether the relevant note is locked. Use bear_get_note to read the full content of a specific note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagNoFilter notes by tag (partial match)
include_archivedNoInclude archived notes in results
include_trashedNoInclude trashed notes in results
limitNoMaximum number of notes to return (default 30)

Implementation Reference

  • The 'bear_list_notes' tool handler entry in the tools registry. Contains the Tool definition (name, description, inputSchema, annotations), and the buildArgs function that converts user input into CLI arguments for the bcli 'ls --json' command. The key execution path: index.ts calls handler.buildArgs(params) then execBcliWithReauth(args).
    export const tools: Record<string, ToolHandler> = {
      bear_list_notes: {
        tool: {
          name: "bear_list_notes",
          description:
            "List Bear notes with optional tag filtering. Returns an array of notes with IDs, titles, tags, pin status, and modification dates. Each note includes two tag fields: 'tags' mirrors Bear's CloudKit index verbatim (includes ancestor expansions — a note tagged #parent/child will show both 'parent' and 'parent/child'); 'attached_tags' shows only leaf tags (the most-specific tag on each branch). Notes with 'locked: true' are private/encrypted in Bear and their body content is not searchable — if a search returns no results, check whether the relevant note is locked. Use bear_get_note to read the full content of a specific note.",
          inputSchema: {
            type: "object" as const,
            properties: {
              tag: {
                type: "string",
                description: "Filter notes by tag (partial match)",
              },
              include_archived: {
                type: "boolean",
                description: "Include archived notes in results",
              },
              include_trashed: {
                type: "boolean",
                description: "Include trashed notes in results",
              },
              limit: {
                type: "number",
                description:
                  "Maximum number of notes to return (default 30)",
              },
            },
          },
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
          },
        },
        buildArgs: (input) => {
          const args = ["ls", "--json"];
          if (input.tag) args.push("--tag", String(input.tag));
          if (input.include_archived) args.push("--archived");
          if (input.include_trashed) args.push("--trashed");
          if (input.limit) args.push("--limit", String(input.limit));
          return args;
        },
      },
  • Tool registration via the ListToolsRequestSchema handler. The tools from tools.ts are listed by mapping over Object.values(tools) and exposing their .tool property to the MCP client. This makes bear_list_notes discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: Object.values(tools).map((t) => t.tool),
    }));
  • Tool execution dispatcher (CallToolRequestSchema handler). When 'bear_list_notes' is called, it's looked up by name, buildArgs constructs the CLI args, then execBcliWithReauth executes the bcli binary. The JSON output is parsed and returned.
    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,
        };
      }
    });
  • Input schema for bear_list_notes: accepts optional 'tag' (string), 'include_archived' (boolean), 'include_trashed' (boolean), and 'limit' (number) parameters.
    inputSchema: {
      type: "object" as const,
      properties: {
        tag: {
          type: "string",
          description: "Filter notes by tag (partial match)",
        },
        include_archived: {
          type: "boolean",
          description: "Include archived notes in results",
        },
        include_trashed: {
          type: "boolean",
          description: "Include trashed notes in results",
        },
        limit: {
          type: "number",
          description:
            "Maximum number of notes to return (default 30)",
        },
      },
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.19

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, and idempotentHint=true. The description adds valuable behavioral context beyond annotations, such as the behavior of locked notes ('Notes with locked: true are private/encrypted... not searchable') and the distinction between 'tags' and 'attached_tags' fields. No contradiction with 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?

The description is 4 sentences, front-loading the main purpose. Every sentence adds value (main purpose, tag field detail, locked note caveat, reference to bear_get_note). It is concise but not overly short; the detail on tag fields is necessary for correct usage. It could be slightly tighter, but overall efficient.

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?

Despite no output schema, the description fully explains the return structure ('array of notes with IDs, titles, tags, pin status, modification dates'), the two tag fields, and the locked note behavior. It also mentions the limit parameter implicitly. This is complete for a list tool, covering edge cases and providing sufficient context for correct invocation.

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%, so the baseline is 3. The description adds meaning beyond the schema by explaining the two tag fields in the output and the locked note limitation, which are not covered by parameter descriptions. This extra semantic context justifies a score of 4.

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 the tool's purpose: 'List Bear notes with optional tag filtering.' It specifies the verb (list) and resource (notes), and distinguishes from sibling tools like bear_get_note and bear_search by referencing them in the usage guidance.

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 guidance on when to use bear_list_notes versus alternatives: 'Use bear_get_note to read the full content of a specific note.' It also explains the tag fields and locked notes behavior, helping the agent decide when to use this tool. However, it could explicitly state when not to use it (e.g., for full-text search), but overall it's clear.

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