Skip to main content
Glama

get_pitfalls

Identify common LSL pitfalls to prevent AI coding errors. Filter pitfalls by category or AI source for targeted guidance.

Instructions

Return known LSL pitfalls for AI coding assistants.

Call with no arguments for a full briefing before starting an LSL task. Filter by category or by which AI tool produced the mistake.

Args: category: reserved_words | nonexistent_functions | unsupported_syntax | scoping | type_coercion | state_behavior ai_source: kiro | claude-code | both

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
ai_sourceNo

Implementation Reference

  • server.py:123-140 (registration)
    The `get_pitfalls` tool is registered via the `@mcp.tool()` decorator. This is the MCP entry point that exposes the tool to clients.
    @mcp.tool()
    def get_pitfalls(
        category: str | None = None,
        ai_source: str | None = None,
    ) -> dict:
        """
        Return known LSL pitfalls for AI coding assistants.
    
        Call with no arguments for a full briefing before starting an LSL task.
        Filter by category or by which AI tool produced the mistake.
    
        Args:
            category:  reserved_words | nonexistent_functions | unsupported_syntax
                       | scoping | type_coercion | state_behavior
            ai_source: kiro | claude-code | both
        """
        log.info("get_pitfalls(category=%r, ai_source=%r)", category, ai_source)
        return lsl_get_pitfalls(category, ai_source)
  • The actual implementation of `lsl_get_pitfalls`. It queries an SQLite database for pitfalls, optionally filtering by category and/or AI source, and returns a dict with count, filters, and pitfalls list.
    def lsl_get_pitfalls(category: str | None = None, ai_source: str | None = None) -> dict:
        """
        Return known LSL pitfalls for AI coding assistants.
    
        Call with no arguments to get all pitfalls. Filter by category or by
        which AI tool produced the mistake.
    
        Args:
            category:  One of: reserved_words, nonexistent_functions,
                       unsupported_syntax, scoping, type_coercion, state_behavior.
                       Omit to return all categories.
            ai_source: One of: kiro, claude-code, both.
                       Omit to return pitfalls from all sources.
    
        Returns:
            dict with keys:
                count    — number of pitfalls returned
                filters  — the filters that were applied
                pitfalls — list of pitfall records
        """
        if category and category not in VALID_CATEGORIES:
            return {
                "error": f"Unknown category '{category}'.",
                "valid_categories": sorted(VALID_CATEGORIES),
            }
    
        con    = _connect()
        query  = "SELECT * FROM pitfalls WHERE 1=1"
        params: list = []
    
        if category:
            query += " AND category = ?"
            params.append(category)
    
        if ai_source:
            query += " AND (ai_source = ? OR ai_source = 'both')"
            params.append(ai_source)
    
        query += " ORDER BY category, id"
    
        rows = con.execute(query, params).fetchall()
    
        return {
            "count":   len(rows),
            "filters": {"category": category, "ai_source": ai_source},
            "pitfalls": [_row_to_dict(r) for r in rows],
        }
  • The VALID_CATEGORIES set defines the allowed values for the 'category' parameter, enforced by the handler.
    VALID_CATEGORIES = {
        "reserved_words",
        "nonexistent_functions",
        "unsupported_syntax",
        "scoping",
        "type_coercion",
        "state_behavior",
    }
  • Helper function `_row_to_dict` converts a SQLite row into a dict used by the handler when building the response.
    def _row_to_dict(row: sqlite3.Row) -> dict:
        return {
            "id":           row["id"],
            "category":     row["category"],
            "title":        row["title"],
            "bad_example":  row["bad_example"],
            "good_example": row["good_example"],
            "notes":        row["notes"],
            "ai_specific":  bool(row["ai_specific"]),
            "portable_only": bool(row["portable_only"]),
            "ai_source":    row["ai_source"],
            "created_at":   row["created_at"],
        }
  • Helper function `_connect` sets up the SQLite database connection used by the handler.
    def _connect() -> sqlite3.Connection:
        if not DB_PATH.exists():
            raise RuntimeError(
                f"Database not found at {DB_PATH}. "
                "Run scripts/scrape_wiki.py then scripts/load_db.py first."
            )
        con = sqlite3.connect(DB_PATH)
        con.row_factory = sqlite3.Row
        con.execute("PRAGMA foreign_keys=ON")
        return con
Behavior3/5

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

No annotations are provided, so the description must convey behavioral traits. It describes the tool as returning pitfalls, implying a read-only operation. However, it doesn't disclose potential side effects, rate limits, or authentication needs. The description is adequate but not rich in behavioral details.

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 concise with a clear purpose statement, usage guidance, and parameter details. It is front-loaded with the main intent and contains no superfluous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has only two optional parameters and no output schema, the description provides sufficient context: purpose, usage, and parameter options. It doesn't describe the return format, but for a list of pitfalls, this is likely acceptable. Overall, it is complete enough for an agent to use correctly.

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

Parameters4/5

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

The input schema has 0% description coverage, so the description compensates by listing allowed values for category and ai_source in the Args section. It explains that category can be one of several enumerated values and ai_source can be 'kiro', 'claude-code', or 'both', adding significant meaning beyond the schema.

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 returns known LSL pitfalls for AI coding assistants. It specifies the verb 'Return' and the resource 'known LSL pitfalls'. It also differentiates from sibling tools like check_code and get_constants by focusing specifically on pitfalls.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly recommends calling with no arguments for a full briefing before starting an LSL task. It also explains how to filter by category or ai_source. While it doesn't explicitly state when not to use it, the usage advice is clear and contextual.

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/Treeeeeeeeeeeeee/second-life-mcp-server'

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