Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Conversation

@Iyadhfaleh
Copy link
Contributor

@Iyadhfaleh Iyadhfaleh commented Dec 17, 2024

The idea is to add tools that haven't #[AsTool] attribute like this :

new ToolBox(new ToolAnalyzer(), ['clock' => $clock]);

Tools MUST implement __invoke method.

@Iyadhfaleh Iyadhfaleh force-pushed the feature/execute-tools-without-as-tool-attribute branch from 4abb4ee to 911dcb0 Compare December 17, 2024 10:51
@Iyadhfaleh Iyadhfaleh force-pushed the feature/execute-tools-without-as-tool-attribute branch from 1d88087 to 12816f9 Compare December 17, 2024 14:45

use Symfony\Component\Clock\ClockInterface;

final readonly class ClockWithoutAttribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a tool should be added to the tests/ folder, as we don't need to ship two clock tools, doing the exact same thing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this added example . I already added a fixture test without the attribute .
The idea was to provide an example of tool without "AsTool" .
I deleted this attribute from clock tool to show that case .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need an example for this, but rather a test, so please keep the clock with the attribute and the example and extend ToolboxTestCase with a fixture file, shown, that this tool will be registered. thanks

@OskarStark OskarStark changed the title Feature/execute tools without as tool attribute Register tools without #[AsTool] attribute Dec 20, 2024
@chr-hertel
Copy link
Member

chr-hertel commented Dec 21, 2024

Thank you @Iyadhfaleh for your idea to solve this - i'm currently not fully convinced since this is really limited - no description and only __invoke. with third party code this is not simply possible.
don't have a better idea myself atm as well.

chr-hertel added a commit that referenced this pull request Mar 19, 2025
* allows to use tools without attributes, but still leverages reflection
for parameters
* allows to override tools configured with attributes with an explicit
config

closes #134 & replaces #160

foundation for using third party classes as tools and registering tools
dynamically via MCP
@chr-hertel
Copy link
Member

Replaced by #256, see #262 for docs.

@chr-hertel chr-hertel closed this Mar 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants