MCPcopy Index your code
hub / github.com/codeaashu/claude-code / filterSwarmFieldsFromSchema

Function filterSwarmFieldsFromSchema

src/utils/api.ts:96–117  ·  view source on GitHub ↗

* Filter swarm-related fields from a tool's input schema. * Called at runtime when isAgentSwarmsEnabled() returns false.

(
  toolName: string,
  schema: Anthropic.Tool.InputSchema,
)

Source from the content-addressed store, hash-verified

94 * Called at runtime when isAgentSwarmsEnabled() returns false.
95 */
96function filterSwarmFieldsFromSchema(
97 toolName: string,
98 schema: Anthropic.Tool.InputSchema,
99): Anthropic.Tool.InputSchema {
100 const fieldsToRemove = SWARM_FIELDS_BY_TOOL[toolName]
101 if (!fieldsToRemove || fieldsToRemove.length === 0) {
102 return schema
103 }
104
105 // Clone the schema to avoid mutating the original
106 const filtered = { ...schema }
107 const props = filtered.properties
108 if (props && typeof props === 'object') {
109 const filteredProps = { ...(props as Record<string, unknown>) }
110 for (const field of fieldsToRemove) {
111 delete filteredProps[field]
112 }
113 filtered.properties = filteredProps
114 }
115
116 return filtered
117}
118
119export async function toolToAPISchema(
120 tool: Tool,

Callers 1

toolToAPISchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected