MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / isValidToolName

Function isValidToolName

src/core/tools/validateToolUse.ts:14–30  ·  view source on GitHub ↗
(toolName: string, experiments?: Record<string, boolean>)

Source from the content-addressed store, hash-verified

12 * only that the tool actually exists.
13 */
14export function isValidToolName(toolName: string, experiments?: Record<string, boolean>): toolName is ToolName {
15 // Check if it's a valid static tool
16 if ((validToolNames as readonly string[]).includes(toolName)) {
17 return true
18 }
19
20 if (experiments?.customTools && customToolRegistry.has(toolName)) {
21 return true
22 }
23
24 // Check if it's a dynamic MCP tool (mcp_serverName_toolName format).
25 if (toolName.startsWith("mcp_")) {
26 return true
27 }
28
29 return false
30}
31
32export function validateToolUse(
33 toolName: ToolName,

Callers 2

presentAssistantMessageFunction · 0.90
validateToolUseFunction · 0.85

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected