Skip to content

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

Description

@edburns

Overview

Implement Phase 4.1 of #1810: add the public API types needed to define tools inline with lambdas.

Before coding

  • Do not start any implementation work until this issue is explicitly assigned to the coding agent.
  • Base branch for this work: edburns/1810-java-tool-ergonomics-tool-as-lambda.
  • Read this plan file on the branch before coding:
    1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md

Ordering rule (important)

Issues for Phase 4 are resolved strictly in plan order (4.1, then 4.2, ...). Each issue is merged to edburns/1810-java-tool-ergonomics-tool-as-lambda before the next one starts.

Relevant Phase 3 resolutions to apply

  • 3.1 API shape: v1 sync/async families are from, fromAsync, plus context-aware fromWithToolInvocation / fromAsyncWithToolInvocation.
  • 3.2 functional interfaces: use JDK functional interfaces (Supplier/Function/BiFunction), no custom SAM interfaces in v1.
  • 3.3 parameter DSL: use runtime metadata class Param<T> with fluent API and validation.
  • 3.8 package placement: user-facing helper types belong in com.github.copilot.tool; avoid leaking internal helper types.

Scope / deliverables

  1. Add/finish public API type(s) under java/src/main/java/com/github/copilot/tool/ required by lambda tool definitions, including Param<T>.
  2. Ensure the API is discoverable and unambiguous at call sites.
  3. Ensure module exports/public surface remain minimal and user-facing only.

Validation and behavior requirements

  • Param rejects blank name/description.
  • required=true with non-empty default is rejected.
  • default values are validated against declared Class<T>.
  • Public signatures compile cleanly and are ready for Phase 4.2 overload implementation.

Constraints

  • Keep changes focused to this sub-item only.
  • Follow existing Java style and public API documentation conventions.

Completion bookkeeping

When complete, update the checkbox for Phase 4.1 in:
1810-java-tool-ergonomics-tool-as-lambda-remove-before-merge/1810-ignorance-reduction-for-implementation-plan.md

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions