diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.test.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.test.ts index 44b73e1e4ad..4effd849d9e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.test.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.test.ts @@ -4,11 +4,32 @@ import { describe, expect, it } from 'vitest' import type { StoredTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/types' import { + isAgentToolBlock, isCustomToolAlreadySelected, isMcpToolAlreadySelected, isWorkflowAlreadySelected, } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils' +describe('isAgentToolBlock', () => { + it('includes the current File block', () => { + expect(isAgentToolBlock({ type: 'file_v5', category: 'blocks', hideFromToolbar: false })).toBe( + true + ) + }) + + it('excludes hidden blocks such as the legacy File block', () => { + expect(isAgentToolBlock({ type: 'file', category: 'blocks', hideFromToolbar: true })).toBe( + false + ) + }) + + it('does not make every visible core block agent-callable', () => { + expect(isAgentToolBlock({ type: 'memory', category: 'blocks', hideFromToolbar: false })).toBe( + false + ) + }) +}) + describe('isMcpToolAlreadySelected', () => { describe('basic functionality', () => { it.concurrent('returns false when selectedTools is empty', () => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx index 753e0818874..fe30b4dc656 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx @@ -46,6 +46,7 @@ import { ToolSubBlockRenderer } from '@/app/workspace/[workspaceId]/w/[workflowI import { clearDependentToolParams } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/param-dependents' import type { StoredTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/types' import { + isAgentToolBlock, isCustomToolAlreadySelected, isMcpToolAlreadySelected, isWorkflowAlreadySelected, @@ -665,21 +666,7 @@ export const ToolInput = memo(function ToolInput({ const customBlockOverlayVersion = useCustomBlockOverlayVersion() const toolBlocks = useMemo(() => { - const allToolBlocks = getAllBlocks().filter( - (block) => - !block.hideFromToolbar && - (block.category === 'tools' || - block.type === 'api' || - block.type === 'webhook_request' || - block.type === 'workflow' || - block.type === 'workflow_input' || - block.type === 'knowledge' || - block.type === 'function' || - block.type === 'table') && - block.type !== 'evaluator' && - block.type !== 'mcp' && - block.type !== 'file' - ) + const allToolBlocks = getAllBlocks().filter(isAgentToolBlock) return filterBlocks(allToolBlocks) }, [filterBlocks, customBlockOverlayVersion]) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils.ts index 1110a5808b8..621d192327d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils.ts @@ -1,4 +1,27 @@ import type { StoredTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/types' +import type { BlockConfig } from '@/blocks/types' + +const CORE_AGENT_TOOL_TYPES = new Set([ + 'api', + 'webhook_request', + 'workflow', + 'workflow_input', + 'knowledge', + 'function', + 'table', + 'file_v5', +]) + +/** + * Checks whether a registered block should appear in the agent tool picker. + */ +export function isAgentToolBlock( + block: Pick +): boolean { + return ( + !block.hideFromToolbar && (block.category === 'tools' || CORE_AGENT_TOOL_TYPES.has(block.type)) + ) +} /** * Checks if an MCP tool is already selected. diff --git a/apps/sim/blocks/utils.test.ts b/apps/sim/blocks/utils.test.ts index 9cdb1d1df23..eaa91330389 100644 --- a/apps/sim/blocks/utils.test.ts +++ b/apps/sim/blocks/utils.test.ts @@ -69,6 +69,7 @@ vi.mock('@/lib/oauth/utils', () => ({ import type { SubBlockConfig } from '@/blocks/types' import { + BUILT_IN_TOOL_TYPES, getApiKeyCondition, getDependsOnFields, getSubBlocksDependingOnChange, @@ -77,6 +78,13 @@ import { parseOptionalNumberInput, } from '@/blocks/utils' +describe('BUILT_IN_TOOL_TYPES', () => { + it('classifies the current File block instead of the legacy File block', () => { + expect(BUILT_IN_TOOL_TYPES.has('file_v5')).toBe(true) + expect(BUILT_IN_TOOL_TYPES.has('file')).toBe(false) + }) +}) + const BASE_CLOUD_MODELS: Record = { 'gpt-4o': 'openai', 'claude-sonnet-4-5': 'anthropic', diff --git a/apps/sim/blocks/utils.ts b/apps/sim/blocks/utils.ts index d5e954744df..e5ecd711fed 100644 --- a/apps/sim/blocks/utils.ts +++ b/apps/sim/blocks/utils.ts @@ -658,7 +658,7 @@ export function normalizeFileInput( */ export const BUILT_IN_TOOL_TYPES = new Set([ 'api', - 'file', + 'file_v5', 'function', 'knowledge', 'search',