Skip to content

Conversation

@jerm-dro
Copy link
Contributor

@jerm-dro jerm-dro commented Dec 12, 2025

Stacked on #3006 because of when I discovered this gap.

Summary

  • Fix issue where composite tool steps could not access nested fields from backend tool responses
  • Backend HTTP client now checks for StructuredContent before falling back to Content array processing (legacy behavior)
  • Add integration tests for structured content access and nested defaultResults
  • Document step output format and numeric comparison behavior
  • I slightly deviated from the solution proposed in 2994, because I felt namespacing all data behind structuredContent would be verbose/clunky. It also does not match much of the existing documentation.

Fixes #2994

Changes

Core Fix (pkg/vmcp/client/client.go):

  • Check result.StructuredContent before processing result.Content array
  • If StructuredContent is an object (map[string]any), use it directly as step output
  • Fall back to existing Content processing for text/image content

Test Helpers (test/integration/vmcp/helpers/backend.go):

  • Add StructuredHandler field to BackendTool for structured content responses
  • Add NewBackendToolWithStructuredResponse() constructor
  • Update CreateBackendServer to use mcp.NewToolResultStructuredOnly() when appropriate

Integration Tests (test/integration/vmcp/vmcp_integration_test.go):

  • TestVMCPServer_StructuredContent: Tests nested field access via {{.steps.X.output.field.nested}}
  • TestVMCPServer_DefaultResults_NestedStructure: Tests nested defaultResults fallback

Documentation:

  • docs/operator/virtualmcpcompositetooldefinition-guide.md: Added "Step Output Format" and "Numeric Values in Templates" sections
  • docs/operator/advanced-workflow-patterns.md: Added "Step Output Format" and "Numeric Comparisons" sections

Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Dec 12, 2025
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.40%. Comparing base (a748373) to head (2fcadb4).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
test/integration/vmcp/helpers/backend.go 0.00% 12 Missing ⚠️
pkg/vmcp/client/client.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3009      +/-   ##
==========================================
- Coverage   56.43%   56.40%   -0.03%     
==========================================
  Files         333      333              
  Lines       33001    33019      +18     
==========================================
+ Hits        18623    18626       +3     
- Misses      12796    12811      +15     
  Partials     1582     1582              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
Base automatically changed from jerm/composite-tools-default-results to main December 12, 2025 16:26
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
Signed-off-by: Jeremy Drouillard <jeremy@stacklok.com>
@github-actions github-actions bot removed the size/M Medium PR: 300-599 lines changed label Dec 12, 2025
@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Dec 12, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
@jerm-dro jerm-dro marked this pull request as ready for review December 12, 2025 18:05
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 12, 2025
@jerm-dro
Copy link
Contributor Author

Tests seems stubbornly flaky on this branch. I'm going to debug on this stacked branch:

#3028

I'll wait to merge this branch until I'm convinced it's not increasing the flakiness.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 14, 2025
@jerm-dro jerm-dro merged commit 027b1d6 into main Dec 15, 2025
37 checks passed
@jerm-dro jerm-dro deleted the jerm/support-structured-content branch December 15, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composite Tools: Support references to structured tool responses

4 participants