get_prestashop_hook
Retrieve complete documentation for PrestaShop hooks including descriptions, parameters, and usage examples to support development workflows.
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
| Name | Required | Description | Default |
|---|---|---|---|
| hook_name | Yes |
Implementation Reference
- prestashop_mcp/server.py:78-127 (handler)Primary handler function for the 'get_prestashop_hook' MCP tool. Decorated with @mcp.tool() for automatic registration. Fetches hook data via get_hook() helper and formats comprehensive Markdown documentation including description, aliases, source refs, 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)
- prestashop_mcp/ingest.py:300-346 (helper)Helper utility function that queries the SQLite database to retrieve full hook documentation data used by the tool handler.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"], }
- prestashop_mcp/server.py:78-78 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()