Add McpActionBuilder class - #1716
Open
guidorc wants to merge 4 commits into
Open
Conversation
guidorc
marked this pull request as ready for review
August 31, 2026 23:11
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.
Summary
Implements
McpActionBuilder, which converts MCP tool's inputSchema into a structuredObjectGeneaction gene. This replaces the previous placeholder that created an empty ObjectGene("input", emptyList()) for every tool, so MCP tool-call actions now expose their real, typed arguments to the search.The builder reuses existing
RestActionBuilderV3by first converting the tool's JSON Schema into OpenAPI Schema Objects.Changes
JsonSchemaToOpenApiConverter: converts an MCP tool's JSON Schema (2020-12 dialect, the MCP default) into a flat map of OpenAPI 3.1 Schema Objects.RestActionBuilderV3.createGeneForDTOs: aJsonNodeentry point that builds a gene from a set of related schemas.McpActionBuilder: builds oneMcpToolCallActionper tool, registers it in the action cluster, and accumulates warnings for unsupported schema constructs.McpSampler.discoverTools(): now delegates toMcpActionBuilder.addActionsFromToolList(...)instead of the placeholder loop; logs any conversion warnings. Also tracks each tool's declaredoutputSchema.McpBlackBoxFitness: replaces the hand-rolled gene→map walker (geneToMap/extractGeneValue) with getValueAsPrintableString(JSON) + a single Jackson parse to build the tools/call arguments object.McpDTOs: addsoutputSchematoMcpToolDefinition, and addsMcpProtocolError(mirroring the JSON-RPC 2.0 error object) plus protocolError fields on tool/resource results.