Skip to content

Map session.mcp.apps.callTool result to JsonNode and harden mvn clean#1523

Merged
edburns merged 3 commits into
mainfrom
edburns/mcp-apps-call-tool-gap
May 31, 2026
Merged

Map session.mcp.apps.callTool result to JsonNode and harden mvn clean#1523
edburns merged 3 commits into
mainfrom
edburns/mcp-apps-call-tool-gap

Conversation

@edburns
Copy link
Copy Markdown
Collaborator

@edburns edburns commented May 31, 2026

Two independent improvements to the Java SDK:

  1. Fix session.mcp.apps.callTool return type — The RPC method returns a free-form JSON object but Java codegen was mapping it to Void. This change teaches the codegen to recognize free-form object schemas and map them to JsonNode.

  2. Make mvn clean resilient to external file locks — External processes (VS Code language servers, orphaned Node.js test-harness processes) can hold file descriptors on target/copilot-sdk/ just long enough to cause mvn clean to fail. A two-phase clean strategy ensures target/ is fully removed.

Changes

Codegen: free-form object → JsonNode mapping

java/scripts/codegen/java.ts

  • wrapperResultClassName() now recognizes free-form object schemas (type=object + additionalProperties, no properties) and returns "JsonNode" instead of falling through to Void.
  • generateNamespaceApiFile() and generateRpcRootFile() import com.fasterxml.jackson.databind.JsonNode when any method in the namespace uses the JsonNode result type.

java/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java (regenerated)

  • callTool() now returns CompletableFuture<JsonNode> instead of CompletableFuture<Void>.

java/src/test/java/com/github/copilot/RpcWrappersTest.java

  • 3 new unit tests using the existing StubCaller pattern:
    • sessionRpc_mcp_apps_callTool_invokes_correct_rpc_method() — verifies method name dispatch
    • sessionRpc_mcp_apps_callTool_injects_sessionId() — verifies sessionId is injected into params
    • sessionRpc_mcp_apps_callTool_returns_jsonNode_payload() — verifies the future resolves to a JsonNode with expected content

Build: harden mvn clean

java/pom.xml

  • default-clean execution: set failOnError=false so transient file locks don't fail the build.
  • New post-clean-sweep execution in post-clean phase: retries deletion after the transient locks have cleared, ensuring target/ is fully removed.
  • Removed stale comment referencing nonexistent retryCount parameter.

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 JsonNode
  • 7206e842 — Ensure lingering content from test harness approach does not remain after mvn clean
  • e391d6af — Ensure lingering content from test harness approach does not remain after mvn clean

edburns and others added 3 commits May 31, 2026 03:13
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>
@edburns edburns requested a review from a team as a code owner May 31, 2026 18:12
Copilot AI review requested due to automatic review settings May 31, 2026 18:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.callTool now returns CompletableFuture<JsonNode> and 3 new RpcWrappersTest cases cover method dispatch, sessionId injection, and result payload.
  • pom.xml: default-clean switched to failOnError=false, plus a new post-clean-sweep execution in the post-clean phase re-runs the clean goal to guarantee target/ 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

@edburns edburns merged commit 2afd529 into main May 31, 2026
24 checks passed
@edburns edburns deleted the edburns/mcp-apps-call-tool-gap branch May 31, 2026 18:21
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