Skip to main content
Glama

blackboard_query

Query beliefs stored in a shared blackboard using regex patterns on keys or string values, optionally filtered by tag.

Instructions

Query beliefs by regex pattern (over key or string value) and/or tag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNo
tagNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The FastMCP tool handler for blackboard_query. Registered via @mcp.tool() decorator. Delegates to Blackboard.query() and returns results as dicts.
    @mcp.tool()
    def blackboard_query(
        pattern: str | None = None, tag: str | None = None
    ) -> list[dict[str, Any]]:
        """Query beliefs by regex pattern (over key or string value) and/or tag."""
        return [b.to_dict() for b in _BLACKBOARD.query(pattern, tag=tag)]
  • Input schema: pattern (optional str regex) and tag (optional str). Output: list of dicts with belief fields.
    @mcp.tool()
    def blackboard_query(
        pattern: str | None = None, tag: str | None = None
    ) -> list[dict[str, Any]]:
        """Query beliefs by regex pattern (over key or string value) and/or tag."""
        return [b.to_dict() for b in _BLACKBOARD.query(pattern, tag=tag)]
  • Tool registered with the FastMCP server via the @mcp.tool() decorator on line 63.
    @mcp.tool()
  • Blackboard.query() method: the core logic that filters beliefs by regex pattern (matching key or string value) and/or tag, skipping expired entries, returning sorted by timestamp.
    def query(
        self, pattern: Optional[str] = None, *, tag: Optional[str] = None
    ) -> list[Belief]:
        with self._lock:
            out: list[Belief] = []
            for b in self._store.values():
                if b.expired():
                    continue
                if pattern:
                    matches_key = re.search(pattern, b.key, re.I)
                    matches_value = (
                        isinstance(b.value, str)
                        and re.search(pattern, b.value, re.I)
                    )
                    if not (matches_key or matches_value):
                        continue
                if tag and tag not in b.tags:
                    continue
                out.append(b)
            return sorted(out, key=lambda x: x.ts)
  • MCPConnector.call() handles 'blackboard.query' tool name routing, used by agent code (e.g., in agents.py).
    if tool == "blackboard.query":
        results = self.blackboard.query(
            kwargs.get("pattern"), tag=kwargs.get("tag")
        )
        return [b.to_dict() for b in results]
    
    raise NotImplementedError(f"Unknown tool: {tool}")
Behavior2/5

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

No annotations are available, so the description completely bears the burden of disclosing behavioral traits. It only states that the tool queries beliefs, implying a read operation, but does not reveal side effects, authentication needs, rate limits, or any constraints like what happens if both pattern and tag are specified. The description is minimal.

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 a single, 14-word sentence. It is extremely concise and front-loads the action ('Query beliefs'). Every word contributes to the purpose. No unnecessary information.

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

Completeness3/5

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

Given the tool's relative simplicity (two optional parameters) and presence of an output schema (which presumably documents return values), the description is moderately complete. However, it fails to address the logical combination of pattern and tag (AND vs OR), which is a contextual gap. The description is adequate but not thorough.

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 schema has 0% description coverage for its two parameters. The description adds some meaning: 'pattern' is a regex applied to key or string value, and 'tag' is a tag to filter by. However, it does not fully clarify the regex format, the meaning of 'key or string value', or the logical relationship between pattern and tag (AND/OR ambiguity). It partially compensates for the missing schema descriptions.

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?

The description clearly states the tool's purpose: query beliefs by regex pattern and/or tag. It specifies the resource (beliefs) and the action (query), and outlines the criteria (regex pattern on key or string value, tag). The tool is distinct from siblings like arithmetic operations and other blackboard actions, though it could explicitly differentiate from blackboard_get/dump.

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?

The description gives no guidance on when to use this tool versus alternatives. For example, it does not explain when to use blackboard_query instead of blackboard_get or blackboard_dump. There are no explicit context cues or exclusions provided.

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/SiegKat/mcp-agent-blackboard'

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