Skip to main content
Glama

get_prestashop_hook

Retrieve complete documentation for PrestaShop hooks to understand their functionality, parameters, and usage examples for development.

Instructions

Get complete documentation for a specific PrestaShop hook.

Args: hook_name: Name of the hook (e.g., 'displayHeader', 'actionProductAdd')

Returns: Complete hook documentation including description, parameters, examples

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hook_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_prestashop_hook' tool, decorated with @mcp.tool(). It retrieves hook data via get_hook() and formats it into comprehensive markdown documentation including type, origin, description, aliases, source files, code examples, and full content.
    @mcp.tool()
    def get_prestashop_hook(hook_name: str) -> str:
        """Get complete documentation for a specific PrestaShop hook.
    
        Args:
            hook_name: Name of the hook (e.g., 'displayHeader', 'actionProductAdd')
    
        Returns:
            Complete hook documentation including description, parameters, examples
        """
        logger.info(f"Getting hook: {hook_name}")
        hook = get_hook(hook_name)
    
        if not hook:
            return f"Hook '{hook_name}' not found. Use list_prestashop_hooks() to see available hooks."
    
        # Format hook documentation
        output = [f"# {hook['name']}\n"]
        output.append(f"**Type:** {hook['type']}")
        output.append(f"**Origin:** {hook['origin']}")
        output.append(f"**Locations:** {hook['locations']}\n")
    
        if hook.get("description"):
            output.append(f"## Description\n")
            output.append(f"{hook['description']}\n")
    
        if hook.get("aliases"):
            output.append(f"## Aliases\n")
            for alias in hook["aliases"]:
                output.append(f"- {alias}")
            output.append("")
    
        if hook.get("github_refs"):
            output.append(f"## Source Files\n")
            for ref in hook["github_refs"]:
                output.append(f"- {ref}")
            output.append("")
    
        if hook.get("code_examples"):
            output.append(f"## Code Examples\n")
            for i, example in enumerate(hook["code_examples"], 1):
                output.append(f"### Example {i}\n")
                output.append(f"```php\n{example}\n```\n")
    
        # Add full markdown content
        if hook.get("content"):
            output.append("## Full Documentation\n")
            output.append(hook["content"])
    
        return "\n".join(output)
  • Helper function that queries the SQLite database for detailed information on a specific hook by name, joining hooks and prestashop_docs tables, and returning a structured dictionary with all hook data.
    def get_hook(hook_name: str) -> Optional[Dict]:
        """Get complete documentation for a specific hook.
    
        Args:
            hook_name: Name of the hook
    
        Returns:
            Hook documentation dict or None if not found
        """
        conn = sqlite3.connect(DB_PATH)
        conn.row_factory = sqlite3.Row
        cursor = conn.cursor()
    
        cursor.execute(
            """
            SELECT
                hooks.*,
                prestashop_docs.content,
                prestashop_docs.path
            FROM hooks
            JOIN prestashop_docs ON hooks.doc_id = prestashop_docs.id
            WHERE hooks.name = ?
        """,
            (hook_name,),
        )
    
        row = cursor.fetchone()
        conn.close()
    
        if not row:
            return None
    
        return {
            "name": row["name"],
            "type": row["type"],
            "origin": row["origin"],
            "locations": row["locations"],
            "description": row["description"],
            "aliases": json.loads(row["aliases"]) if row["aliases"] else [],
            "github_refs": json.loads(row["github_refs"]) if row["github_refs"] else [],
            "code_examples": (
                json.loads(row["code_examples"]) if row["code_examples"] else []
            ),
            "content": row["content"],
            "path": row["path"],
        }
Behavior3/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. It discloses the tool's behavior as a read-only documentation retrieval operation ('Get complete documentation'), which is clear and non-destructive. However, it lacks details on potential errors (e.g., if the hook doesn't exist), rate limits, or authentication needs, leaving some behavioral aspects unspecified.

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 front-loaded with the core purpose in the first sentence, followed by structured 'Args' and 'Returns' sections that efficiently document inputs and outputs without unnecessary verbiage. Every sentence earns its place by adding specific value, making it highly concise and well-organized.

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

Completeness5/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 (single parameter, no nested objects), the presence of an output schema (which handles return value documentation), and the description's clear coverage of purpose, parameters, and returns, it is complete enough for effective use. The description provides all necessary context without redundancy, aligning well with the structured data available.

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 schema description coverage is 0%, so the description must compensate. It adds meaningful semantics by explaining that 'hook_name' is the 'Name of the hook' and provides concrete examples ('displayHeader', 'actionProductAdd'), which clarifies the parameter's purpose and expected format beyond the bare schema. This is valuable, though it doesn't cover all possible edge cases like invalid names.

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 specific action ('Get complete documentation') and resource ('for a specific PrestaShop hook'), distinguishing it from sibling tools like 'list_prestashop_hooks' (which lists hooks) and 'get_prestashop_doc' (which presumably gets general documentation). The verb 'Get' combined with the specific resource type makes the purpose unambiguous.

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 implies usage context by specifying it's for 'a specific PrestaShop hook,' suggesting this tool should be used when you already know the hook name. However, it doesn't explicitly state when NOT to use it or name alternatives like 'list_prestashop_hooks' for discovering hook names first, which would elevate it to a 5.

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