Skip to main content
Glama
agentience

Tribal Knowledge Service

by agentience

search_errors

Find programming error solutions by searching a knowledge base with filters for error type, language, framework, message, code snippet, or task description.

Instructions

Search for errors in the knowledge base.

Args:
    error_type: Type of error to filter by
    language: Programming language to filter by
    framework: Framework to filter by
    error_message: Error message to search for
    code_snippet: Code snippet to search for
    task_description: Task description to search for
    max_results: Maximum number of results to return

Returns:
    List of matching error records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
error_typeNo
languageNo
frameworkNo
error_messageNo
code_snippetNo
task_descriptionNo
max_resultsNo

Implementation Reference

  • Primary MCP tool handler for 'search_errors'. Constructs ErrorQuery from parameters and delegates to storage layer to retrieve matching error records.
    @mcp.tool()
    async def search_errors(
        error_type: Optional[str] = None,
        language: Optional[str] = None,
        framework: Optional[str] = None,
        error_message: Optional[str] = None,
        code_snippet: Optional[str] = None,
        task_description: Optional[str] = None,
        max_results: int = 5,
    ) -> List[Dict]:
        """
        Search for errors in the knowledge base.
    
        Args:
            error_type: Type of error to filter by
            language: Programming language to filter by
            framework: Framework to filter by
            error_message: Error message to search for
            code_snippet: Code snippet to search for
            task_description: Task description to search for
            max_results: Maximum number of results to return
    
        Returns:
            List of matching error records
        """
        query = ErrorQuery(
            error_type=error_type,
            language=language,
            framework=framework,
            error_message=error_message,
            code_snippet=code_snippet,
            task_description=task_description,
            max_results=max_results,
        )
    
        records = await storage.search_errors(query)
        return [json.loads(record.model_dump_json()) for record in records]
  • Pydantic model defining the input schema for search_errors query parameters.
    class ErrorQuery(BaseModel):
        """Query parameters for searching error records."""
    
        error_type: Optional[str] = None
        language: Optional[str] = None
        framework: Optional[str] = None
        error_message: Optional[str] = None
        code_snippet: Optional[str] = None
        task_description: Optional[str] = None
        max_results: int = Field(default=5, ge=1, le=50)
  • ChromaDB storage backend implementation of search_errors, performing filtered semantic and metadata-based queries.
    async def search_errors(self, query: ErrorQuery) -> List[ErrorRecord]:
        """Search for error records based on the provided query."""
        # Build metadata filter
        filter_clauses = []
    
        if query.error_type:
            filter_clauses.append({"error_type": query.error_type})
    
        if query.language:
            filter_clauses.append({"language": query.language})
    
        if query.framework:
            filter_clauses.append({"framework": query.framework})
    
        # Combine text for semantic search
        search_text = " ".join(
            [
                query.error_message or "",
                query.code_snippet or "",
                query.task_description or "",
            ]
        ).strip()
    
        # If we have text to search, do a similarity search
        if search_text:
            results = self.collection.query(
                query_texts=[search_text],
                n_results=query.max_results,
                where=filter_clauses if filter_clauses else None,
                include=["documents"],
            )
        else:
            # Otherwise, just get records matching the metadata filters
            results = self.collection.get(
                where=filter_clauses if filter_clauses else None,
                limit=query.max_results,
                include=["documents"],
            )
    
        # Convert results to ErrorRecord objects
        error_records = []
        if results.get("documents"):
            for doc_str in results["documents"][0]:
                document = json.loads(doc_str)
                error_records.append(self._document_to_error(document))
    
        return error_records
  • Pydantic model for ErrorRecord, defining the output schema structure for search results.
    class ErrorRecord(BaseModel):
        """Record of an error with context and solution."""
    
        id: UUID = Field(default_factory=uuid4)
        error_type: str
        context: ErrorContext
        solution: ErrorSolution
        created_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
        updated_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
        metadata: dict = Field(default_factory=dict)
        schema_version: str = Field(default=SCHEMA_VERSION, description="Schema version for data migration")
    
        model_config = {
            "json_schema_extra": {
                "example": {
                    "error_type": "ImportError",
                    "context": {
                        "language": "python",
                        "framework": "fastapi",
                        "error_message": "No module named 'fastapi'",
                        "code_snippet": "from fastapi import FastAPI\napp = FastAPI()",
                        "task_description": "Setting up a FastAPI server",
                    },
                    "solution": {
                        "description": "Install FastAPI package",
                        "code_fix": "pip install fastapi",
                        "explanation": "The fastapi package needs to be installed before importing it",
                        "references": ["https://fastapi.tiangolo.com/tutorial/"],
                    },
                }
            }
        }
  • Abstract method in storage interface defining the search_errors contract.
    async def search_errors(self, query: ErrorQuery) -> List[ErrorRecord]:
        """
        Search for error records based on the provided query.
    
        Args:
            query: Search parameters
    
        Returns:
            A list of matching error records
        """
        pass
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches and returns a list, but lacks critical details: whether it's read-only, how results are ordered, if there's pagination, error handling, or performance characteristics. For a search tool with 7 parameters, this leaves significant gaps in understanding its behavior.

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 well-structured with clear sections ('Args:', 'Returns:') and uses bullet points for parameters, making it easy to scan. It's appropriately sized for a tool with 7 parameters, though the parameter explanations are minimal. There's no wasted text, but it could be more front-loaded with key usage information.

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

Completeness2/5

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

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It covers the basic purpose and parameters but lacks behavioral details, usage guidelines, and output specifics. For a search tool in a knowledge base context, this leaves the agent with insufficient information to use it effectively without trial and error.

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 description lists all 7 parameters with brief labels, but schema description coverage is 0%, so the schema provides no additional documentation. The description adds basic semantic context (e.g., 'error_type: Type of error to filter by'), which helps interpret parameters beyond their names. However, it doesn't explain formats, constraints, or interactions between parameters, leaving room for ambiguity.

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: 'Search for errors in the knowledge base.' This specifies the verb ('search') and resource ('errors in the knowledge base'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'find_similar_errors' or 'get_error_by_id', which prevents a perfect score.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'find_similar_errors' or 'get_error_by_id', nor does it specify contexts where this search tool is preferred. The agent must infer usage from the tool name alone, which is insufficient for optimal selection.

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/agentience/tribal_mcp_server'

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