Skip to main content
Glama
agentience

Tribal Knowledge Service

by agentience

track_error

Log programming errors with solutions to build a shared knowledge base for developers.

Instructions

Track an error and its solution in the knowledge base.

Args:
    error_type: Type of error (e.g., ImportError, TypeError)
    error_message: The error message
    language: Programming language (e.g., python, javascript)
    framework: Framework used (e.g., fastapi, react)
    code_snippet: The code that caused the error
    task_description: What the user was trying to accomplish
    solution_description: Brief description of the solution
    solution_code_fix: Code that fixes the error
    solution_explanation: Detailed explanation of why the solution works
    solution_references: List of reference links

Returns:
    The created error record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
error_typeYes
error_messageYes
languageYes
frameworkNo
code_snippetNo
task_descriptionNo
solution_descriptionNo
solution_code_fixNo
solution_explanationNo
solution_referencesNo

Implementation Reference

  • Primary MCP tool handler for track_error: constructs ErrorRecord from parameters and stores it in ChromaDB via storage.add_error.
    @mcp.tool()
    async def track_error(
        error_type: str,
        error_message: str,
        language: str,
        framework: Optional[str] = None,
        code_snippet: Optional[str] = None,
        task_description: Optional[str] = None,
        solution_description: str = "",
        solution_code_fix: Optional[str] = None,
        solution_explanation: str = "",
        solution_references: Optional[List[str]] = None,
    ) -> Dict:
        """
        Track an error and its solution in the knowledge base.
    
        Args:
            error_type: Type of error (e.g., ImportError, TypeError)
            error_message: The error message
            language: Programming language (e.g., python, javascript)
            framework: Framework used (e.g., fastapi, react)
            code_snippet: The code that caused the error
            task_description: What the user was trying to accomplish
            solution_description: Brief description of the solution
            solution_code_fix: Code that fixes the error
            solution_explanation: Detailed explanation of why the solution works
            solution_references: List of reference links
    
        Returns:
            The created error record
        """
        if not solution_references:
            solution_references = []
    
        error_data = ErrorRecord(
            error_type=error_type,
            context={
                "language": language,
                "error_message": error_message,
                "framework": framework,
                "code_snippet": code_snippet,
                "task_description": task_description,
            },
            solution={
                "description": solution_description,
                "code_fix": solution_code_fix,
                "explanation": solution_explanation,
                "references": solution_references,
            },
        )
    
        error_record = await storage.add_error(error_data)
        return json.loads(error_record.model_dump_json())
  • Pydantic model defining the input/output schema and validation for error records used by the track_error tool.
    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/"],
                    },
                }
            }
        }
  • Helper method in ChromaStorage class that persists the ErrorRecord to ChromaDB collection.
    async def add_error(self, error: ErrorRecord) -> ErrorRecord:
        """Add a new error record to storage."""
        document = self._error_to_document(error)
    
        # Store the document and metadata
        self.collection.add(
            ids=[str(error.id)],
            documents=[json.dumps(document)],
            metadatas=[
                {
                    "error_type": error.error_type,
                    "language": error.context.language,
                    "framework": error.context.framework or "",
                }
            ],
            # ChromaDB will auto-generate embeddings from the documents
        )
    
        return error
  • Secondary handler for track_error in proxy MCP server that sends data to the backend API endpoint.
    @mcp.tool()
    async def track_error(
        error_type: str,
        error_message: str,
        language: str,
        framework: Optional[str] = None,
        code_snippet: Optional[str] = None,
        task_description: Optional[str] = None,
        solution_description: str = "",
        solution_code_fix: Optional[str] = None,
        solution_explanation: str = "",
        solution_references: Optional[List[str]] = None,
    ) -> Dict:
        """
        Track an error and its solution in the knowledge base.
    
        Args:
            error_type: Type of error (e.g., ImportError, TypeError)
            error_message: The error message
            language: Programming language (e.g., python, javascript)
            framework: Framework used (e.g., fastapi, react)
            code_snippet: The code that caused the error
            task_description: What the user was trying to accomplish
            solution_description: Brief description of the solution
            solution_code_fix: Code that fixes the error
            solution_explanation: Detailed explanation of why the solution works
            solution_references: List of reference links
    
        Returns:
            The created error record
        """
        if not solution_references:
            solution_references = []
    
        error_data = {
            "error_type": error_type,
            "context": {
                "language": language,
                "error_message": error_message,
                "framework": framework,
                "code_snippet": code_snippet,
                "task_description": task_description,
            },
            "solution": {
                "description": solution_description,
                "code_fix": solution_code_fix,
                "explanation": solution_explanation,
                "references": solution_references,
            },
        }
    
        return await make_api_request("POST", "/api/v1/errors/", data=error_data)
  • Custom execution handler that registers and dispatches the track_error tool among others.
    @mcp.handle_execution
    async def handle_execution(tool_name: str, params: Dict) -> Dict:
        """
        Handle tool execution.
    
        Args:
            tool_name: Name of the tool to execute
            params: Tool parameters
    
        Returns:
            Tool execution result
        """
        logger.info(f"Executing tool: {tool_name} with params: {json.dumps(params)}")
    
        if tool_name == "track_error":
            return await track_error(**params)
        elif tool_name == "find_similar_errors":
            return await find_similar_errors(**params)
        elif tool_name == "search_errors":
            return await search_errors(**params)
        elif tool_name == "get_error_by_id":
            return await get_error_by_id(**params)
        elif tool_name == "get_api_status":
            return await get_api_status()
        else:
            logger.error(f"Unknown tool: {tool_name}")
            raise ValueError(f"Unknown tool: {tool_name}")
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool creates a record ('track an error'), implying a write operation, but doesn't mention permissions needed, whether the operation is idempotent, rate limits, or what happens on failure. The return statement is minimal ('The created error record') without format details.

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 (purpose, args, returns) and uses bullet-like formatting for parameters. Every sentence earns its place by explaining functionality or parameters. It could be slightly more concise in the parameter explanations but remains efficient overall.

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?

For a 10-parameter creation tool with no annotations and no output schema, the description provides good parameter documentation but lacks behavioral context. It explains what data to provide but not how the tool behaves operationally (e.g., error handling, authentication). The return value is mentioned but not described in detail.

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

Parameters5/5

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

With 0% schema description coverage and 10 parameters, the description provides comprehensive parameter semantics beyond the schema. It clearly explains each parameter's purpose with examples (e.g., 'error_type: Type of error (e.g., ImportError, TypeError)'), adding significant value that compensates for the schema's lack of descriptions.

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 with a specific verb ('track') and resource ('error and its solution in the knowledge base'). It distinguishes from sibling tools like 'delete_error', 'find_similar_errors', and 'search_errors' by focusing on creation rather than deletion, retrieval, or search operations.

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 like 'search_errors' or 'find_similar_errors'. It mentions no prerequisites, exclusions, or specific contexts for usage, leaving the agent to infer when this creation tool is appropriate versus other operations.

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