Skip to content

fix: Use tool_name from ToolMeta instead of Ruby class name in RubyLLM tools#17

Merged
sh1nj1 merged 1 commit into
mainfrom
fix/use-tool-name-in-ruby-llm
Feb 4, 2026
Merged

fix: Use tool_name from ToolMeta instead of Ruby class name in RubyLLM tools#17
sh1nj1 merged 1 commit into
mainfrom
fix/use-tool-name-in-ruby-llm

Conversation

@sh1nj1
Copy link
Copy Markdown
Member

@sh1nj1 sh1nj1 commented Feb 4, 2026

Problem

RubyLLM::Tool#name generates tool names from Ruby class names:

  • Tools::CreativeUpdatetools--creative_update

But ToolMeta defines explicit tool names (e.g. creative_update_service). This mismatch causes issues when external systems (like approval flows) try to look up tools by name.

Solution

Override the name method in dynamically generated RubyLLM tool classes to return the tool_name from ToolMeta schema, ensuring consistent naming.

Changes

File Change
ruby_llm_factory.rb Add define_method(:name) { tool_name } override
tool_schema_test.rb Add test verifying tool instance uses ToolMeta name

Tests

8 runs, 26 assertions, 0 failures ✅

…M tools

RubyLLM::Tool#name generates names from Ruby class names (e.g.
Tools::CreativeUpdate -> 'tools--creative_update'), which doesn't match
the tool_name defined via ToolMeta (e.g. 'creative_update_service').

Override the name method in dynamically generated tool classes to return
the original tool_name from the schema, ensuring consistent naming
across the system.
@sh1nj1 sh1nj1 merged commit d8af6d7 into main Feb 4, 2026
1 check passed
@sh1nj1 sh1nj1 deleted the fix/use-tool-name-in-ruby-llm branch February 4, 2026 02:31
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