Skip to main content
Glama

bear_context_search

Read-onlyIdempotent

Search across Bear notes, external files, and inbox for full-text matches. Returns snippets with filenames and origin labels for precise file retrieval.

Instructions

Full-text search across the entire context library (Bear notes + external files + inbox). Returns matching snippets with filenames and origin labels. Use when the index alone isn't enough to find the right file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (case-insensitive substring match)
limitNoMaximum results (default: 5)

Implementation Reference

  • The buildArgs function for bear_context_search that constructs the CLI arguments ['context', 'search', query, '--json'] with optional --limit.
    buildArgs: (input) => {
      const args = ["context", "search", String(input.query), "--json"];
      if (input.limit) args.push("--limit", String(input.limit));
      return args;
    },
  • Tool definition for bear_context_search including name, description, inputSchema (query required, limit optional), and annotations (readOnly, non-destructive, idempotent).
    bear_context_search: {
      tool: {
        name: "bear_context_search",
        description:
          "Full-text search across the entire context library (Bear notes + external files + inbox). Returns matching snippets with filenames and origin labels. Use when the index alone isn't enough to find the right file.",
        inputSchema: {
          type: "object" as const,
          properties: {
            query: {
              type: "string",
              description: "Search query (case-insensitive substring match)",
            },
            limit: {
              type: "number",
              description: "Maximum results (default: 5)",
            },
          },
          required: ["query"],
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
        },
      },
  • The tool is registered via ListToolsRequestSchema handler which exposes all tools including bear_context_search from the tools registry.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: Object.values(tools).map((t) => t.tool),
    }));
  • The CallToolRequestSchema handler dispatches to tools[name], which at runtime routes bear_context_search calls to the correct handler.
    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,
        };
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds that search covers multiple sources and returns snippets with filenames and origin labels, which is helpful context 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.

Conciseness5/5

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

Two sentences efficiently cover purpose, scope, output, and usage guidance. Every sentence adds value with no redundancy.

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?

For a search tool with simple parameters and no output schema, the description is adequately complete. It covers sources, output, and use-case context, though it could optionally detail snippet format.

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?

The input schema is fully documented (100% coverage) with descriptions for both parameters ('query' and 'limit'). The description does not add additional meaning beyond what the schema provides.

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 'Full-text search across the entire context library (Bear notes + external files + inbox)' and specifies the output, distinguishing it from related tools like bear_search and bear_context_index.

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?

It advises 'Use when the index alone isn't enough to find the right file,' giving a clear condition for use. Though it doesn't explicitly mention when not to use, it effectively guides selection among siblings.

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