PHP code example of mage2kishan / magento2-claude-ai

1. Go to this page and download the library: Download mage2kishan/magento2-claude-ai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mage2kishan / magento2-claude-ai example snippets


namespace YourVendor\YourModule\Model\Tool;

use Panth\ClaudeAi\Model\Tool\ToolInterface;

class MyTool implements ToolInterface
{
    public function name(): string { return 'my_tool'; }

    public function definition(): array
    {
        return [
            'name' => 'my_tool',
            'description' => 'Be specific — the AI uses this to decide when to call you.',
            'input_schema' => [
                'type' => 'object',
                'properties' => [
                    'param' => ['type' => 'string', 'description' => 'A parameter'],
                ],
                '
xml
<type name="Panth\ClaudeAi\Model\ToolRegistry\Admin">
    <arguments>
        <argument name="tools" xsi:type="array">
            <item name="my_tool" xsi:type="object">YourVendor\YourModule\Model\Tool\MyTool</item>
        </argument>
    </arguments>
</type>