Skip to content

VirtualMCPServer: Add tool execution trace output for composite tools #2936

@aponcedeleonch

Description

@aponcedeleonch

Description

When using VirtualMCPServer with composite tools that execute multiple backend tool calls in sequence, developers currently have limited visibility into which specific tools were invoked during execution. This makes debugging and auditing composite tool workflows challenging.

Current Behavior

When a composite tool executes:

  • Multiple backend MCP tools are called sequentially based on the workflow steps
  • Step outputs are used internally for template variable expansion (e.g., {{.steps.step_id.output}})
  • The final response is returned to the client
  • No information about the internal tool execution flow is exposed to the caller

Desired Behavior

VirtualMCPServer should provide an optional output that includes execution trace information showing:

  • Which backend tools were called during the composite tool execution
  • The order of execution
  • Step IDs and their corresponding tool invocations
  • Any relevant execution metadata (timing, status, etc.)

This trace information would be invaluable for:

  • Debugging: Understanding why a composite tool produced unexpected results
  • Development: Validating that workflow steps execute as intended
  • Auditing: Tracking which backend services were accessed during a request

Suggested Implementation

Add a debug flag or configuration option (e.g., include_execution_trace: true) that when enabled, includes execution trace metadata in the tool response. This could be:

  • An additional field in the response payload
  • Part of the tool metadata
  • Configurable at the VirtualMCPServer CRD level or per-request

Example response structure:

{
  "result": "...",
  "execution_trace": [
    {"step_id": "fetch_data", "tool": "backend1.fetch_api", "status": "success", "parameters": {...}},
    {"step_id": "process", "tool": "backend2.transform", "status": "success", "parameters": {...}}
  ]
}

Related Issues

This issue complements but differs from existing observability work:

This proposal differs by providing client-visible execution traces specifically for development and debugging purposes. While #2849 and #2850 focus on backend observability and compliance, this feature would give developers immediate feedback about composite tool execution in the tool response itself.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestkubernetesItems related to KubernetestelemetryvmcpVirtual MCP Server related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions