From 1cb090d1646fff2bd3b65dfd5ae35d31f7a4c02c Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 2 Dec 2026 09:58:36 -0600 Subject: [PATCH 1/2] docs(workflow-code): describe agentTool and the source resources manifest accurately agentTool is set on every version of a core agent-tool block, hidden legacy ones included, so a tool stored from one still prints through its builder; the catalog contract, hasToolForm and SYNTAX.md said the picker offers it. The getSourceResources description left out workspace files, said every resource has a key, and implied env names are capped. Files are named by path, env names are never capped (and never listed for a workspace API key), and a section a permission group withholds is listed empty. The contract's truncated and top-level describes, the route and operation TSDocs, and the generated OpenAPI and MCP operation docs now say the same. --- apps/docs/openapi-v2-resources.json | 2 +- apps/docs/openapi-v2-workflows.json | 4 ++-- .../[workspaceId]/workflows/source/resources/route.ts | 4 ++-- apps/sim/blocks/agent-tools.ts | 7 ++++--- .../lib/api/contracts/v2/openapi/source-resources.ts | 2 +- apps/sim/lib/api/contracts/v2/source-catalog.ts | 2 +- apps/sim/lib/api/contracts/v2/source-resources.ts | 11 +++++++---- apps/sim/lib/api/mcp/generated/v2-operations.ts | 2 +- apps/sim/lib/workflows/application/operations.ts | 8 +++++--- packages/workflow-code/src/compile/SYNTAX.md | 6 +++--- packages/workflow-code/src/sdk.ts | 6 +++--- 11 files changed, 30 insertions(+), 24 deletions(-) diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index b852245d384..1b6776527ce 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -32073,7 +32073,7 @@ "type": "boolean" }, "agentTool": { - "description": "A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form.", + "description": "A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form. Hidden legacy versions are marked too, so a tool stored from one still prints through its builder.", "type": "boolean", "const": true }, diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index 15e059b0fc0..1b5c084bb82 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -6771,7 +6771,7 @@ "get": { "operationId": "getSourceResources", "summary": "Get source resources", - "description": "List the workspace resources workflow source can name, each with the key source uses for it: tables with their columns, knowledge bases, saved credentials with their provider, workflows with their start-block inputs, workspace skills and custom tools, MCP servers with the tool names they list, and the names (never values) of the environment variables a run can read. A resource keeps its key when renamed; one that no source has named yet is given its key by this call. Each kind lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.", + "description": "List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as `file('docs/report.pdf')`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.", "x-sim-operation": "workflows.source.resources.read", "x-oauth-scope": "api:read", "tags": ["Workflows"], @@ -23985,7 +23985,7 @@ }, "truncated": { "type": "boolean", - "description": "True when a kind had more than 1000 resources; only the oldest 1000 of that kind are listed." + "description": "True when a kind had more than 1000 resources; only the oldest 1000 of that kind are listed. Environment variable names are never capped." } }, "required": [ diff --git a/apps/sim/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route.ts b/apps/sim/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route.ts index 758afad7f91..2d0e4f87d71 100644 --- a/apps/sim/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route.ts +++ b/apps/sim/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route.ts @@ -8,8 +8,8 @@ export const dynamic = 'force-dynamic' export const revalidate = 0 /** - * GET /api/v2/workspaces/{workspaceId}/workflows/source/resources — the tables, knowledge bases, - * credentials, workflows and env names workflow source can name, by key. + * GET /api/v2/workspaces/{workspaceId}/workflows/source/resources — the resources workflow source + * can name: most by key, files by path, env names by name. * * `headSafe: false` because listing a resource that has no key yet allocates one * (`workspace_resource_key`), so a `HEAD` probe must not run it. diff --git a/apps/sim/blocks/agent-tools.ts b/apps/sim/blocks/agent-tools.ts index c34ec17870a..9ced91e4169 100644 --- a/apps/sim/blocks/agent-tools.ts +++ b/apps/sim/blocks/agent-tools.ts @@ -18,9 +18,10 @@ const CORE_AGENT_TOOL_TYPES = new Set([ ]) /** - * Checks whether a block is one of the platform's core agent tools, which the - * picker lists under "Built-in Tools" rather than "Integrations" and the - * workflow source catalog marks `agentTool`. + * Checks whether a block is one of the platform's core agent tools, in any + * version. The picker lists the visible ones under "Built-in Tools" rather than + * "Integrations"; the workflow source catalog marks every version `agentTool`, + * hidden legacy ones included. */ export function isCoreAgentToolBlock(block: Pick): boolean { return CORE_AGENT_TOOL_TYPES.has(stripVersionSuffix(block.type)) diff --git a/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts b/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts index 639e5a8a235..e3b93e45e9e 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts @@ -52,7 +52,7 @@ export const sourceResourcesOpenApiRoutes = [ applicationOperation: workflowOperations.readSourceResources, operationId: 'getSourceResources', summary: 'Get source resources', - description: `List the workspace resources workflow source can name, each with the key source uses for it: tables with their columns, knowledge bases, saved credentials with their provider, workflows with their start-block inputs, workspace skills and custom tools, MCP servers with the tool names they list, and the names (never values) of the environment variables a run can read. A resource keeps its key when renamed; one that no source has named yet is given its key by this call. Each kind lists its oldest ${MAX_MANIFEST_RESOURCES_PER_KIND} resources, and \`truncated\` says when there were more.`, + description: `List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as \`file('docs/report.pdf')\`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest ${MAX_MANIFEST_RESOURCES_PER_KIND} resources, and \`truncated\` says when there were more.`, tags: ['Workflows'], errors: RESOURCE_ERRORS, success: { diff --git a/apps/sim/lib/api/contracts/v2/source-catalog.ts b/apps/sim/lib/api/contracts/v2/source-catalog.ts index 32e70d7aa9a..fa1fd7d3b48 100644 --- a/apps/sim/lib/api/contracts/v2/source-catalog.ts +++ b/apps/sim/lib/api/contracts/v2/source-catalog.ts @@ -322,7 +322,7 @@ const catalogBlockSchema = z .literal(true) .optional() .describe( - 'A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form.' + 'A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form. Hidden legacy versions are marked too, so a tool stored from one still prints through its builder.' ), subBlocks: z .array(z.union([catalogSubBlockSchema, sharedSubBlockRefSchema, triggerSubBlocksRefSchema])) diff --git a/apps/sim/lib/api/contracts/v2/source-resources.ts b/apps/sim/lib/api/contracts/v2/source-resources.ts index 375727c2e11..cc7778168fa 100644 --- a/apps/sim/lib/api/contracts/v2/source-resources.ts +++ b/apps/sim/lib/api/contracts/v2/source-resources.ts @@ -5,8 +5,9 @@ import { defineRouteContract } from '@/lib/api/contracts/types' import { v2DataResponse } from '@/lib/api/contracts/v2/shared' /** - * Most resources of one kind the manifest lists, oldest first. Past it the manifest says - * `truncated`; source can still name a later resource by its key. + * Most resources of one kind the manifest lists, oldest first; environment variable names are not + * capped. Past it the manifest says `truncated`; source can still name a later resource by its key, + * or a later file by its path. */ export const MAX_MANIFEST_RESOURCES_PER_KIND = 1000 @@ -121,10 +122,12 @@ const sourceResourcesSchema = z truncated: z .boolean() .describe( - `True when a kind had more than ${MAX_MANIFEST_RESOURCES_PER_KIND} resources; only the oldest ${MAX_MANIFEST_RESOURCES_PER_KIND} of that kind are listed.` + `True when a kind had more than ${MAX_MANIFEST_RESOURCES_PER_KIND} resources; only the oldest ${MAX_MANIFEST_RESOURCES_PER_KIND} of that kind are listed. Environment variable names are never capped.` ), }) - .describe('The workspace resources workflow source can name, by key.') + .describe( + 'The workspace resources workflow source can name: most by key, files by path, environment variables by name.' + ) export type SourceResources = z.output diff --git a/apps/sim/lib/api/mcp/generated/v2-operations.ts b/apps/sim/lib/api/mcp/generated/v2-operations.ts index d4e443f28a0..4f90caf4cbf 100644 --- a/apps/sim/lib/api/mcp/generated/v2-operations.ts +++ b/apps/sim/lib/api/mcp/generated/v2-operations.ts @@ -1683,7 +1683,7 @@ export const V2_MCP_OPERATIONS = { contract: v2GetSourceResourcesContract, summary: 'Get source resources', description: - 'List the workspace resources workflow source can name, each with the key source uses for it: tables with their columns, knowledge bases, saved credentials with their provider, workflows with their start-block inputs, workspace skills and custom tools, MCP servers with the tool names they list, and the names (never values) of the environment variables a run can read. A resource keeps its key when renamed; one that no source has named yet is given its key by this call. Each kind lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.', + "List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as `file('docs/report.pdf')`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.", handler: () => import('@/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route').then( (route) => route.GET diff --git a/apps/sim/lib/workflows/application/operations.ts b/apps/sim/lib/workflows/application/operations.ts index cc5c7c9e448..8932203929a 100644 --- a/apps/sim/lib/workflows/application/operations.ts +++ b/apps/sim/lib/workflows/application/operations.ts @@ -100,12 +100,14 @@ export const workflowOperations = { ...ALL_WORKFLOW_PRINCIPAL_POLICY, }), /** - * The workspace resources workflow source can name, by key. A read: any member may list them, - * as any member may read the source that names them; a workspace API key and Copilot may too, + * The workspace resources workflow source can name (most by key, files by path). A read: any + * member may list them, as any member may read the source that names them; a workspace API key + * and Copilot may too, * like `workflows.source.catalog.read`. Listing allocates keys for resources that have none, * which changes no resource (see `readSourceResources`). The result is names, ids, keys, table * column schemas and env names, never stored content, so `contentDelivery` is `none`. Its - * sections (env names, credentials, skills, custom tools, MCP servers, tables, knowledge bases) + * sections (env names, credentials, skills, custom tools, MCP servers, tables, knowledge bases, + * files) * are gated inside the use case, not here, so a member whose group hides one still gets the rest * of the manifest. */ diff --git a/packages/workflow-code/src/compile/SYNTAX.md b/packages/workflow-code/src/compile/SYNTAX.md index c2696e60445..dcc148c1c3b 100644 --- a/packages/workflow-code/src/compile/SYNTAX.md +++ b/packages/workflow-code/src/compile/SYNTAX.md @@ -257,9 +257,9 @@ changes how an unedited field stores it. an unknown key) as `raw([…])`. - Tools (`valueKind: 'tools'`): an array of - `ns.tool.method(params, options?)` (`slack.tool.sendMessage(…)`, `table.tool.queryRows(…)`): - an operation the agent tool picker offers (the namespaced builder, outside trigger mode, of a - `tools`-category block or a built-in one the catalog marks `agentTool`: Table, Knowledge, - File). Any other builder as a tool + an agent-tool operation (the namespaced builder, outside trigger mode, of a `tools`-category + block or a built-in one the catalog marks `agentTool` (Table, Knowledge, File), hidden legacy + versions included). Any other builder as a tool (`api.tool(…)`, `trigger.gmail.tool.poller(…)`) is `E_UNKNOWN_BUILDER`. Params are checked like a block's: one the tool type does not have is `E_UNKNOWN_PARAM`, one of another operation `W_FIELD_NOT_APPLICABLE`, a literal secret `W_LITERAL_SECRET`; diff --git a/packages/workflow-code/src/sdk.ts b/packages/workflow-code/src/sdk.ts index b7b5d47b446..689d1bb8fcf 100644 --- a/packages/workflow-code/src/sdk.ts +++ b/packages/workflow-code/src/sdk.ts @@ -261,9 +261,9 @@ export const SDK_RESERVED_IDENTIFIERS: ReadonlySet = new Set([ /** * Whether the SDK declares a builder's agent-tool form, `namespace.tool.method(params, options)`: - * a namespaced builder outside trigger mode of a block the agent tool picker offers (a - * tools-category block, or a built-in one marked `agentTool`). SDK codegen emits exactly these, - * and the printer writes any other tool as `raw(tool)`. + * a namespaced builder outside trigger mode of a tools-category block or a built-in one marked + * `agentTool`, hidden legacy versions included. SDK codegen emits exactly these, and the printer + * writes any other tool as `raw(tool)`. */ export function hasToolForm( path: string, From 2777367c19e490ee79be1b4e660d914f760d7fe3 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 2 Dec 2026 10:05:55 -0600 Subject: [PATCH 2/2] docs(workflow-code): keep the source resources operation summary short, details in the field schemas --- apps/docs/openapi-v2-workflows.json | 4 ++-- apps/sim/lib/api/contracts/v2/openapi/source-resources.ts | 2 +- apps/sim/lib/api/contracts/v2/source-resources.ts | 2 +- apps/sim/lib/api/mcp/generated/v2-operations.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/docs/openapi-v2-workflows.json b/apps/docs/openapi-v2-workflows.json index 1b5c084bb82..3675aeecdcb 100644 --- a/apps/docs/openapi-v2-workflows.json +++ b/apps/docs/openapi-v2-workflows.json @@ -6771,7 +6771,7 @@ "get": { "operationId": "getSourceResources", "summary": "Get source resources", - "description": "List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as `file('docs/report.pdf')`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.", + "description": "List the workspace resources workflow source can name: tables, knowledge bases, saved credentials, workflows, skills, custom tools and MCP servers by key, workspace files by path, and environment variable names. A resource keeps its key when renamed; one no source has named yet is given its key by this call. A section the caller's permission group withholds is listed empty, and `truncated` says when a kind had more than 1000.\n\nOAuth scope: `api:read`.", "x-sim-operation": "workflows.source.resources.read", "x-oauth-scope": "api:read", "tags": ["Workflows"], @@ -23981,7 +23981,7 @@ "items": { "type": "string" }, - "description": "Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values." + "description": "Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values, and empty for a workspace API key." }, "truncated": { "type": "boolean", diff --git a/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts b/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts index e3b93e45e9e..3aa221c4bad 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/source-resources.ts @@ -52,7 +52,7 @@ export const sourceResourcesOpenApiRoutes = [ applicationOperation: workflowOperations.readSourceResources, operationId: 'getSourceResources', summary: 'Get source resources', - description: `List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as \`file('docs/report.pdf')\`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest ${MAX_MANIFEST_RESOURCES_PER_KIND} resources, and \`truncated\` says when there were more.`, + description: `List the workspace resources workflow source can name: tables, knowledge bases, saved credentials, workflows, skills, custom tools and MCP servers by key, workspace files by path, and environment variable names. A resource keeps its key when renamed; one no source has named yet is given its key by this call. A section the caller's permission group withholds is listed empty, and \`truncated\` says when a kind had more than ${MAX_MANIFEST_RESOURCES_PER_KIND}.`, tags: ['Workflows'], errors: RESOURCE_ERRORS, success: { diff --git a/apps/sim/lib/api/contracts/v2/source-resources.ts b/apps/sim/lib/api/contracts/v2/source-resources.ts index cc7778168fa..3a055d9f8f8 100644 --- a/apps/sim/lib/api/contracts/v2/source-resources.ts +++ b/apps/sim/lib/api/contracts/v2/source-resources.ts @@ -117,7 +117,7 @@ const sourceResourcesSchema = z env: z .array(z.string()) .describe( - 'Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values.' + 'Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values, and empty for a workspace API key.' ), truncated: z .boolean() diff --git a/apps/sim/lib/api/mcp/generated/v2-operations.ts b/apps/sim/lib/api/mcp/generated/v2-operations.ts index 4f90caf4cbf..9ead9a4bf42 100644 --- a/apps/sim/lib/api/mcp/generated/v2-operations.ts +++ b/apps/sim/lib/api/mcp/generated/v2-operations.ts @@ -1683,7 +1683,7 @@ export const V2_MCP_OPERATIONS = { contract: v2GetSourceResourcesContract, summary: 'Get source resources', description: - "List the workspace resources workflow source can name. Tables (with their columns), knowledge bases, saved credentials (with their provider), workflows (with their start-block inputs), workspace skills, custom tools, and MCP servers (with the tool names they list) each come with the key source uses for them; a resource keeps its key when renamed, and one no source has named yet is given its key by this call. Workspace files are listed by path and named in source as `file('docs/report.pdf')`. Environment variables are listed by name only, never value, and never for a workspace API key. A section the caller's permission group withholds is listed empty. Each kind except environment variables lists its oldest 1000 resources, and `truncated` says when there were more.\n\nOAuth scope: `api:read`.", + "List the workspace resources workflow source can name: tables, knowledge bases, saved credentials, workflows, skills, custom tools and MCP servers by key, workspace files by path, and environment variable names. A resource keeps its key when renamed; one no source has named yet is given its key by this call. A section the caller's permission group withholds is listed empty, and `truncated` says when a kind had more than 1000.\n\nOAuth scope: `api:read`.", handler: () => import('@/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route').then( (route) => route.GET