Skip to main content
Glama

get_learned_preferences

Retrieve automatically learned user preferences with confidence scores from AI correction patterns, enabling personalized configuration updates.

Instructions

Get all learned preferences with confidence scores (automatically learned from corrections)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter by category (optional)
min_confidenceNoMinimum confidence threshold

Implementation Reference

  • MCP tool registration including name, description, and input schema for get_learned_preferences.
    Tool( name="get_learned_preferences", description="Get all learned preferences with confidence scores (automatically learned from corrections)", inputSchema={ "type": "object", "properties": { "category": {"type": "string", "description": "Filter by category (optional)"}, "min_confidence": {"type": "number", "description": "Minimum confidence threshold", "default": 0.7}, }, }, ), Tool(
  • Main handler function for the get_learned_preferences tool, delegates to PatternExtractor and formats response.
    async def _get_learned_preferences( self, category: Optional[str] = None, min_confidence: float = 0.7 ) -> Dict[str, Any]: """Get learned preferences with confidence scores""" try: preferences = self.pattern_extractor.get_learned_preferences( category=category, min_confidence=min_confidence ) return { "success": True, "preferences": preferences, "count": len(preferences), "category": category or "all" } except Exception as e: return {"success": False, "error": str(e)}
  • Core helper function that queries the tool_preferences SQLite table to retrieve learned preferences filtered by category and confidence.
    def get_learned_preferences( self, category: Optional[str] = None, min_confidence: float = 0.7 ) -> List[Dict[str, Any]]: """Get all learned preferences, optionally filtered""" with sqlite3.connect(self.db_path) as conn: conn.row_factory = sqlite3.Row if category: cursor = conn.execute(""" SELECT * FROM tool_preferences WHERE category = ? AND confidence >= ? ORDER BY confidence DESC, apply_count DESC """, (category, min_confidence)) else: cursor = conn.execute(""" SELECT * FROM tool_preferences WHERE confidence >= ? ORDER BY confidence DESC, apply_count DESC """, (min_confidence,)) return [dict(row) for row in cursor.fetchall()]

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/airmcp-com/mcp-standards'

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