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()]
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It mentions confidence scores and automatic learning from corrections, but doesn't disclose permissions needed, rate limits, pagination, or what 'get all' entails (e.g., scope, limitations). This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It front-loads the core purpose and includes key details like confidence scores and learning source, making it appropriately sized and structured.

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?

Given no annotations and no output schema, the description is minimally adequate but incomplete. It covers the purpose and data source but lacks behavioral context, output details, and usage guidelines. For a tool with two parameters and no structured safety hints, this leaves gaps in understanding how to invoke it effectively.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('category' and 'min_confidence'). The description adds no additional parameter semantics beyond what the schema provides, such as examples or usage context, meeting the baseline for high schema coverage.

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 verb 'Get' and resource 'learned preferences', specifying they include 'confidence scores' and are 'automatically learned from corrections'. This distinguishes it from sibling tools like 'list_recent' or 'search_episodes', though it doesn't explicitly contrast with them.

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?

No guidance is provided on when to use this tool versus alternatives like 'list_recent' or 'search_episodes'. The description implies retrieval of learned preferences but offers no context about appropriate scenarios or exclusions.

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

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