Skip to content

feat(#1016): Skill.tools(...) accepts typed Tool<*, *> handles#42

Merged
Skobeltsyn merged 1 commit intomainfrom
feat/1016-typed-skill-tools-refs
May 5, 2026
Merged

feat(#1016): Skill.tools(...) accepts typed Tool<*, *> handles#42
Skobeltsyn merged 1 commit intomainfrom
feat/1016-typed-skill-tools-refs

Conversation

@Skobeltsyn
Copy link
Copy Markdown
Contributor

Add typed overload Skill.tools(first: Tool<*, *>, vararg rest: Tool<*, *>) alongside the existing tools(vararg names: String). Skills authored with typed refs catch tool typos at compile time rather than at agent validate(). Both forms produce identical Skill.toolNames and dispatch identically through the agentic loop — the string overload stays (deprecation deferred to #1017).

Disambiguation: typed overload requires at least one ref so tools() (empty) still resolves to the legacy string-vararg form. Mixed forms (some strings, some refs) are not supported — pick one per skill.

Drop @JvmInline from Tool — Kotlin prohibits vararg of value-class types, and Skill.tools(vararg refs) is the primary use site. Tool handles are constructed once per agent build, never on the hot path; per-handle allocation is negligible.

Add typed overload `Skill.tools(first: Tool<*, *>, vararg rest: Tool<*, *>)`
alongside the existing `tools(vararg names: String)`. Skills authored with
typed refs catch tool typos at compile time rather than at agent
`validate()`. Both forms produce identical `Skill.toolNames` and dispatch
identically through the agentic loop — the string overload stays
(deprecation deferred to #1017).

Disambiguation: typed overload requires at least one ref so `tools()`
(empty) still resolves to the legacy string-vararg form. Mixed forms
(some strings, some refs) are not supported — pick one per skill.

Drop `@JvmInline` from Tool — Kotlin prohibits vararg of value-class types,
and `Skill.tools(vararg refs)` is the primary use site. Tool handles are
constructed once per agent build, never on the hot path; per-handle
allocation is negligible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Skobeltsyn Skobeltsyn merged commit c200747 into main May 5, 2026
3 checks passed
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.

1 participant