-
-
Notifications
You must be signed in to change notification settings - Fork 38
[McpBundle] Compiler pass for tools #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c61b564
to
58536bd
Compare
da439c8
to
b1c22fe
Compare
src/mcp-bundle/src/DependencyInjection/ContainerBuilder/MCPToolChainCompilerPass.php
Outdated
Show resolved
Hide resolved
src/mcp-bundle/src/DependencyInjection/ContainerBuilder/MCPToolChainCompilerPass.php
Outdated
Show resolved
Hide resolved
src/mcp-bundle/src/DependencyInjection/ContainerBuilder/MCPToolChainCompilerPass.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd6c9f1
to
220575f
Compare
You're welcome @chr-hertel. I believe I've address everything you mentioned if you'd like to take another look whenever you have time. |
Could be a follow up PR, but I would like to have an attribute for this like in the agent |
src/mcp-bundle/src/DependencyInjection/ContainerBuilder/McpToolChainCompilerPass.php
Outdated
Show resolved
Hide resolved
Address comments lint Update src/mcp-bundle/CHANGELOG.md Co-authored-by: Oskar Stark <[email protected]> Update src/mcp-bundle/CHANGELOG.md Co-authored-by: Oskar Stark <[email protected]> Update src/mcp-bundle/doc/index.rst Co-authored-by: Oskar Stark <[email protected]> Update src/mcp-bundle/doc/index.rst Co-authored-by: Oskar Stark <[email protected]> Remove strict types
3b01c9b
to
20ef42c
Compare
@chr-hertel my bad on missing the strict types, updated now and rebased into 1 commit |
@@ -63,6 +63,11 @@ Configuration | |||
sse: | |||
url: 'http://localhost:8000/sse' # URL to SSE endpoint of MCP server | |||
To add your tools to the MCP server, add the following tag:: | |||
|
|||
#[AutoconfigureTag('mcp.tool')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not the right recommendation IMO:
AutoconfigureTag
(like allAutoconfigure*
attributes) is about defining an autoconfiguration rule applying on all child types (its original intent is to be used on interfaces). Recommending to use it to apply a tag on a service directly is a bad idea, as it can have unintended side effects for non-final classes (as it will also impact autoconfigured services defined with child classes)- if the goal is to automatically tag autoconfigured services implementing ToolExecutorInterface with the
mcp.tool
to make it simpler for projects adding a custom tool, the solution is for the MCP bundle to register an autoconfiguration rule for ToolExecutorInterface, so that projects only need to implement the interface and be done with it.
return; | ||
} | ||
|
||
$definition = new Definition(ToolChain::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could always define a mcp.tool_chain
service using a tagged iterator, and then defining a ToolExecutorInterface
alias pointing at it (which projects can still override if they don't want to rely on the tool chain).
There is no need for this compiler pass IMO.
Add a Compiler Pass to find tools and register them in the ToolChain