Skip to main content

sanitize_tool_name

Function sanitize_tool_name 

Source
pub fn sanitize_tool_name(raw: &str) -> Result<String, WorkbookToolError>
Expand description

Sanitize a raw output-Table name into an MCP tool name matching ^[a-zA-Z0-9_-]{1,64}$ (T-100-10), wrapping the SINGLE shared runtime sanitizer (pmcp_workbook_runtime::sanitize_tool_name) so the served registration and the offline compiler’s collision lint cannot drift on the locked five-rule semantics (lowercase, illegal-run → single _, trim edges, truncate 64, reject empty/all-illegal). A reject becomes the fail-closed invalid_tool_name domain error.

§Errors

Returns Err(WorkbookToolError::unmappable_tool_name) when the input has no character mappable to the charset (empty or all-illegal).