Repository navigation
fix: use object output schema for Kubescape vulnerability details - #101
Merged
Merged
Conversation
Signed-off-by: Benjamin Huo <benjamin@kubesphere.io>
benjaminhuo
force-pushed
the
fix/object-output-schema
branch
from
November 11, 2026 15:09
fbf5acf to
b2e4dfa
Compare
dimetron
approved these changes
Nov 11, 2026
dimetron
left a comment
Collaborator
There was a problem hiding this comment.
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
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
kubescape_get_vulnerability_detailscurrently returns[]v1beta1.Matchas its typed output, which generates anoutputSchema.typeof["null", "array"].MCP clients expecting an object-rooted output schema reject the entire
tools/listresponse, 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 fmtmake lint— zero issuesmake test-only— all unit tests passedThe full
make testtarget stopped after the Linux amd64 build becausesha256sumis unavailable on the macOS development host; lint and unit tests were run separately.