Skip to main content

Module tool_normalize

Module tool_normalize 

Source
Expand description

Tool name normalization — maps model-emitted variants to canonical PascalCase. Tool name normalization — maps model-emitted variants to canonical PascalCase.

Models sometimes emit tool names in lowercase (list, read) or snake_case (list_files, read_file) instead of the canonical PascalCase (List, Read). This module provides a single normalization point at the API boundary so all downstream code (dispatch, approval, loop guard, undo) sees canonical names.

§Design

  • Normalization is applied once, in inference.rs, after collecting the streamed response — before dispatch, approval, or persistence.
  • Unknown names pass through unchanged so the dispatcher can surface a clear Unknown tool error.
  • The alias map covers lowercase, snake_case, and camelCase variants.

See: https://github.com/lijunzh/koda/issues/548 https://github.com/lijunzh/koda/issues/49

Functions§

normalize_tool_calls
Normalize all tool calls in a batch.
normalize_tool_name
Normalize a single tool name to its canonical PascalCase form.