Skip to content

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Nov 18, 2025

Fixes #2650
Fixes #2775

Summary

Changes composite tool parameter definitions to use standard JSON Schema format per the MCP specification, instead of a non-standard simplified format.

This also resolves the field mismatch between ParameterSpec (CRD) and ParameterSchema (implementation) documented in #2775. By moving to standard JSON Schema format with map[string]any, all JSON Schema fields (description, required, default, etc.) are now supported automatically without needing separate struct fields.

Large PR Justification

This PR exceeds 1000 lines due to the combination of:

  1. Breaking schema format change - Migrating from a custom parameter format to standard JSON Schema requires updating multiple layers (CRDs, config types, converters, yaml loaders)
  2. Comprehensive test coverage - Added extensive tests to verify the new JSON Schema format works end-to-end, including explicit test cases for issue Align ParameterSpec and ParameterSchema fields between CRD and implementation #2775 (verifying description, default, required field preservation)
  3. Documentation updates - Multiple docs needed updates to reflect the new schema format
  4. Generated code - CRD changes require regenerating deepcopy functions and manifests

The changes are tightly coupled and cannot be safely split - a partial migration would leave the system in an inconsistent state where some components expect the old format and others expect JSON Schema.

Breaking Change

Composite tool parameter format has changed from:

parameters: param1: type: "string" default: "value"

To standard JSON Schema:

parameters: type: object properties: param1: type: string description: "Parameter description" default: "value" required: ["param1"]

Changes

  • Update CompositeToolConfig.Parameters to map[string]any (full JSON Schema)
  • Remove ParameterSchema struct from implementation (fixes Align ParameterSpec and ParameterSchema fields between CRD and implementation #2775)
  • Remove ParameterSpec type from CRD, replaced with runtime.RawExtension
  • Remove parameter transformation logic from yaml_loader and workflow_converter
  • Add JSON Schema validation in yaml_loader (checks type: object)
  • Update Kubernetes CRDs to use runtime.RawExtension for parameters
  • Update webhook validation to handle runtime.RawExtension
  • Regenerate CRD manifests and deepcopy code
  • Bump operator-crds Helm chart from 0.0.59 to 0.0.60
  • Update all tests and documentation
  • Add converter test cases verifying Align ParameterSpec and ParameterSchema fields between CRD and implementation #2775 fields are preserved
  • Add capability adapter test verifying fields reach MCP clients

Test plan

🤖 Generated with Claude Code

@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from 3b5b3da to b88bc23 Compare November 18, 2025 23:23
@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.45%. Comparing base (4e36464) to head (e32b8d4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/config/yaml_loader.go 65.21% 5 Missing and 3 partials ⚠️
...lpha1/virtualmcpcompositetooldefinition_webhook.go 46.15% 3 Missing and 4 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## main #2651 +/- ## ========================================== + Coverage 56.34% 56.45% +0.11%  ========================================== Files 319 319 Lines 30887 30878 -9 ========================================== + Hits 17402 17431 +29  + Misses 11999 11948 -51  - Partials 1486 1499 +13 

☔ 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.
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I added some nits. Only because I was reviewing the docs earlier this week do I know that we in fact have docs (docs/operator/advanced-workflow-patterns.md and docs/operator/virtualmcpcompositetooldefinition-guide.md) that @tgrunnagle wrote, thos should probably be updated as well

@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from b88bc23 to 95d49b8 Compare November 19, 2025 12:57
@JAORMX JAORMX requested a review from jhrozek November 19, 2025 13:02
jhrozek
jhrozek previously approved these changes Nov 19, 2025
tgrunnagle
tgrunnagle previously approved these changes Nov 19, 2025
Copy link
Contributor

@tgrunnagle tgrunnagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions but non-blocking

@JAORMX JAORMX dismissed stale reviews from tgrunnagle and jhrozek via c9e1a4c November 27, 2025 17:53
@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from 95d49b8 to c9e1a4c Compare November 27, 2025 17:53
@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Nov 27, 2025
@JAORMX
Copy link
Collaborator Author

JAORMX commented Nov 27, 2025

Thanks for the review @tgrunnagle!

Regarding your questions:

Strong typing for Parameters (config.go)
We use map[string]any rather than a typed struct because JSON Schema is highly flexible with many optional fields (default, enum, minimum, maximum, pattern, items, additionalProperties, oneOf, anyOf, allOf, etc.). Using map[string]any allows full JSON Schema compatibility without needing to define every possible field, and matches how the MCP SDK handles inputSchema. I've added a code comment explaining this rationale.

Non-object top level parameters (yaml_loader.go)
We enforce type="object" because MCP tools use named parameters (inputSchema.properties), and non-object types (e.g., type="string") would mean a tool takes a single unnamed value, which doesn't align with how MCP tool arguments work. The MCP SDK and specification expect tools to have named parameters accessible via inputSchema.properties. I've added a code comment explaining this as well.

@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from c9e1a4c to 60bdf08 Compare November 27, 2025 17:55
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Nov 27, 2025
@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from 60bdf08 to 392701a Compare November 27, 2025 18:00
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/L Large PR: 600-999 lines changed labels Nov 27, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification [Explain why this PR must be large, such as:] - Generated code that cannot be split - Large refactoring that must be atomic - Multiple related changes that would break if separated - Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

Fixes #2650 Changes composite tool parameter definitions to use standard JSON Schema format per the MCP specification, instead of a non-standard simplified format. **Breaking Change**: Composite tool parameter format has changed from: ```yaml parameters: param1: type: "string" default: "value" ``` To standard JSON Schema: ```yaml parameters: type: object properties: param1: type: string default: "value" required: ["param1"] ``` Changes: - Update CompositeToolConfig.Parameters to map[string]any (full JSON Schema) - Remove parameter transformation logic from yaml_loader and workflow_converter - Add JSON Schema validation in yaml_loader (checks type: object) - Update Kubernetes CRDs to use runtime.RawExtension for parameters - Update webhook validation to handle runtime.RawExtension - Regenerate CRD manifests and deepcopy code - Update all tests and documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
@JAORMX JAORMX force-pushed the fix-vmcp-composite-tool-parameters-json-schema branch from 392701a to 70b7945 Compare November 27, 2025 18:00
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Nov 27, 2025
@JAORMX JAORMX dismissed github-actions[bot]’s stale review November 27, 2025 18:02

it's no longer as big as it used to be

Add explicit test case to converter_test.go that verifies description and default fields at the parameter property level are correctly preserved when using JSON Schema format. This test documents that issue #2775 (field mismatch between ParameterSpec and ParameterSchema) is resolved by the JSON Schema approach, which supports all JSON Schema fields automatically. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Nov 27, 2025
Add explicit test cases verifying that JSON Schema fields (description, default, required) are preserved throughout the entire conversion chain: 1. converter_test.go: Tests CRD → config conversion preserves fields 2. capability_adapter_test.go: Tests config → MCP SDK conversion preserves fields These tests document that issue #2775 (field mismatch between ParameterSpec and ParameterSchema) is fully resolved by the JSON Schema approach, which passes the entire schema through without any field stripping. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Nov 27, 2025
@JAORMX JAORMX merged commit b97646b into main Nov 27, 2025
39 of 40 checks passed
@JAORMX JAORMX deleted the fix-vmcp-composite-tool-parameters-json-schema branch November 27, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

4 participants