Skip to content

Add ExecPlan: translate tool schemas per backend (2.3.3)#73

Draft
leynos wants to merge 1 commit into
mainfrom
translate-tool-schemas-backend-az7e82
Draft

Add ExecPlan: translate tool schemas per backend (2.3.3)#73
leynos wants to merge 1 commit into
mainfrom
translate-tool-schemas-backend-az7e82

Conversation

@leynos

@leynos leynos commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new execution plan document for roadmap item 2.3.3: Translate tool schemas per backend. This plan outlines the purpose, constraints, tolerances, risks, and a staged approach to translating canonical MCP tool definitions into backend-specific schemas, enabling automated translation within the orchestration flow without manual glue.

Changes

  • Added docs/execplans/2-3-3-translate-tool-schemas-per-backend.md (new ExecPlan)

Rationale

  • Establishes a formal bridge between canonical tool definitions (tool_registry) and backend-specific schemas (agent_backend) within a hexagonal architecture boundary.
  • Keeps translation logic codified in backend adapters while preserving canonical ownership and runtime routing separation.
  • Documents the plan, risks, and gates to align stakeholders and guide implementation across stages A–G.

Key content (high level)

  • Purpose / big picture
  • Reference documents and skills to keep open while implementing
  • Context and orientation of current code surfaces
  • Constraints that preserve architecture and ownership boundaries
  • Tolerances (exception triggers)
  • Risks with mitigations
  • Progress to date and remaining stages
  • Surprises & Discoveries
  • Decision Log (design decisions guiding translation approach)
  • Plan of work (Stage A through Stage G) with concrete test and implementation steps
  • Gate and validation expectations

Plan of work (stages at a glance)

  • Stage A: establish seam and write failing tests first
  • Stage B: add domain/port contracts for canonical tool intake and translated-tool envelopes
  • Stage C: implement backend-specific translation mapping in adapters
  • Stage D: wire translation into orchestration and tool discovery
  • Stage E: complete full test matrix (unit, integration, BDD)
  • Stage F: update design and user docs; mark roadmap item as done upon gates
  • Stage G: run full validation gates and capture evidence

Testing and validation approach

  • Emphasizes test-first progression: failing tests for translation, then success tests for multiple backends (e.g., claide_code_sdk, codex_cli)
  • Includes unit, in-memory integration, PostgreSQL integration, and BDD coverage plans
  • Ensures translation rejects unsupported shapes and preserves required fields

Documentation impact

  • Intended updates to design and user docs on completion (docs/corbusier-design.md, docs/users-guide.md, docs/roadmap.md)

Risks and dependencies (high level)

  • Complexity of cross-boundary translation without leaking backend specifics into domain layers
  • Need for stable translation contracts per backend adapter version
  • No new persistence required unless a runtime requirement dictates otherwise

How to review

  • Verify the exec plan sections align with existing repository conventions and other exec plans
  • Check for completeness of the Stage A–G plan and clarity of acceptance criteria
  • Ensure the stated architectural boundaries (tool_registry, agent_backend, runtime adapters) are consistent with current codebase

Notes for maintainers

  • This is a planning document and does not modify code paths today. Feedback should help tighten scopes, edge cases, and gating criteria before implementation begins.

◳ Generated by DevBoxer


ℹ️ Tag @devboxerhub to ask questions and address PR feedback

📎 Task: https://www.devboxer.com/task/e1241ba7-4c85-4c65-8dd5-3929499256c2

Summary by Sourcery

Documentation:

  • Add a new ExecPlan documenting constraints, risks, and staged implementation (A–G) for backend-specific translation of canonical MCP tool schemas, including testing and validation strategy.

This new document outlines the detailed plan to bridge the gap between canonical Model Context Protocol (MCP) tool definitions and backend-specific tool schema translation in the Corbusier system. It establishes the translation seam, defines constraints, risks, tolerances, and a staged implementation roadmap for delivering automatic backend-specific tool schema translation and validation.

