UAT: MCP adapter register_tools() infers resource slots but never wires them into domain Tool objects — resource binding metadata lost #6147

Open
opened 2026-04-09 15:33:40 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: MCP Adapter Integration
Milestone Scope: v3.3.0 (MCP tool integration)
Severity: Non-critical (resource binding metadata silently dropped)


What Was Tested

The MCPToolAdapter.register_tools() method in src/cleveragents/mcp/adapter.py and whether inferred resource slots are persisted to the domain Tool objects.

Expected Behavior (from spec)

When MCP tools are registered via MCPToolAdapter.register_tools(), the inferred resource slots (file, directory, repository bindings) should be persisted to the domain Tool objects so that:

  1. agents tool show <name> displays the resource slots
  2. The resource binding system can enforce access controls
  3. The tool registry database stores the bindings in tool_resource_bindings

Actual Behavior

The register_tools() method correctly infers resource slots via infer_resource_slots(), but then stores them only in source_metadata — NOT in the domain Tool object's resource_slots field:

# In MCPToolAdapter.register_tools():
inferred_slots = self.infer_resource_slots(desc.name, desc.input_schema)
slot_dicts = [
    {
        "name": slot.name,
        "resource_type": slot.resource_type,
        "access": slot.access.value,
        "binding": slot.binding.value,
    }
    for slot in inferred_slots
]

# TODO(#882): resource_slots are stored in source_metadata but
# nothing downstream reads them yet.  The ToolRegistry persists
# resource bindings via domain Tool.resource_slots, and the DB
# migration (c1_001) stores them in tool_resource_bindings.
# A follow-up ticket should wire inferred slots into the domain
# Tool objects so the registry and DB actually consume them.
spec = ToolSpec(
    name=tool_name,
    ...
    source_metadata={
        "server": self._config.name,
        "resource_slots": slot_dicts,  # ← stored here only
        ...
    },
)

The ToolSpec constructor does NOT receive resource_slots as a direct parameter — the slots are buried in source_metadata where no downstream code reads them.

Impact

  1. agents tool show <mcp-namespace/tool-name> shows empty resource slots even when the tool has file/directory/repository parameters
  2. The resource binding enforcement system cannot apply access controls to MCP tools
  3. The tool_resource_bindings database table is never populated for MCP tools
  4. The agents tool list --source mcp output is missing resource binding information

Code Location

src/cleveragents/mcp/adapter.pyMCPToolAdapter.register_tools() method, the TODO(#882) comment block.

Steps to Reproduce

  1. Configure an MCP server with a tool that has file_path parameter
  2. Register the MCP server tools via the adapter
  3. Run agents tool show <mcp-namespace/tool-name>
  4. Observe: Resource Slots section shows "(none)" despite the tool having file parameters

Fix

Pass the inferred ResourceSlot objects directly to the ToolSpec constructor's resource_slots parameter (if it exists), or create the domain Tool object with the resource slots populated before registering it in the registry.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area**: MCP Adapter Integration **Milestone Scope**: v3.3.0 (MCP tool integration) **Severity**: Non-critical (resource binding metadata silently dropped) --- ## What Was Tested The `MCPToolAdapter.register_tools()` method in `src/cleveragents/mcp/adapter.py` and whether inferred resource slots are persisted to the domain `Tool` objects. ## Expected Behavior (from spec) When MCP tools are registered via `MCPToolAdapter.register_tools()`, the inferred resource slots (file, directory, repository bindings) should be persisted to the domain `Tool` objects so that: 1. `agents tool show <name>` displays the resource slots 2. The resource binding system can enforce access controls 3. The tool registry database stores the bindings in `tool_resource_bindings` ## Actual Behavior The `register_tools()` method correctly infers resource slots via `infer_resource_slots()`, but then stores them only in `source_metadata` — NOT in the domain `Tool` object's `resource_slots` field: ```python # In MCPToolAdapter.register_tools(): inferred_slots = self.infer_resource_slots(desc.name, desc.input_schema) slot_dicts = [ { "name": slot.name, "resource_type": slot.resource_type, "access": slot.access.value, "binding": slot.binding.value, } for slot in inferred_slots ] # TODO(#882): resource_slots are stored in source_metadata but # nothing downstream reads them yet. The ToolRegistry persists # resource bindings via domain Tool.resource_slots, and the DB # migration (c1_001) stores them in tool_resource_bindings. # A follow-up ticket should wire inferred slots into the domain # Tool objects so the registry and DB actually consume them. spec = ToolSpec( name=tool_name, ... source_metadata={ "server": self._config.name, "resource_slots": slot_dicts, # ← stored here only ... }, ) ``` The `ToolSpec` constructor does NOT receive `resource_slots` as a direct parameter — the slots are buried in `source_metadata` where no downstream code reads them. ## Impact 1. `agents tool show <mcp-namespace/tool-name>` shows empty resource slots even when the tool has file/directory/repository parameters 2. The resource binding enforcement system cannot apply access controls to MCP tools 3. The `tool_resource_bindings` database table is never populated for MCP tools 4. The `agents tool list --source mcp` output is missing resource binding information ## Code Location `src/cleveragents/mcp/adapter.py` — `MCPToolAdapter.register_tools()` method, the `TODO(#882)` comment block. ## Steps to Reproduce 1. Configure an MCP server with a tool that has `file_path` parameter 2. Register the MCP server tools via the adapter 3. Run `agents tool show <mcp-namespace/tool-name>` 4. Observe: Resource Slots section shows "(none)" despite the tool having file parameters ## Fix Pass the inferred `ResourceSlot` objects directly to the `ToolSpec` constructor's `resource_slots` parameter (if it exists), or create the domain `Tool` object with the resource slots populated before registering it in the registry. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 21:17:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#6147
No description provided.