Problem/Motivation
We want to add support for Tool API natively in the MCP product instead of relying on AI Function calls. This will mean being able to take full advantage of the MCP spec with mapping the additional metadata provided by Tool API tools.
Proposed resolution
Create an mcp_tool submodule, with a plugin that creates a 1:1 relationship for Tool API tools and MCP tools.
We will need to determine a path forward for normalizing Tool API inputs/outputs to match the MCP JSON schema spec. Right now we've been leaning on the AI module normalizer to make this work, but ideally we can solve it use the Drupal core/symfony normalizer capabilities. We also need to decide where this normalizer should live.
Later we can introduce other ways to surface Tool API tools to MCP. For example instead of a 1:1 relationship, provide 3 tools (Discover, Plan, Execute) that allows for dynamic tool discovery/usage, which will assist when a server needs to surface a large number of tools without overwhelming contexts.
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Issue fork mcp-3552145
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
michaellander commentedThis branch depends on #3550817: Determine path forward for turning Attributes into JSON schema, which I'm hoping to have fixed shortly.
Comment #4
michaellander commentedThere are a few PHPStan flags that I'm not sure the best way to fix. The one about using \Drupal to get the tempstore service is intentional, however, as I would like to replace the token stuff with a common API that works across modules and don't want to tie the tempstore service into the dependency injection until a unified solution is in place.
Comment #6
gagosha commented