Map session.mcp.apps.callTool result to JsonNode and harden mvn clean#1523
Merged
Conversation
The RPC method session.mcp.apps.callTool returns a free-form JSON object (schema: type=object, additionalProperties with x-opaque-json). Previously the Java codegen fell through to Void for this pattern. Fix wrapperResultClassName() to recognize free-form object schemas (type=object + additionalProperties, no properties) and map them to com.fasterxml.jackson.databind.JsonNode. Update import generation in both generateNamespaceApiFile() and generateRpcRootFile() to handle the JsonNode special case. The generated wrapper is now: CompletableFuture<JsonNode> callTool(SessionMcpAppsCallToolParams) Add 3 unit tests in RpcWrappersTest verifying: - Correct RPC method name dispatch - SessionId injection into params - JsonNode payload returned from the future Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Two independent Java SDK improvements: teach the codegen to map free-form JSON-RPC result objects to Jackson JsonNode (specifically fixing session.mcp.apps.callTool which was incorrectly typed as Void), and harden mvn clean against transient file locks on target/copilot-sdk/ left by the test harness.
Changes:
- Codegen:
wrapperResultClassName()recognizes free-form object schemas and returns"JsonNode"; namespace/root API generators add the proper Jackson import when needed. - Regenerated
SessionMcpAppsApi.callToolnow returnsCompletableFuture<JsonNode>and 3 newRpcWrappersTestcases cover method dispatch, sessionId injection, and result payload. pom.xml:default-cleanswitched tofailOnError=false, plus a newpost-clean-sweepexecution in thepost-cleanphase re-runs the clean goal to guaranteetarget/removal.
Show a summary per file
| File | Description |
|---|---|
| java/scripts/codegen/java.ts | Adds JsonNode mapping for free-form object results and adjusts import collection in namespace/root API generators. |
| java/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java | Regenerated: callTool returns CompletableFuture<JsonNode> with proper import. |
| java/src/test/java/com/github/copilot/RpcWrappersTest.java | Adds three unit tests covering callTool dispatch, sessionId injection, and JsonNode payload resolution. |
| java/pom.xml | Splits maven-clean-plugin into a tolerant default-clean and a follow-up post-clean-sweep execution to absorb transient file locks. |
Copilot's findings
- Files reviewed: 3/4 changed files
- Comments generated: 0
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.
Two independent improvements to the Java SDK:
Fix
session.mcp.apps.callToolreturn type — The RPC method returns a free-form JSON object but Java codegen was mapping it toVoid. This change teaches the codegen to recognize free-form object schemas and map them toJsonNode.Make
mvn cleanresilient to external file locks — External processes (VS Code language servers, orphaned Node.js test-harness processes) can hold file descriptors ontarget/copilot-sdk/just long enough to causemvn cleanto fail. A two-phase clean strategy ensurestarget/is fully removed.Changes
Codegen: free-form object →
JsonNodemappingjava/scripts/codegen/java.tswrapperResultClassName()now recognizes free-form object schemas (type=object+additionalProperties, noproperties) and returns"JsonNode"instead of falling through toVoid.generateNamespaceApiFile()andgenerateRpcRootFile()importcom.fasterxml.jackson.databind.JsonNodewhen any method in the namespace uses theJsonNoderesult type.java/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java(regenerated)callTool()now returnsCompletableFuture<JsonNode>instead ofCompletableFuture<Void>.java/src/test/java/com/github/copilot/RpcWrappersTest.javaStubCallerpattern:sessionRpc_mcp_apps_callTool_invokes_correct_rpc_method()— verifies method name dispatchsessionRpc_mcp_apps_callTool_injects_sessionId()— verifies sessionId is injected into paramssessionRpc_mcp_apps_callTool_returns_jsonNode_payload()— verifies the future resolves to aJsonNodewith expected contentBuild: harden
mvn cleanjava/pom.xmldefault-cleanexecution: setfailOnError=falseso transient file locks don't fail the build.post-clean-sweepexecution inpost-cleanphase: retries deletion after the transient locks have cleared, ensuringtarget/is fully removed.retryCountparameter.Test results
All 1684 unit tests pass on both JDK 25 and JDK 17. All 6 integration tests (5 SlashCommandsIT + 1 InternalExecutorProviderIT) pass. Zero failures, zero errors.
Commits
bfdce49c— java: map session.mcp.apps.callTool result to JsonNode7206e842— Ensure lingering content from test harness approach does not remain after mvn cleane391d6af— Ensure lingering content from test harness approach does not remain after mvn clean