Skip to content

PersistentAI API Documentation / @persistent-ai/fireflow-types / sanitizeToolName

Function: sanitizeToolName()

sanitizeToolName(rawName, fallbackId?): string

Defined in: packages/fireflow-types/src/tool/name-sanitizer.ts:22

Sanitizes a string to be a valid tool name for LLM tool calling APIs.

Requirements (Anthropic/OpenAI compatible):

  • Maximum 64 characters
  • Only alphanumeric characters, hyphens (-), and underscores (_)
  • No XML tags
  • No reserved words ("anthropic", "claude")

Parameters

rawName

string

The raw name to sanitize (typically node title or type)

fallbackId?

string

Fallback identifier if rawName produces an invalid result

Returns

string

A sanitized tool name

Licensed under BUSL-1.1