Skip to content

Commit cf88dcf

Browse files
edburnsCopilot
andauthored
Add ADR-005: Ergonomic tool definition via annotation processor (#1684)
Introduces an Architecture Decision Record documenting the plan to add a langchain4j-style annotation-on-method API for defining Copilot tools in Java. ## Problem The current `ToolDefinition.create()` API requires manually constructing JSON Schema parameter objects—verbose and error-prone compared to the ergonomic patterns available in other Java AI frameworks (langchain4j `@Tool`/`@P`, Spring AI `@Tool`/`@ToolParam`). ## Decision Adopt Option 3 (annotation-on-method) with a JSR 269 annotation processor: - `@CopilotTool` on methods defines tools; method name → tool name, Javadoc/annotation attribute → description. - `@Param` on parameters provides descriptions and constraints; the processor reads source-level parameter names at compile time, eliminating the need for the `-parameters` javac flag. - A compile-time annotation processor generates `ToolDefinition` instances and JSON Schema from annotated methods—no runtime reflection required. - The new API surface is gated behind `@CopilotExperimental` (ADR-004) until stabilized. - The existing `ToolDefinition.create()` / `CopilotTools.define()` APIs remain unchanged and fully supported. ## Scope This ADR captures the design decision only. Implementation will follow in a separate PR tracked by #1682. Related: #1682 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent edb5f7a commit cf88dcf

1 file changed

File tree

java/docs/adr/adr-005-tool-definition.md

Whitespace-only changes.

0 commit comments

Comments
 (0)