Skip to content

Commit 8f8fef5

Browse files
authored
docs(workflow-code): describe agentTool and the source resources manifest accurately (#10648)
* 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. * docs(workflow-code): keep the source resources operation summary short, details in the field schemas
1 parent e787eff commit 8f8fef5

11 files changed

Lines changed: 32 additions & 26 deletions

File tree

‎apps/docs/openapi-v2-resources.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32073,7 +32073,7 @@
3207332073
"type": "boolean"
3207432074
},
3207532075
"agentTool": {
32076-
"description": "A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form.",
32076+
"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.",
3207732077
"type": "boolean",
3207832078
"const": true
3207932079
},

‎apps/docs/openapi-v2-workflows.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6771,7 +6771,7 @@
67716771
"get": {
67726772
"operationId": "getSourceResources",
67736773
"summary": "Get source resources",
6774-
"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`.",
6774+
"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`.",
67756775
"x-sim-operation": "workflows.source.resources.read",
67766776
"x-oauth-scope": "api:read",
67776777
"tags": ["Workflows"],
@@ -23981,11 +23981,11 @@
2398123981
"items": {
2398223982
"type": "string"
2398323983
},
23984-
"description": "Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values."
23984+
"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."
2398523985
},
2398623986
"truncated": {
2398723987
"type": "boolean",
23988-
"description": "True when a kind had more than 1000 resources; only the oldest 1000 of that kind are listed."
23988+
"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."
2398923989
}
2399023990
},
2399123991
"required": [

‎apps/sim/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export const dynamic = 'force-dynamic'
88
export const revalidate = 0
99

1010
/**
11-
* GET /api/v2/workspaces/{workspaceId}/workflows/source/resources — the tables, knowledge bases,
12-
* credentials, workflows and env names workflow source can name, by key.
11+
* GET /api/v2/workspaces/{workspaceId}/workflows/source/resources — the resources workflow source
12+
* can name: most by key, files by path, env names by name.
1313
*
1414
* `headSafe: false` because listing a resource that has no key yet allocates one
1515
* (`workspace_resource_key`), so a `HEAD` probe must not run it.

‎apps/sim/blocks/agent-tools.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ const CORE_AGENT_TOOL_TYPES = new Set([
1818
])
1919

2020
/**
21-
* Checks whether a block is one of the platform's core agent tools, which the
22-
* picker lists under "Built-in Tools" rather than "Integrations" and the
23-
* workflow source catalog marks `agentTool`.
21+
* Checks whether a block is one of the platform's core agent tools, in any
22+
* version. The picker lists the visible ones under "Built-in Tools" rather than
23+
* "Integrations"; the workflow source catalog marks every version `agentTool`,
24+
* hidden legacy ones included.
2425
*/
2526
export function isCoreAgentToolBlock(block: Pick<BlockConfig, 'type'>): boolean {
2627
return CORE_AGENT_TOOL_TYPES.has(stripVersionSuffix(block.type))

‎apps/sim/lib/api/contracts/v2/openapi/source-resources.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const sourceResourcesOpenApiRoutes = [
5252
applicationOperation: workflowOperations.readSourceResources,
5353
operationId: 'getSourceResources',
5454
summary: 'Get source resources',
55-
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.`,
55+
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}.`,
5656
tags: ['Workflows'],
5757
errors: RESOURCE_ERRORS,
5858
success: {

‎apps/sim/lib/api/contracts/v2/source-catalog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const catalogBlockSchema = z
322322
.literal(true)
323323
.optional()
324324
.describe(
325-
'A built-in block the agent tool picker offers beside integrations, so its operations have an agent-tool form.'
325+
'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.'
326326
),
327327
subBlocks: z
328328
.array(z.union([catalogSubBlockSchema, sharedSubBlockRefSchema, triggerSubBlocksRefSchema]))

‎apps/sim/lib/api/contracts/v2/source-resources.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { defineRouteContract } from '@/lib/api/contracts/types'
55
import { v2DataResponse } from '@/lib/api/contracts/v2/shared'
66

77
/**
8-
* Most resources of one kind the manifest lists, oldest first. Past it the manifest says
9-
* `truncated`; source can still name a later resource by its key.
8+
* Most resources of one kind the manifest lists, oldest first; environment variable names are not
9+
* capped. Past it the manifest says `truncated`; source can still name a later resource by its key,
10+
* or a later file by its path.
1011
*/
1112
export const MAX_MANIFEST_RESOURCES_PER_KIND = 1000
1213

@@ -116,15 +117,17 @@ const sourceResourcesSchema = z
116117
env: z
117118
.array(z.string())
118119
.describe(
119-
'Environment variable names a run can read as `env.NAME`: the workspace secrets and, for a user, their personal ones. Never values.'
120+
'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.'
120121
),
121122
truncated: z
122123
.boolean()
123124
.describe(
124-
`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.`
125+
`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.`
125126
),
126127
})
127-
.describe('The workspace resources workflow source can name, by key.')
128+
.describe(
129+
'The workspace resources workflow source can name: most by key, files by path, environment variables by name.'
130+
)
128131

129132
export type SourceResources = z.output<typeof sourceResourcesSchema>
130133

‎apps/sim/lib/api/mcp/generated/v2-operations.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ export const V2_MCP_OPERATIONS = {
16831683
contract: v2GetSourceResourcesContract,
16841684
summary: 'Get source resources',
16851685
description:
1686-
'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`.',
1686+
"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`.",
16871687
handler: () =>
16881688
import('@/app/api/v2/workspaces/[workspaceId]/workflows/source/resources/route').then(
16891689
(route) => route.GET

‎apps/sim/lib/workflows/application/operations.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ export const workflowOperations = {
100100
...ALL_WORKFLOW_PRINCIPAL_POLICY,
101101
}),
102102
/**
103-
* The workspace resources workflow source can name, by key. A read: any member may list them,
104-
* as any member may read the source that names them; a workspace API key and Copilot may too,
103+
* The workspace resources workflow source can name (most by key, files by path). A read: any
104+
* member may list them, as any member may read the source that names them; a workspace API key
105+
* and Copilot may too,
105106
* like `workflows.source.catalog.read`. Listing allocates keys for resources that have none,
106107
* which changes no resource (see `readSourceResources`). The result is names, ids, keys, table
107108
* column schemas and env names, never stored content, so `contentDelivery` is `none`. Its
108-
* sections (env names, credentials, skills, custom tools, MCP servers, tables, knowledge bases)
109+
* sections (env names, credentials, skills, custom tools, MCP servers, tables, knowledge bases,
110+
* files)
109111
* are gated inside the use case, not here, so a member whose group hides one still gets the rest
110112
* of the manifest.
111113
*/

‎packages/workflow-code/src/compile/SYNTAX.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ changes how an unedited field stores it.
257257
an unknown key) as `raw([…])`.
258258
- Tools (`valueKind: 'tools'`): an array of
259259
- `ns.tool.method(params, options?)` (`slack.tool.sendMessage(…)`, `table.tool.queryRows(…)`):
260-
an operation the agent tool picker offers (the namespaced builder, outside trigger mode, of a
261-
`tools`-category block or a built-in one the catalog marks `agentTool`: Table, Knowledge,
262-
File). Any other builder as a tool
260+
an agent-tool operation (the namespaced builder, outside trigger mode, of a `tools`-category
261+
block or a built-in one the catalog marks `agentTool` (Table, Knowledge, File), hidden legacy
262+
versions included). Any other builder as a tool
263263
(`api.tool(…)`, `trigger.gmail.tool.poller(…)`) is `E_UNKNOWN_BUILDER`. Params are checked like
264264
a block's: one the tool type does not have is `E_UNKNOWN_PARAM`, one of another operation
265265
`W_FIELD_NOT_APPLICABLE`, a literal secret `W_LITERAL_SECRET`;

0 commit comments

Comments
 (0)