Skip to content
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .agents/skills/add-block/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,9 @@ Validate the block against every tool in `tools.access`:
tool must already be either a registered `InternalToolConfig.operation` or an absolute external
HTTP(S) `ToolConfig.request`. If transport needs to change, use the `add-tools` skill; never add a
same-origin `/api/...` hop or a `directExecution` property from the block.
8. **Verify every tool declares `effect`** — the block's catalog `effect` (and its per-operation
`operationEffects`) is derived from them, so a mislabelled tool misreports the block to agents
and Assistant. Fix the tool with the `add-tools` rules (Declaring the effect), never the block.

## Option Lists: `selectorKey` or `options`, never a per-block fetcher

Expand Down
6 changes: 6 additions & 0 deletions .agents/skills/add-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ Never point a tool at `/api/...`, construct an absolute URL back to Sim, declare
resources. A real external/browser route and an in-process tool may share the same operation, but
neither calls the other. Follow the full transport and handler rules in the `add-tools` skill.

Every tool declares `effect: 'read' | 'write'`, classified from the API docs you researched in Step 1
by the rules in `add-tools` → Declaring the effect. `bun run check:tool-effects` checks only that the
label agrees with the HTTP method (or carries a `// tool-effect:` reason); classifying POST and
in-process operations is on you.

**types.ts:**
```typescript
import type { ToolResponse } from '@/tools/types'
Expand Down Expand Up @@ -506,6 +511,7 @@ If creating V2 versions (API-aligned outputs):
- [ ] No tool points to `/api/...`, constructs a URL back to Sim, declares `request.internal` or a
`directExecution` property (fails `bun run check:tool-request-boundary`), or has an HTTP fallback for an in-process operation
- [ ] All params have correct visibility
- [ ] Every tool declares `effect` from its documented semantics; `bun run check:tool-effects` passes
- [ ] All nullable fields use `?? null`
- [ ] All optional outputs have `optional: true`
- [ ] Created `index.ts` barrel export
Expand Down
40 changes: 40 additions & 0 deletions .agents/skills/add-tools/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const {serviceName}{Action}Tool: ToolConfig<
name: '{Service} {Action}', // Human readable
description: 'Brief description', // One sentence
version: '1.0.0',
effect: 'write', // 'read' only if it changes nothing outside Sim (see Declaring the effect)

// Required whenever the tool takes a saved credential — browser OAuth or service account
oauth: {
Expand Down Expand Up @@ -164,6 +165,7 @@ export const {serviceName}{Action}Tool: InternalToolConfig<
name: '{Service} {Action}',
description: 'Brief description',
version: '1.0.0',
effect: 'write', // `read` only once you have verified the operation changes nothing outside Sim
params: {
// Same canonical metadata as an external tool.
},
Expand All @@ -183,6 +185,42 @@ trusted `request.context` for authority, forwards `request.signal`, and returns
`Response` contract expected by the tool executor. It has no URL, method, request headers, fetch
fallback, or caller-controlled `_context` authority.

## Declaring the effect

Every tool declares `effect: 'read' | 'write'` (required by `ToolConfig`, so type-check fails a tool
without one). It is public catalog metadata: Assistant applies its read or write policy by it, and
`sim blocks get` and `sim workflows source params` show it to agents.
Labelling a write `read` is the one unsafe mistake, so classify from the provider's documented
semantics, never the name alone.

`read` means the call changes nothing outside Sim: no create, update, delete, send, post, trigger,
enqueue, consume, or mark-read; starts no asynchronous provider job or query execution (one with its own id that
can keep running), even a short-lived one; a synchronous read-only query is fine; leaves no run, conversation, history item, or other resource in an account; no contact data revealed for credits; no external delivery. Usage billing for the call
itself does not count. `write` is anything else.

**Contact reveals:** revealing a person's contact data (email, phone) for credits is `write`: an
email or phone finder, a person enrichment that returns an email or phone, and a domain search that
lists people's emails are `write` even over GET (carry `// tool-effect:`). Company/firmographic
lookups and verifications that only spend lookup credits are `read`: a company enrichment, a people
search that returns no email or phone, and an email verifier.

