Skip to content

[Java] Add Param<T> public API type for lambda-defined tools#1845

Draft
Copilot wants to merge 3 commits into
edburns/1810-java-tool-ergonomics-tool-as-lambdafrom
copilot/edburns1810-java-tool-ergonomics-tool-as-lambda
Draft

[Java] Add Param<T> public API type for lambda-defined tools#1845
Copilot wants to merge 3 commits into
edburns/1810-java-tool-ergonomics-tool-as-lambdafrom
copilot/edburns1810-java-tool-ergonomics-tool-as-lambda

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Phase 4.1 of #1810: introduces the runtime parameter metadata class needed by the upcoming ToolDefinition.from(...) lambda overloads.

Changes

  • Param<T> (com.github.copilot.tool) — immutable, fluent parameter descriptor with construction-time validation:
    • Rejects blank name/description
    • Rejects required=true combined with a non-empty defaultValue
    • Validates defaultValue against declared Class<T> (String, numeric primitives/boxed, Boolean, enums; unsupported types throw)
  • ParamTest — 27 unit tests covering factory methods, fluent mutators, all validation rules, and equality semantics
  • Plan file — Phase 4.1 checkbox marked complete

Usage

// Required param, no default
Param<String> query = Param.of(String.class, "query", "Search query text");

// Optional param with validated default
Param<Integer> limit = Param.of(Integer.class, "limit", "Max results", false, "10");

// Fluent mutation (returns new instance)
Param<String> renamed = query.name("search_query");
Param<String> optional = query.defaultValue("*"); // implicitly sets required=false

No changes to module-info.java needed — com.github.copilot.tool is already exported.

Copilot AI added 2 commits June 30, 2026 00:50
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.
Copilot AI changed the title [WIP] Add public API types for lambda-defined tools [Java] Add Param<T> public API type for lambda-defined tools Jun 30, 2026
Copilot AI requested a review from edburns June 30, 2026 00:53
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.

[Java] Tool-as-lambda 4.1: Add public API types for lambda-defined tools

2 participants