validate_tool_name (src/tool_name.rs)

grok-build · crates/codegen/xai-grok-mcp/src/tool_name.rs · rust · Apache-2.0
ai, tag:knn-classified

Functions to validate, parse, and qualify MCP tool names, ensuring compliance with naming rules.

// Source: https://github.com/xai-org/grok-build | License: Apache-2.0 | Copyright 2023-2026 SpaceXAI
// Provided via justclaw.it.com; keep this notice with the code.
//! MCP tool-name qualification and session admission.
//!
//! Provider function-name limits (64 chars) apply to `search_tool` / `use_tool`, not to
//! catalog keys. A qualified `server__tool` is a routing id for those meta-tools.

use xai_grok_workspace_types::MCP_TOOL_NAME_DELIMITER;

/// Strictest cross-provider function-name length (`search_tool`, `use_tool`, …).
pub const PROVIDER_TOOL_NAME_MAX_CHARS: usize = 64;

/// Safety cap on catalog keys (`server__tool`). Not a provider function-name limit.
pub const MCP_QUALIFIED_NAME_MAX_CHARS: usize = 256;

/// Why a listed MCP tool was not admitted into the session catalog.
#[

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key