- `read`: GET/HEAD reads, and POST endpoints the docs define as search, query, list, get, lookup, or
verify; LLM, embedding, transcription, TTS, and media-generation calls that leave nothing in the
provider account; queries the server enforces as read-only (a read-only transaction or setting,
never a client-side screen alone).
- `write`: an effect that depends on the params (a `method` param or function-valued
`request.method` that can pick PUT/PATCH/DELETE or a mutating POST, raw SQL or Cypher the server
does not restrict to reads, a generic RPC or command); a GET whose `transformResponse` or
`postProcess` then writes; a read that consumes or acknowledges (a queue receive, mark-as-read);
media generation, transcription, crawls, exports, and research or agent runs that leave a job,
run, asset, or history item in the provider account; a chat that keeps a conversation; a reveal
or enrichment that creates a resource or delivers to a webhook; anything that saves to the
workspace. When unsure, `write`.
- PUT/PATCH/DELETE are `write`. A static GET/HEAD labelled `write`, or PUT/PATCH/DELETE labelled
`read`, fails the audit unless the `effect` line carries `// tool-effect: <reason>` on one of the
two lines above it; use it only for a genuine exception such as a GET that writes in `postProcess`.
- A factory that builds tools from definitions takes `effect` per definition and passes it through.

## Critical Rules for Parameters

### Visibility Options
Expand Down Expand Up @@ -606,6 +644,8 @@ If creating V2 tools (API-aligned outputs), use `_v2` suffix:
## Checklist Before Finishing

- [ ] All tool IDs use snake_case
- [ ] Every tool declares `effect`, classified by the rules in Declaring the effect, and
`bun run check:tool-effects` passes
- [ ] Chose exactly one boundary: registered `InternalToolConfig.operation` or absolute external
HTTP(S) `ToolConfig.request`
- [ ] No tool request points to `/api/...`, constructs a URL back to Sim, or declares
Expand Down
6 changes: 6 additions & 0 deletions .agents/skills/validate-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ For **every** tool file, check:
- [ ] Tool `description` is a concise one-liner describing what it does
- [ ] Tool `version` is set (`'1.0.0'` or `'2.0.0'` for V2)

### Effect
- [ ] Every tool declares `effect`, and the label matches the API docs, not the name (rules:
`add-tools` → Declaring the effect)
- [ ] Any `// tool-effect: <reason>` sits on a genuine verb/label exception, and
`bun run check:tool-effects` passes

### Params
- [ ] All required API params are marked `required: true`
- [ ] All optional API params are marked `required: false`
Expand Down
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ In addition, you will need to update the registries:
name: 'Pinecone Fetch',
description: 'Fetch vectors from Pinecone database',
version: '1.0.0',
effect: 'read', // 'write' unless it changes nothing outside Sim

// OAuth configuration (if applicable)
provider: 'pinecone', // ID of the OAuth provider
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Use the `test-audit` skill whenever you write, change, or review tests; mechanic
Build order **Tools** → **Block** → **Icon** → optional **Trigger**, from the service's API docs, using `/add-integration` (or `/add-tools`, `/add-block`, `/add-trigger`).

- **Tool IDs are `snake_case`** (`service_action`), registered in `tools/registry.ts`; blocks register alphabetically in `blocks/registry-maps.ts`.
- **Every tool declares `effect: 'read' | 'write'`**: `read` only when the call changes nothing outside Sim, `write` otherwise and whenever unsure (`ToolEffect` in `tools/types.ts`; `check:tool-effects`; rules in `/add-tools` → Declaring the effect).
- **Type coercions go in `tools.config.params`** (runs at execution), never `tools.config.tool` (runs at serialization, where `Number()` destroys `<Block.output>` references).
- **Requests made for a workspace use `outboundFetch`** (`@/lib/core/network/outbound-fetch.server`), never the global `fetch` or another imported `fetch`, so an organization with a dedicated egress gateway keeps its static IPs; `check:organization-egress` enforces this, and a request that rightly goes direct (Sim's own infrastructure, an operator-local server) takes `// egress-direct: <reason>`. AWS SDK clients signing with customer credentials take `organizationAwsRequestHandler()`: no audit catches a missing one, so reviewers check it.
- A surface listing integrations to a viewer reads `useIntegrationAccess`, never a raw catalog (`check:integration-access`).
Expand Down
44 changes: 42 additions & 2 deletions apps/docs/openapi-v2-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -6458,6 +6458,7 @@
"send": {
"toolId": "slack_message",
"toolName": "Slack Send Message",
"effect": "write",
"description": "Send a message to a Slack channel.",
"inputs": {
"text": {
Expand Down Expand Up @@ -6488,6 +6489,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -6706,6 +6708,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -6815,6 +6818,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -21943,6 +21947,11 @@
"description": "Tool version.",
"type": "string"
},
"effect": {
"type": "string",
"enum": ["read", "write"],
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no asynchronous provider job or query execution started (one with its own id that can keep running, even briefly; a synchronous read-only query is fine); no run, conversation, history item, or other resource left in an account; no contact data revealed for credits; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input. Revealing a person's contact data (email, phone) for credits is `write`; company/firmographic lookups and verifications that only spend lookup credits are `read`."
},
"hostedApiKey": {
"type": "string",
"enum": ["always", "conditional", "none"],
Expand Down Expand Up @@ -21992,7 +22001,7 @@
"description": "Fields the tool produces."
}
},
"required": ["id", "name", "description", "hostedApiKey", "params", "outputs"],
"required": ["id", "name", "description", "effect", "hostedApiKey", "params", "outputs"],
"additionalProperties": false,
"title": "Tool",
"description": "A built-in tool with its declared parameters and outputs."
Expand Down Expand Up @@ -22190,6 +22199,11 @@
"description": "Display name of that tool.",
"type": "string"
},
"effect": {
"description": "That tool's effect.",
"type": "string",
"enum": ["read", "write"]
},
"description": {
"description": "What the operation does.",
"type": "string"
Expand Down Expand Up @@ -22559,6 +22573,7 @@
"send": {
"toolId": "slack_message",
"toolName": "Slack Send Message",
"effect": "write",
"description": "Send a message to a Slack channel.",
"inputs": {
"text": {
Expand Down Expand Up @@ -22589,6 +22604,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -22657,6 +22673,11 @@
"description": "Tool version.",
"type": "string"
},
"effect": {
"type": "string",
"enum": ["read", "write"],
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no asynchronous provider job or query execution started (one with its own id that can keep running, even briefly; a synchronous read-only query is fine); no run, conversation, history item, or other resource left in an account; no contact data revealed for credits; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input. Revealing a person's contact data (email, phone) for credits is `write`; company/firmographic lookups and verifications that only spend lookup credits are `read`."
},
"hostedApiKey": {
"type": "string",
"enum": ["always", "conditional", "none"],
Expand Down Expand Up @@ -22686,7 +22707,7 @@
"additionalProperties": false
}
},
"required": ["id", "name", "description", "hostedApiKey"],
"required": ["id", "name", "description", "effect", "hostedApiKey"],
"additionalProperties": false,
"title": "Tool summary",
"description": "List view of a built-in tool: identity, auth, and key hosting."
Expand Down Expand Up @@ -22725,6 +22746,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -22756,6 +22778,7 @@
"name": "Slack Send Message",
"description": "Send a message to a Slack channel.",
"version": "1.0.0",
"effect": "write",
"hostedApiKey": "none",
"oauth": {
"required": true,
Expand Down Expand Up @@ -32932,6 +32955,23 @@
"additionalProperties": false
}
},
"effect": {
"description": "`read` when every tool the block can run changes nothing outside Sim, else `write`. Absent for a block with no `tools.access`.",
"type": "string",
"enum": ["read", "write"]
},
"operationEffects": {
"description": "Per operation id: its tool's effect, where it differs from `effect`.",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string",
"enum": ["read", "write"],
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no asynchronous provider job or query execution started (one with its own id that can keep running, even briefly; a synchronous read-only query is fine); no run, conversation, history item, or other resource left in an account; no contact data revealed for credits; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input. Revealing a person's contact data (email, phone) for credits is `write`; company/firmographic lookups and verifications that only spend lookup credits are `read`."
}
},
"dynamicOutputs": {
"description": "Present when outputs derive from a param at run time.",
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions apps/sim/app/api/v2/tools/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const summary = {
name: 'Slack Send Message',
description: 'Send a message.',
version: '1.0.0',
effect: 'write',
hostedApiKey: 'none' as const,
}

Expand Down
2 changes: 1 addition & 1 deletion apps/sim/blocks/blocks/microsoft_dynamics_365.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ describe('MicrosoftDynamics365Block tool-call mapping', () => {
vi.mocked(getToolMetadata).mockImplementationOnce(lookup).mockImplementationOnce(lookup)
function lookup(toolId: string) {
const tool = rowTools.find((candidate) => candidate.id === toolId)
return tool && { id: tool.id, params: tool.params }
return tool && { id: tool.id, effect: tool.effect, params: tool.params }
}
const rowFields = (toolId: string, operation: string) =>
getSubBlocksForToolInput(
Expand Down
19 changes: 10 additions & 9 deletions apps/sim/components/assistant-actions/review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ export function AssistantActionReviewProvider({
messageReceiptIds.set(
message.id,
new Set(
message.contentBlocks?.flatMap(({ toolCall }) =>
toolCall &&
getToolMetadata(toolCall.name)?.assistant &&
(getToolMetadata(toolCall.name)?.assistant?.effect === 'write' ||
toolCall.status === ToolCallStatus.awaiting_approval)
message.contentBlocks?.flatMap(({ toolCall }) => {
const metadata = toolCall && getToolMetadata(toolCall.name)
return toolCall &&
metadata?.assistant &&
(metadata.effect === 'write' || toolCall.status === ToolCallStatus.awaiting_approval)
? [toolCall.id]
: []
)
})
)
)
const messageStreamId =
Expand All @@ -175,10 +175,11 @@ export function AssistantActionReviewProvider({
}
turn.messageId = message.id
for (const { toolCall } of message.contentBlocks ?? []) {
if (!toolCall || !getToolMetadata(toolCall.name)?.assistant) continue
if (!toolCall) continue
const metadata = getToolMetadata(toolCall.name)
if (!metadata?.assistant) continue
turn.representedIds.add(toolCall.id)
if (getToolMetadata(toolCall.name)?.assistant?.effect === 'write')
turn.writeIds.add(toolCall.id)
if (metadata.effect === 'write') turn.writeIds.add(toolCall.id)
if (toolCall.status === ToolCallStatus.awaiting_approval) turn.hasApprovalRows = true
}
turns.set(messageStreamId, turn)
Expand Down
1 change: 1 addition & 0 deletions apps/sim/executor/handlers/api/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('ApiBlockHandler', () => {
name: 'HTTP Request Tool',
description: 'Makes an HTTP request',
version: '1.0',
effect: 'write',
params: {
url: { type: 'string', required: true },
method: { type: 'string', default: 'GET' },
Expand Down
1 change: 1 addition & 0 deletions apps/sim/executor/handlers/generic/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('GenericBlockHandler', () => {
name: 'Some Custom Tool',
description: 'Does something custom',
version: '1.0',
effect: 'write',
params: { param1: { type: 'string' } },
request: {
url: 'https://example.com/api',
Expand Down
Loading
Loading