The execplan covers design, testing strategies, domain boundaries, decision logs, and expected outcomes, serving as a comprehensive guide to implement roadmap item 2.3.3.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 19605a88-c208-4cbb-a13a-712d43dddf0b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch translate-tool-schemas-backend-az7e82

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a new execution plan document describing how to implement backend-specific translation of canonical MCP tool schemas within the agent backend/orchestrator, including architecture constraints, risks, and a staged (A–G) implementation and testing strategy.

Sequence diagram for turn execution with backend-specific tool schema translation

sequenceDiagram
  actor Caller
  participant AgentTurnOrchestratorService
  participant ToolDiscoveryPort
  participant ToolRegistryCatalogue
  participant AgentRuntimePort
  participant RuntimeAdapter
  participant ToolRouterPort

  Caller->>AgentTurnOrchestratorService: ExecuteAgentTurnRequest
  AgentTurnOrchestratorService->>ToolDiscoveryPort: list_canonical_tools(backend_id, conversation_id)
  ToolDiscoveryPort->>ToolRegistryCatalogue: fetch_mcp_tools(conversation_id)
  ToolRegistryCatalogue-->>ToolDiscoveryPort: Vec<McpToolDefinition>
  ToolDiscoveryPort-->>AgentTurnOrchestratorService: Vec<CanonicalToolDto>

  AgentTurnOrchestratorService->>AgentRuntimePort: prepare_runtime_request(TurnExecutionRequest, Vec<CanonicalToolDto>)
  AgentRuntimePort->>RuntimeAdapter: translate_tools_and_build_request(TurnExecutionRequest, Vec<CanonicalToolDto>)
  RuntimeAdapter-->>AgentRuntimePort: PreparedRuntimeTurnRequest or TranslationError

  alt translation_success
    AgentRuntimePort-->>AgentTurnOrchestratorService: PreparedRuntimeTurnRequest
    AgentTurnOrchestratorService->>AgentRuntimePort: execute_turn(PreparedRuntimeTurnRequest)
    AgentRuntimePort->>RuntimeAdapter: execute_turn(PreparedRuntimeTurnRequest)
    RuntimeAdapter-->>AgentRuntimePort: TurnResult with tool_calls
    AgentRuntimePort-->>AgentTurnOrchestratorService: TurnResult

    loop each_emitted_tool_call
      AgentTurnOrchestratorService->>ToolRouterPort: route_tool_call(canonical_tool_name, payload)
      ToolRouterPort->>ToolRegistryCatalogue: dispatch_and_execute_tool_call
      ToolRegistryCatalogue-->>ToolRouterPort: ToolCallResult
      ToolRouterPort-->>AgentTurnOrchestratorService: ToolCallResult
    end

    AgentTurnOrchestratorService-->>Caller: TurnResult with tool_call_outcomes
  else translation_failure
    AgentRuntimePort-->>AgentTurnOrchestratorService: TranslationError
    AgentTurnOrchestratorService-->>Caller: ErrorResponse(TranslationError)
  end
Loading

Class diagram for planned tool schema translation contracts

