Skip to content

fix: use object output schema for Kubescape vulnerability details - #101

Merged
dimetron merged 1 commit into
kagent-dev:mainfrom
benjaminhuo:fix/object-output-schema
Nov 11, 2026
Merged

dimetron merged 1 commit into
kagent-dev:mainfrom
benjaminhuo:fix/object-output-schema

Conversation

@benjaminhuo

Copy link
Copy Markdown
Contributor

kubescape_get_vulnerability_details currently returns []v1beta1.Match as its typed output, which generates an outputSchema.type of ["null", "array"].

MCP clients expecting an object-rooted output schema reject the entire tools/list response, making all tools from the server unavailable. This was reproduced with the DSH MCP client.

This change wraps the structured output in {"matches": [...]}, producing an object-rooted output schema. It preserves the existing array-shaped text content and tool error behavior.

Regression tests check object-rooted input/output schemas across all registered tools and exercise the affected tool through MCP calls, covering successful responses, missing arguments, missing resources, and initialization failures. The schema regression test fails against the original v0.3.0 implementation and passes with this fix.

Validation:

  • make fmt
  • make lint — zero issues
  • make test-only — all unit tests passed
  • Linux amd64 build passed

The full make test target stopped after the Linux amd64 build because sha256sum is unavailable on the macOS development host; lint and unit tests were run separately.

Signed-off-by: Benjamin Huo <benjamin@kubesphere.io>
@benjaminhuo
benjaminhuo force-pushed the fix/object-output-schema branch from fbf5acf to b2e4dfa Compare November 11, 2026 15:09

@dimetron dimetron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Object-rooted output schema fixes the tools/list rejection, and the new schema test guards all tools. Nits (non-blocking): note the structuredContent shape change in release notes; error paths could return the zero-value output; consider adding the object-root rule to AGENTS.md output-schema pitfalls.

@dimetron
dimetron merged commit 1872cf4 into kagent-dev:main Nov 11, 2026
6 checks passed
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.

2 participants