/** * Tool Name Sanitizer * * Sanitizes tool names to a cross-provider safe format: * - Max 64 characters * - Must start with letter or underscore * - Only a-z A-Z 0-9 _ - allowed * * Strategies: * 1. Remove duplicate segments (e.g., gitmcp__foo__foo -> gitmcp__foo) * 2. Normalize unsupported characters to underscores * 3. Rewrite MCP tool names to deterministic short aliases * 4. Smart truncate with hash suffix if still >64 chars * * Note: Hash collision risk is very low for practical tool counts. */ /** Maximum tool name length allowed by Gemini API */ export declare const GEMINI_MAX_TOOL_NAME_LENGTH = 64; /** Result of sanitization operation */ export interface SanitizeResult { /** The sanitized tool name */ sanitized: string; /** Whether the name was changed */ changed: boolean; } /** * Check if a tool name is valid. * * Requirements: * - Length <= 64 characters * - Starts with letter or underscore * - Contains only valid characters: a-z A-Z 0-9 _ - */ export declare function isValidToolName(name: string): boolean; /** * Remove consecutive duplicate segments separated by '__'. * * Examples: * - 'gitmcp__foo__foo' -> 'gitmcp__foo' * - 'a__b__c__b__c' -> 'a__b__c' * - 'no_dupes' -> 'no_dupes' */ export declare function removeDuplicateSegments(name: string): string; /** * Smart truncate a name to fit within maxLen. * Preserves start of name and appends hash suffix for uniqueness. * * Format: _<6-char-hash> */ export declare function smartTruncate(name: string, maxLen?: number): string; /** * Sanitize a tool name to comply with conservative provider constraints. * * Process: * 1. Remove duplicate segments * 2. Convert mcp__* names to deterministic short aliases * 3. Normalize unsupported characters for other names * 4. Truncate if needed */ export declare function sanitizeToolName(name: string): SanitizeResult; //# sourceMappingURL=tool-name-sanitizer.d.ts.map