Skip to content

Commit 3f4291f

Browse files
committed
fix: implement case-insensitive tool lookup in registry
- Fixes MCP tool name resolution issues - Tools can now be called with any case variation - Tries exact match first, then case-insensitive fallback - Resolves GET_ACCOUNT_TRANSACTIONS vs getSignaturesForAddress conflicts - All nested structure tests now pass successfully
1 parent bcc9e98 commit 3f4291f

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

crates/ovsm/src/tools/mod.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,25 @@ impl ToolRegistry {
124124
self.tools.insert(name, Arc::new(tool));
125125
}
126126

127-
/// Get tool by name
127+
/// Get tool by name (case-insensitive fallback)
128128
pub fn get(&self, name: &str) -> Result<Arc<dyn Tool>> {
129-
self.tools
130-
.get(name)
131-
.cloned()
132-
.ok_or_else(|| crate::error::Error::UndefinedTool {
133-
name: name.to_string(),
134-
})
129+
// Try exact match first
130+
if let Some(tool) = self.tools.get(name) {
131+
return Ok(tool.clone());
132+
}
133+
134+
// Try case-insensitive match
135+
let name_lower = name.to_lowercase();
136+
for (key, tool) in &self.tools {
137+
if key.to_lowercase() == name_lower {
138+
return Ok(tool.clone());
139+
}
140+
}
141+
142+
// No match found
143+
Err(crate::error::Error::UndefinedTool {
144+
name: name.to_string(),
145+
})
135146
}
136147

137148
/// Check if tool exists

0 commit comments

Comments
 (0)