AI assistants can only answer stock questions if they have the right data and the right tools. In PrestaShop, the built-in stock tools may not expose exactly what a merchant needs—like a combined view of out-of-stock products and their suppliers. By creating a custom MCP tool inside a module, you can give the assistant a precise function to call, turning a vague request into a reliable, actionable report.
Here are four practical takeaways from building a “Superpowers” module that surfaces out-of-stock items and their suppliers:
Declare the tool once, let the MCP Server expose it everywhere
A single PHP class with the@PsMcpToolattribute registers your function with the PrestaShop MCP Server. The server handles discovery for any compatible AI client, so you only write the business logic once.Focus on the data shape the merchant actually needs
Return a clear table-like structure (product, variation, stock, supplier) instead of raw SQL. This makes the assistant’s response concise and ready for restocking tasks.Keep the function read-only and idempotent
Marking the tool as non-destructive (readOnlyHint: true) reassures the AI that it can be called safely. It also simplifies permission reviews and testing.Test with a dedicated client before relying on Ask AI
Use MCP Inspector to verify the JSON output and edge cases (negative stock, missing suppliers, multistore). If the tool works in Inspector but not in Ask AI, the issue is usually visibility or client configuration, not the code.
Ready to supercharge your PrestaShop store? Read the full step-by-step guide and grab the boilerplate code on the author’s site:
https://nicolas-dabene.fr/en/blog/give-ask-ai-superpowers-with-your-prestashop-modules/
Top comments (0)