DocsRuntimemcpSanitizeToolName
Package: @hexos/runtime

Sanitize a tool name to be compatible with all LLM provider APIs.

OpenAI and Anthropic require tool names to match the pattern ^[a-zA-Z0-9_-]+$. This function replaces dots and other invalid characters with underscores to ensure cross-provider compatibility.

function sanitizeToolName(name: string): string

Parameters

name

string