Skip to main content
Glama

list_prestashop_hooks

Discover available PrestaShop hooks for development by filtering by type and origin to integrate custom functionality.

Instructions

List all available PrestaShop hooks.

Args: hook_type: Filter by type (display, action) origin: Filter by origin (core, module, theme)

Returns: List of all hooks organized by type and origin

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hook_typeNo
originNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'list_prestashop_hooks' tool. Decorated with @mcp.tool(), it fetches hooks using the list_hooks helper, categorizes them by type, limits results per category, and formats a markdown list with summaries.
    @mcp.tool()
    def list_prestashop_hooks(
        hook_type: Optional[str] = None, origin: Optional[str] = None
    ) -> str:
        """List all available PrestaShop hooks.
    
        Args:
            hook_type: Filter by type (display, action)
            origin: Filter by origin (core, module, theme)
    
        Returns:
            List of all hooks organized by type and origin
        """
        logger.info(f"Listing hooks (type={hook_type}, origin={origin})")
        hooks = list_hooks(hook_type=hook_type, origin=origin)
    
        if not hooks:
            return "No hooks found matching the filters"
    
        # Organize hooks by type
        display_hooks = [h for h in hooks if h["type"] == "display"]
        action_hooks = [h for h in hooks if h["type"] == "action"]
        other_hooks = [h for h in hooks if h["type"] not in ["display", "action"]]
    
        output = [f"Available PrestaShop Hooks ({len(hooks)} total)\n"]
    
        if display_hooks:
            output.append(f"## Display Hooks ({len(display_hooks)})\n")
            for hook in display_hooks[:20]:  # Limit to first 20
                desc = hook.get("description", "")
                if desc:
                    desc = desc[:80] + "..." if len(desc) > 80 else desc
                    output.append(f"- **{hook['name']}** ({hook['origin']}) - {desc}")
                else:
                    output.append(f"- **{hook['name']}** ({hook['origin']})")
    
            if len(display_hooks) > 20:
                output.append(f"\n  ... and {len(display_hooks) - 20} more display hooks")
            output.append("")
    
        if action_hooks:
            output.append(f"## Action Hooks ({len(action_hooks)})\n")
            for hook in action_hooks[:20]:  # Limit to first 20
                desc = hook.get("description", "")
                if desc:
                    desc = desc[:80] + "..." if len(desc) > 80 else desc
                    output.append(f"- **{hook['name']}** ({hook['origin']}) - {desc}")
                else:
                    output.append(f"- **{hook['name']}** ({hook['origin']})")
    
            if len(action_hooks) > 20:
                output.append(f"\n  ... and {len(action_hooks) - 20} more action hooks")
            output.append("")
    
        if other_hooks:
            output.append(f"## Other Hooks ({len(other_hooks)})\n")
            for hook in other_hooks:
                output.append(f"- **{hook['name']}** ({hook['origin']}, {hook['type']})")
            output.append("")
    
        output.append(
            "\nUse get_prestashop_hook('hook_name') to get detailed documentation for a specific hook."
        )
    
        return "\n".join(output)
  • Supporting helper function that queries the SQLite 'hooks' table for hooks matching the optional type and origin filters, returning a list of dictionaries containing basic hook information.
    def list_hooks(
        hook_type: Optional[str] = None, origin: Optional[str] = None
    ) -> List[Dict]:
        """List all hooks with optional filters.
    
        Args:
            hook_type: Filter by type (display, action)
            origin: Filter by origin (core, module, theme)
    
        Returns:
            List of hooks
        """
        conn = sqlite3.connect(DB_PATH)
        conn.row_factory = sqlite3.Row
        cursor = conn.cursor()
    
        where_clauses = []
        params = []
    
        if hook_type:
            where_clauses.append("type = ?")
            params.append(hook_type)
    
        if origin:
            where_clauses.append("origin = ?")
            params.append(origin)
    
        where_clause = f"WHERE {' AND '.join(where_clauses)}" if where_clauses else ""
    
        cursor.execute(
            f"""
            SELECT name, type, origin, locations, description
            FROM hooks
            {where_clause}
            ORDER BY name
        """,
            params,
        )
    
        results = [dict(row) for row in cursor.fetchall()]
        conn.close()
    
        return results
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists hooks and returns them organized by type and origin, but it doesn't cover critical aspects like whether it's read-only, potential rate limits, authentication needs, or error handling. For a tool with no annotations, this is a significant gap.

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 well-structured and front-loaded, starting with the core purpose, followed by clear sections for arguments and returns. Every sentence adds value without redundancy, making it efficient and easy to parse.

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's low complexity, two parameters with 0% schema coverage, no annotations, but an output schema exists, the description is reasonably complete. It covers the purpose, parameters, and return structure, though it lacks behavioral details like safety or performance traits, which slightly reduces completeness.

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?

Schema description coverage is 0%, so the description must compensate. It explains the parameters 'hook_type' and 'origin' with their filtering purposes and possible values (e.g., 'display, action' for hook_type, 'core, module, theme' for origin), adding meaningful context beyond the bare schema. However, it doesn't detail default behaviors or constraints, slightly limiting the score.

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 tool's purpose: 'List all available PrestaShop hooks.' It specifies the verb ('List') and resource ('PrestaShop hooks'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_prestashop_hook' or 'search_prestashop_hooks,' which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions filtering options but doesn't specify scenarios where this tool is preferred over siblings like 'search_prestashop_hooks' or 'get_prestashop_hook.' This lack of comparative context leaves usage unclear.

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/florinel-chis/prestashop-mcp'

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