Skip to content

Commit 84d9726

Browse files
icecrasher321claude
andcommitted
fix(tool-input): regenerate icon mapping and guard an empty MCP enum
- `docs:check` failed: adding `human_in_the_loop_v2` (and hiding v1) left the generated icon maps stale. Regenerated; the diff is only those entries. - `enumMemberShape` read an empty enum as numeric, because `every` is vacuously true on `[]`. A third-party MCP schema can send one. - The MCP dropdown's highlight label used a truthiness check, so a falsy member (`0`, `false`) rendered blank now that the value is decoded rather than kept as a string. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent e1e66eb commit 84d9726

5 files changed

Lines changed: 14 additions & 2 deletions

File tree

apps/docs/components/ui/icon-mapping.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import {
117117
HexIcon,
118118
HubspotIcon,
119119
HuggingFaceIcon,
120+
HumanInTheLoopIcon,
120121
HunterIOIcon,
121122
IAMIcon,
122123
IcypeasIcon,
@@ -405,6 +406,8 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
405406
hex: HexIcon,
406407
hubspot: HubspotIcon,
407408
huggingface: HuggingFaceIcon,
409+
human_in_the_loop: HumanInTheLoopIcon,
410+
human_in_the_loop_v2: HumanInTheLoopIcon,
408411
hunter: HunterIOIcon,
409412
iam: IAMIcon,
410413
icypeas: IcypeasIcon,

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/mcp-dynamic-args/mcp-dynamic-args.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,11 @@ export function McpDynamicArgs({
269269
value: String(option),
270270
}))
271271
// Options are stringified members, so a decoded numeric/boolean enum value has to
272-
// be stringified back to match one.
272+
// be stringified back to match one. Label and value are the same string here, so
273+
// the highlight overlay reads the same expression — a falsy member (`0`, `false`)
274+
// is a real selection, not an empty one.
273275
const dropdownValue = value === undefined || value === null ? '' : String(value)
274-
const selectedLabel = value ? String(value) : ''
276+
const selectedLabel = dropdownValue
275277
const workflowSearchHighlight = getWorkflowSearchLabelHighlight({
276278
activeSearchTarget,
277279
blockId,

apps/sim/lib/integrations/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ import {
116116
HexIcon,
117117
HubspotIcon,
118118
HuggingFaceIcon,
119+
HumanInTheLoopIcon,
119120
HunterIOIcon,
120121
IAMIcon,
121122
IcypeasIcon,
@@ -394,6 +395,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
394395
hex: HexIcon,
395396
hubspot: HubspotIcon,
396397
huggingface: HuggingFaceIcon,
398+
human_in_the_loop_v2: HumanInTheLoopIcon,
397399
hunter: HunterIOIcon,
398400
iam: IAMIcon,
399401
icypeas: IcypeasIcon,

apps/sim/tools/param-shape.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ describe('buildJsonSchemaParamShapes', () => {
537537
strs: { enum: ['x', 'y'] },
538538
structured: { enum: [{ a: 1 }] },
539539
mixed: { enum: [1, 'x'] },
540+
// `every` is vacuously true on an empty enum — this must not read as numeric.
541+
empty: { enum: [] },
540542
},
541543
})
542544

@@ -545,6 +547,7 @@ describe('buildJsonSchemaParamShapes', () => {
545547
expect(shapes.get('strs')).toBe('string')
546548
expect(shapes.get('structured')).toBe('json')
547549
expect(shapes.get('mixed')).toBe('string')
550+
expect(shapes.get('empty')).toBe('string')
548551
})
549552

550553
it('round-trips a numeric enum through the dropdown it renders as', () => {

apps/sim/tools/param-shape.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ export function getJsonSchemaValueShape(property: JsonSchemaProperty): ToolParam
426426

427427
/** The shape an enum's members share, for a property that declares no type. */
428428
function enumMemberShape(members: readonly unknown[]): ToolParamValueShape {
429+
// `every` is vacuously true on an empty enum, which a third-party MCP schema may send.
430+
if (members.length === 0) return 'string'
429431
if (members.some((member) => member !== null && typeof member === 'object')) return 'json'
430432
if (members.every((member) => typeof member === 'number')) return 'number'
431433
if (members.every((member) => typeof member === 'boolean')) return 'boolean'

0 commit comments

Comments
 (0)