bug: tools with dashes in their name
#22
by
koushd
- opened
Tools/functions with dashes in the name causes Kimi k2 and Kimi K2.5 to both attempt to make the tool call, and then immediately fail with no tool call returned in the actual body.
Hi @koushd ,
I've submitted PR #34 that addresses this issue. The fix sanitizes tool names by replacing dashes with underscores before generating TypeScript declarations.
Root cause: The file generates TypeScript interfaces where function names with dashes (e.g., read-file) are invalid identifiers.
Fix: Added sanitization in sanitize_tool_name() function:
def sanitize_tool_name(name: str) -> str:
# Replace dashes with underscores for valid TS identifiers
return name.replace('-', '_')
This ensures tools like read-file become read_file in the generated TypeScript output while preserving the original name in the actual tool call.
PR: https://huggingface.co/moonshotai/Kimi-K2.5/discussions/34
This comment has been hidden (marked as Spam)