Skip to main content
Glama
agentience

Tribal Knowledge Service

by agentience

find_similar_errors

Search the Tribal Knowledge Service for programming errors similar to your query to identify patterns and solutions from past incidents.

Instructions

Find errors similar to the given query.

Args:
    query: Text to search for in the knowledge base
    max_results: Maximum number of results to return

Returns:
    List of similar error records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo

Implementation Reference

  • MCP tool handler for 'find_similar_errors' that delegates to ChromaStorage similarity search.
    @mcp.tool()
    async def find_similar_errors(query: str, max_results: int = 5) -> List[Dict]:
        """
        Find errors similar to the given query.
    
        Args:
            query: Text to search for in the knowledge base
            max_results: Maximum number of results to return
    
        Returns:
            List of similar error records
        """
        records = await storage.search_similar(query, max_results)
        return [json.loads(record.model_dump_json()) for record in records]
  • Core implementation of similarity search using ChromaDB's vector query on error record documents.
    async def search_similar(
        self, text_query: str, max_results: int = 5
    ) -> List[ErrorRecord]:
        """Search for error records with similar text content."""
        results = self.collection.query(
            query_texts=[text_query],
            n_results=max_results,
            include=["documents", "distances"],
        )
    
        # Convert results to ErrorRecord objects
        error_records = []
        if results.get("documents") and results["documents"][0]:
            for doc_str in results["documents"][0]:
                document = json.loads(doc_str)
                error_records.append(self._document_to_error(document))
    
        return error_records
  • Alternative MCP tool handler that proxies requests to the Tribal API endpoint.
    @mcp.tool()
    async def find_similar_errors(query: str, max_results: int = 5) -> List[Dict]:
        """
        Find errors similar to the given query.
    
        Args:
            query: Text to search for in the knowledge base
            max_results: Maximum number of results to return
    
        Returns:
            List of similar error records
        """
        params = {"query": query, "max_results": max_results}
        return await make_api_request("GET", "/api/v1/errors/similar/", params=params)

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