classDiagram
  class McpToolDefinition {
    +String name
    +String description
    +JsonSchema input_schema
    +JsonSchema output_schema
  }

  class CanonicalToolDto {
    +String name
    +String description
    +JsonSchema input_schema
    +JsonSchema output_schema
  }

  class TranslatedToolEnvelope {
    +String canonical_name
    +BackendToolPayload backend_payload
    +bool is_supported
  }

  class TurnExecutionRequest {
    +Uuid conversation_id
    +String prompt
    +Vec<ToolCall> tool_calls
  }

  class PreparedRuntimeTurnRequest {
    +Uuid conversation_id
    +String prompt
    +Vec<ToolCall> tool_calls
    +Vec<TranslatedToolEnvelope> available_tools
  }

  class TranslationError {
    +TranslationErrorKind kind
    +String message
  }

  class TranslationErrorKind {
    <<enumeration>>
    UnsupportedCanonicalShape
    BackendIncompatible
    InfrastructureFailure
  }

  class ToolDiscoveryPort {
    +Vec<CanonicalToolDto> list_canonical_tools(Uuid conversation_id, BackendId backend_id)
  }

  class AgentRuntimePort {
    +PreparedRuntimeTurnRequest prepare_runtime_request(TurnExecutionRequest request, Vec<CanonicalToolDto> canonical_tools) TranslationError
    +TurnResult execute_turn(PreparedRuntimeTurnRequest prepared_request) RuntimeError
  }

  class ToolRouterPort {
    +ToolCallResult route_tool_call(String canonical_tool_name, ToolCallPayload payload)
  }

  class AgentTurnOrchestratorService {
    +TurnResult execute_turn(ExecuteAgentTurnRequest request)
    -PreparedRuntimeTurnRequest prepare_request(TurnExecutionRequest request)
  }

  class ExecuteAgentTurnRequest {
    +Uuid conversation_id
    +String prompt
  }

  class BackendId {
    +String backend_name
  }

  class TurnResult
  class ToolCall
  class ToolCallPayload
  class ToolCallResult
  class BackendToolPayload
  class RuntimeError
  class JsonSchema
  class Uuid

  McpToolDefinition <.. CanonicalToolDto : mapped_from
  CanonicalToolDto --> JsonSchema

  ToolDiscoveryPort --> CanonicalToolDto
  ToolDiscoveryPort --> BackendId

  AgentRuntimePort --> PreparedRuntimeTurnRequest
  AgentRuntimePort --> CanonicalToolDto
  AgentRuntimePort --> TranslationError
  AgentRuntimePort --> TurnResult
  AgentRuntimePort --> RuntimeError

  AgentTurnOrchestratorService --> ToolDiscoveryPort
  AgentTurnOrchestratorService --> AgentRuntimePort
  AgentTurnOrchestratorService --> ToolRouterPort
  AgentTurnOrchestratorService --> TurnExecutionRequest
  AgentTurnOrchestratorService --> PreparedRuntimeTurnRequest
  AgentTurnOrchestratorService --> TurnResult

  PreparedRuntimeTurnRequest --> TranslatedToolEnvelope
  TranslatedToolEnvelope --> BackendToolPayload

  TranslationError --> TranslationErrorKind

  ToolRouterPort --> ToolCallResult
  ToolRouterPort --> ToolCallPayload
Loading

Flow diagram for execution plan stages A–G

flowchart TD
  A["Stage A: establish seam and add failing tests"] --> B["Stage B: add domain and port contracts"]
  B --> C["Stage C: implement backend-specific translation in runtime adapters"]
  C --> D["Stage D: wire translation into orchestration and tool discovery"]
  D --> E["Stage E: complete full test matrix (unit, integration, BDD)"]
  E --> F["Stage F: update design docs, user guide, roadmap"]
  F --> G["Stage G: run validation gates and capture evidence"]

  subgraph TestingFocus
    A
    E
    G
  end

  subgraph DesignAndContracts
    B
    C
    D
    F
  end
Loading

File-Level Changes

Change Details Files
Introduce a detailed ExecPlan for translating canonical MCP tool schemas into backend-specific formats within the agent backend and orchestration flow.
  • Document current context and missing seam between MCP tool catalogue and backend turn orchestration.
  • Define architecture constraints to keep translation logic within agent_backend and adapters while preserving tool_registry ownership and existing routing paths.
  • Capture tolerances, risks, and progress tracking for the roadmap item 2.3.3 implementation.
  • Record key design decisions about ports, translation ownership, and failure handling.
  • Lay out a multi-stage plan (A–G) covering seam establishment, domain/port contracts, adapter implementations, orchestration wiring, full test matrix, documentation updates, and validation gates.
docs/execplans/2-3-3-translate-tool-schemas-per-backend.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant