Edburns/1810 java tool ergonomics tool as lambda seeking review#1895
Merged
edburns merged 58 commits intoJul 2, 2026
Merged
Conversation
Your branch is up to date with 'upstream/edburns/1810-java-tool-ergonomics-tool-as-lambda'. Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260628-prompts.md new file: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260629-prompts.md Signed-off-by: Ed Burns <edburns@microsoft.com>
…Phase 03. modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260629-prompts.md Signed-off-by: Ed Burns <edburns@microsoft.com>
modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md - Check off the things already done. modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260629-prompts.md - GUTDODP
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce `com.github.copilot.tool.Param<T>` — an immutable, fluent runtime parameter metadata class for inline/lambda tool definitions. Validation behavior: - Rejects blank name/description - Rejects required=true with non-empty defaultValue - Validates default values against declared Class<T> Includes comprehensive unit tests (ParamTest, 24 cases). Updates Phase 4.1 checkbox in the implementation plan.
Automates the lifecycle of a child Task issue from 'assigned to Copilot' through CI approval and review-agent feedback resolution, stopping just before marking the PR as Ready for Review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On branch edburns/1810-java-tool-ergonomics-tool-as-lambda modified: .github/skills/shepherd-task-to-ready/SKILL.md modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260630-prompts.md Signed-off-by: Ed Burns <edburns@microsoft.com>
…ix base branch - Use 'gh run rerun' instead of fork-only approve API endpoint - Ignore expected 'Block remove-before-merge paths' workflow failure - Verify and fix PR base branch after creation (Copilot may target main) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoids race condition where Copilot targets main instead of the specified base branch. Instruction is added to issue body before assignment; base branch verification remains as fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The model should not mark checklist items as complete — that is the human DRI's responsibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…to-ready Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On branch edburns/1810-java-tool-ergonomics-tool-as-lambda modified: 1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/20260630-prompts.md Signed-off-by: Ed Burns <edburns@microsoft.com>
Follow-up skill that takes a PR from Ready for Review through Copilot code review comment resolution (done locally) and merge to the specified base branch. Max 20 iterations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…2) (#1857) * Initial plan * feat(java): implement ToolDefinition.from* overloads for lambda-defined tools (Phase 4.2) Co-authored-by: edburns <75821+edburns@users.noreply.github.com> * Fix review comments: typed defaults, array items schema, primitive cast - buildSchemaFromParams: parse default values to declared type before placing in JSON schema (avoids String defaults for numeric/boolean) - schemaForClass: emit items schema for Java array types using getComponentType() for schema fidelity - coerceDefaultValue: use boxed valueOf() instead of type.cast() for primitive types to avoid ClassCastException Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 3: ToolResultObject passthrough, Optional* schema - formatResult: pass ToolResultObject through directly instead of JSON-serializing, preserving structured result semantics - schemaForClass: add OptionalInt/OptionalLong/OptionalDouble support to match compile-time SchemaGenerator behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 4: Optional* coercion in coerceArg - Return OptionalInt.empty()/OptionalLong.empty()/OptionalDouble.empty() for missing non-required params instead of null - Construct Optional*.of(...) from Number when value is present - Avoids NPE and aligns with annotation-processor behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 5: null-future guards, Optional* cast safety, @SInCE tags - All async fromAsync*/fromAsyncWithToolInvocation handlers now check for null future and return failedFuture with clear NPE message - Optional* coercion catches ClassCastException for non-numeric values and throws IllegalArgumentException with diagnostic message - Fixed @SInCE 1.0.2 -> 1.0.6 on all new API entries (15 in ToolDefinition, 1 in Param) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: edburns <75821+edburns@users.noreply.github.com> Co-authored-by: Ed Burns <edburns@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns
deleted the
edburns/1810-java-tool-ergonomics-tool-as-lambda-seeking-review
branch
July 2, 2026 22:46
This was referenced Jul 8, 2026
This was referenced Jul 16, 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.
Fixes: #1894
ADR-006: Inline tool definition with lambdas
Context and problem statement
ADR-005 introduced an ergonomic Java tools API based on
@CopilotToolmethod annotations,@CopilotToolParamparameter annotations, andToolDefinition.fromObject(...)for reflection-based tool registration. That model works well when teams define tools as methods on a class.The next ergonomics goal is an inline style comparable to C#
CopilotTool.DefineTool(...), where developers can define a tool at the call site without creating a separate tool container class.For this decision, we evaluated two alternatives:
ToolDefinition.from(tools::setCurrentPhase))ToolDefinition.from(..., phase -> ...))The key factor is metadata quality: tool name, description, parameter names, parameter descriptions, required/default semantics, and schema stability.
Considered options
Option 1: Method-reference API
Example:
In this model, metadata is sourced from existing method-level annotations (
@CopilotTool,@Param) on the referenced method.Advantages:
Drawbacks:
Option 2: Inline lambda API with explicit metadata
Example:
In this model, handler logic is inline, and metadata is provided explicitly through
Param.of(...)parameter definitions.Advantages:
-parametersDrawbacks:
Decision outcome
Chosen: Option 2 for ADR-006 scope — inline lambda API with explicit metadata.
Rationale:
ToolDefinitionconstruction and current invocation semantics.Option 1 remains valuable and can be added independently as a separate ergonomic layer. It is not blocked by this decision.
Design constraints and non-goals
Constraints for the inline lambda API:
RandCompletableFuture<R>).Stringpassthrough,voidmaps to"Success", non-string objects serialized to JSON).ToolDefinitionfields.Non-goals for this ADR:
@CopilotTool/fromObjectAPIs.Consequences
The SDK now provides an explicit inline path for developers who prefer to keep tool declarations at session creation while preserving high-quality schema metadata. Implemented API families include:
ToolDefinition.from(name, description, [params...], handler)— sync handlersToolDefinition.fromAsync(name, description, [params...], asyncHandler)— async handlers returningCompletableFuture<R>ToolDefinition.fromWithToolInvocation(...)— sync withToolInvocationcontext injectionToolDefinition.fromAsyncWithToolInvocation(...)— async withToolInvocationcontext injectionParameter metadata is defined using
Param.of(type, name, description)for required parameters andParam.of(type, name, description, required, defaultValue)for optional parameters with defaults.Fluent option modifiers (
.skipPermission(boolean),.defer(ToolDefer),.overridesBuiltInTool(boolean)) allow post-construction customization.The annotation-driven API from ADR-005 remains the recommended path for larger tool surfaces where co-locating metadata with method implementations improves maintainability. For usage examples and complete API coverage, see the Java SDK README.
Related work items
@CopilotToolergonomics #1792@CopilotToolergonomics: Define tool with lambda #1810