Skip to content

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Nov 18, 2025

Fixes #2650

Summary

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:

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

To standard JSON Schema:

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
  • Bump operator-crds Helm chart from 0.0.59 to 0.0.60
  • Update all tests and documentation

Test plan

  • All existing tests pass
  • Linting passes (0 issues)
  • Updated tests to use new JSON Schema format
  • Validated error messages match new validation logic

🤖 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 63.41463% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.28%. Comparing base (315158c) to head (95d49b8).

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   55.21%   55.28%   +0.07%     
==========================================
  Files         315      315              
  Lines       30123    30110      -13     
==========================================
+ Hits        16632    16647      +15     
+ Misses      12047    12011      -36     
- Partials     1444     1452       +8     

☔ 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.

```console
helm uninstall <release_name>
```

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not expected this file go mangled is it?

description: "Deploy PR with user confirmation and notification"
parameters:
pr_number: {type: "integer"}
type: object
Copy link
Contributor

Choose a reason for hiding this comment

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

hah, this is probably tripping CI..good on you to change the proposal retroactively. We might need to override CI this time

if crdTool.Parameters != nil && len(crdTool.Parameters.Raw) > 0 {
var params map[string]any
if err := json.Unmarshal(crdTool.Parameters.Raw, &params); err == nil {
tool.Parameters = params
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it expected the error is ignored?

Copy link
Contributor

Choose a reason for hiding this comment

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

related: we should probably have a unit test for this

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 and others added 2 commits November 19, 2025 06:36
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>
- Fix operator-crds README.md that was accidentally emptied
- Add comprehensive unit tests for composite tool parameter conversion
- Improve error handling documentation in converter.go
- Bump toolhive-operator Helm chart version from 0.5.2 to 0.5.3
- Update all documentation to use standard JSON Schema format for parameters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@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
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

// },
// "required": ["param2"]
// }
Parameters map[string]any `json:"parameters,omitempty"`
Copy link
Contributor

@tgrunnagle tgrunnagle Nov 19, 2025

Choose a reason for hiding this comment

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

Is it possible to have strong typing with something like

...
  Parameters map[string]ParameterEntry `json:"parameters,omitempty"`
...

type ParameterEntry struct {
  Type string `json:type`
  Description string `json:description`
  Properties map[string]ParameterEntry `json:properties,omitempty` // optional, used with type == object

}

// Type should be "object" for parameter schemas
if typeStr != "object" {
Copy link
Contributor

@tgrunnagle tgrunnagle Nov 19, 2025

Choose a reason for hiding this comment

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

My understanding is that we want to support non-object top level parameters? Maybe I'm confused https://stacklok.slack.com/archives/C09L9QF47EU/p1763562651723149?thread_ts=1763507520.825579&cid=C09L9QF47EU

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.

VMCP composite tool parameters should use standard JSON Schema format

4 participants