Skip to content

Conversation

@zacksmash
Copy link
Contributor

A new property for $meta was added to Tool definitions, which will allow you to attach the _meta output property. Currently, this has only been applied to the Tool output, but may easily be added to other Primitives. This behaves in the same way that $name, $title or $description would.

A new method for securitySchemes() has also been added to tools, which works in a similar fashion to the JSON schema() method. A new static builder class has also been added to assist with security schemes, and type-hinted on the tool method.

Example:

#[IsReadOnly()]
class WeatherTool extends Tool
{
    protected array $meta = [
        'someKey' => 'someValue',
        'foo' => 'bar'
    ];

    //  ...
    
    // Or via the meta() method
    
    public function meta(): array
    {
        return [
            'someKey' => 'someValue',
            'foo' => 'bar'
        ]
    }

    public function securitySchemes(SecurityScheme $scheme): array
    {
        return [
            $scheme->oauth2('mcp:use')
        ];
    }

Ref #99

@pushpak1300 pushpak1300 self-requested a review November 6, 2025 15:17
@zacksmash zacksmash changed the title Add meta and security scheme to tool definition Add Meta and Security Schemes to tool definition Nov 6, 2025
@zacksmash
Copy link
Contributor Author

On this one, happy to remove the SecurityScheme class and just define them manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant