MCPcopy
hub / github.com/CopilotKit/CopilotKit / parseToolArguments

Function parseToolArguments

packages/core/src/core/run-handler.ts:1085–1097  ·  view source on GitHub ↗
(
  rawArgs: unknown,
  toolName: string,
)

Source from the content-addressed store, hash-verified

1083 * @internal Exported for testing only.
1084 */
1085export function parseToolArguments(
1086 rawArgs: unknown,
1087 toolName: string,
1088): Record<string, unknown> {
1089 if (rawArgs === "" || rawArgs === null || rawArgs === undefined) {
1090 logger.debug(
1091 `[parseToolArguments] Tool "${toolName}" received empty/null/undefined arguments — defaulting to {}`,
1092 );
1093 return {};
1094 }
1095 const parsed = typeof rawArgs === "string" ? JSON.parse(rawArgs) : rawArgs;
1096 return ensureObjectArgs(parsed, toolName);
1097}

Callers 2

executeToolHandlerMethod · 0.85
executeWildcardToolMethod · 0.85

Calls 3

ensureObjectArgsFunction · 0.85
parseMethod · 0.80
debugMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…