[Tracker]
Update Summary: MCP tools always fail on execution; doExecute() looks tools up by key in a numeric list and checks a non-existent enabled_tools property. Patch ready.
Check-in Date: 07/03/2026
Blocked by: N/A
Additional Collaborators:
Metadata is used by the AI Tracker. Docs and additional fields here.
[/Tracker]
Problem/Motivation
No MCP tool can be executed through the tool plugin — every call fails with MCP tool is not enabled. or MCP server has no enabled tools. (surfaced by AI agents as the tool being "unavailable"), even with the server and tool enabled.
The cause is in McpToolBase::doExecute():
$server->get('tools')is a numeric-indexed list of tool definitions (each with its ownname/enabled), but the code indexes it by tool name ($tools[$tool]), so the lookup is always empty.- It then checks
$server->get('enabled_tools'), butenabled_toolsis not a property of theMcpServerentity (config_exportonly hastools), so it is alwaysNULL.
Steps to reproduce: configure an HTTP MCP server, fetch/enable its tools, then execute any derived mcp_tool:<server_id>:<tool_name> plugin → fails with "MCP tool is not enabled."
Proposed resolution
Look the tool up by name in the tools list and gate on that entry's own enabled flag; drop the enabled_tools checks. Also split the derivative id with a limit (explode(':', $derivative_id, 2)) and guard the schema iteration ($tool_info['inputSchema']['properties'] ?? []) for parameterless tools.
- $tools = $server->get('tools');
- if (empty($tools[$tool])) {
- return ExecutableResult::failure(new TranslatableMarkup('MCP tool is not enabled.'));
+ $tool_info = NULL;
+ foreach ($server->get('tools') ?? [] as $candidate) {
+ if (($candidate['name'] ?? NULL) === $tool) {
+ $tool_info = $candidate;
+ break;
+ }
}
- $enabled_tools = $server->get('enabled_tools');
- if (empty($enabled_tools)) {
- return ExecutableResult::failure(new TranslatableMarkup('MCP server has no enabled tools.'));
+ if ($tool_info === NULL) {
+ return ExecutableResult::failure(new TranslatableMarkup('MCP tool is not available on this server.'));
}
- if (!in_array($tool, $enabled_tools)) {
+ if (empty($tool_info['enabled'])) {
return ExecutableResult::failure(new TranslatableMarkup('MCP tool is not enabled.'));
}
- $tool_info = $tools[$tool];
After this, executing mcp_tool:<server_id>:<tool_name> succeeds (verified with parameterless and parameterized tools). Reproduced on mcp_client 1.0.x-dev, Drupal 11.
Target date or deadline
N/A
Remaining tasks
- Review/commit the fix.
- Optional: test coverage for enabled, missing, and disabled tools.
AI usage (if applicable)
[x] AI Assisted Issue
This issue was generated with AI assistance, but was reviewed and refined by the creator.
[ ] AI Assisted Code
This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.
[x] AI Generated Code
This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.
[ ] Vibe Coded
This code was generated by an AI and has only been functionally tested.
Issue fork mcp_client-3608121
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