Skip to content

fix: Resolve RubyLLM tool names to McpTool names for approval matching#714

Closed
sh1nj1 wants to merge 1 commit into
mainfrom
fix/tool-approval-name-resolution
Closed

fix: Resolve RubyLLM tool names to McpTool names for approval matching#714
sh1nj1 wants to merge 1 commit into
mainfrom
fix/tool-approval-name-resolution

Conversation

@sh1nj1
Copy link
Copy Markdown
Owner

@sh1nj1 sh1nj1 commented Feb 4, 2026

Problem

RubyLLM generates tool names from Ruby class names using its own naming convention:

  • Tools::CreativeUpdatetools--creative_update

But McpTool stores the original tool_name from ToolMeta:

  • creative_update_service

This name mismatch meant check_tool_approval! could never find the matching McpTool record, so approval was never triggered.

Solution

  • Add resolve_mcp_tool_name() to AiClient that builds a mapping from RubyLLM tool names to McpTool names via the ToolMeta registry
  • Pass the resolved mcp_tool_name through ApprovalPendingError so Task and approval Comment store the correct name
  • ActionExecutor already uses the stored name, so resume-after-approval works correctly

Changes

File Change
ai_client.rb Add resolve_mcp_tool_name + build_tool_name_map, use resolved name in check_tool_approval!
approval_pending_error.rb Accept mcp_tool_name: kwarg, prefer it over tool_call.name
ai_client_test.rb Add 3 tests for name resolution + approval check

Tests

778 runs, 0 failures, 0 errors ✅

RubyLLM generates tool names from Ruby class names (e.g. Tools::CreativeUpdate
-> 'tools--creative_update'), but McpTool stores the original tool_name from
ToolMeta (e.g. 'creative_update_service'). This mismatch prevented the approval
check from finding the correct McpTool record.

- Add resolve_mcp_tool_name() to AiClient that maps RubyLLM names to McpTool
  names via the ToolMeta registry
- Pass resolved mcp_tool_name through ApprovalPendingError so Task and Comment
  store the correct name for ActionExecutor to match on resume
- Add tests for name resolution and approval check
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sh1nj1
Copy link
Copy Markdown
Owner Author

sh1nj1 commented Feb 4, 2026

Closed: root cause fixed in rails_mcp_engine v0.4.2 (PR vrerv/rails_mcp_engine#17). The gem now uses tool_name from ToolMeta instead of Ruby class name, so the workaround in Collavre is no longer needed.

@sh1nj1 sh1nj1 closed this Feb 4, 2026
@sh1nj1 sh1nj1 deleted the fix/tool-approval-name-resolution branch February 4, 2026 13:43
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