Skip to content

Enhancement: Inherit parent MCP tools in direct MCP-initiated ooo run executions #181

@jcfernandez-890825

Description

@jcfernandez-890825

Summary

Follow-up to #176 and the excellent fix in PR #180. The nested delegation inheritance works perfectly — child ooo run executions inherit parent MCP tools via PreToolUse hook injection and session forking. However, direct MCP-initiated executions (calling ouroboros_execute_seed / ouroboros_start_execute_seed from the main Claude session) do not inherit the parent session's MCP tools.

Current Behavior

When a user calls ooo run from their Claude Code session (which has MCP tools like mcp__github__*, mcp__chrome-devtools__*), the ExecuteSeedHandler.handle() in definitions.py creates an OrchestratorRunner without mcp_manager and without inherited tools:

# definitions.py:238-246
runner = OrchestratorRunner(
    adapter=agent_adapter,
    event_store=event_store,
    console=console,
    debug=False,
    enable_decomposition=True,
    inherited_runtime_handle=inherited_runtime_handle,  # None for direct calls
    inherited_tools=inherited_effective_tools,           # None for direct calls
)

The inherited_runtime_handle and inherited_effective_tools are only populated when the internal delegation fields (_ooo_parent_claude_session_id, _ooo_parent_effective_tools) are present in the tool arguments — which only happens when a parent orchestrator's PreToolUse hook injects them during nested execution.

For direct calls from the main Claude session, these fields are absent, so the runner starts with only DEFAULT_TOOLS = ["Read", "Write", "Edit", "Bash", "Glob", "Grep"].

Evidence

Smoke test on v0.25.1: a seed with AC "use mcp__github__issue_read to read issue 176" completed successfully, but the subagent's own output noted:

"The mcp__github__issue_read MCP tool was not registered in this environment's tool set, so I used the GitHub REST API via curl as a fallback."

The subagent used Bash + curl (available in DEFAULT_TOOLS) instead of the MCP tool.

Desired Behavior

Direct MCP-initiated ooo run executions should inherit the parent Claude session's effective MCP tool set, just as nested delegated runs do after PR #180.

Possible Approaches

The ExecuteSeedHandler runs inside the Ouroboros MCP server process, which doesn't have direct access to the parent Claude session's MCP tool registry. The delegation mechanism in PR #180 works because the parent orchestrator (running inside Claude) can inject metadata via hooks. For direct calls, the MCP server would need a way to discover which MCP tools the calling Claude session has available.

Some ideas (for maintainer consideration):

  1. Claude Agent SDK session info — if claude_agent_sdk exposes the parent session's tool list, the handler could read it
  2. MCP server configuration — allow the Ouroboros MCP server config to specify additional tools that should be available to all executions
  3. Tool list as explicit parameter — add an optional additional_tools parameter to execute_seed for the caller to pass their available tools

Context

Environment

  • Ouroboros v0.25.1
  • Claude Code with GitHub MCP + Chrome DevTools MCP configured in ~/.claude.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or meaningful improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions