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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| max_results | No |
Implementation Reference
- src/mcp_server_tribal/mcp_app.py:148-162 (handler)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)