AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
fix(mcp): AI clients see accurate safety labels on flow editing and publishing tools (#16014)
Hazem Adel4d36e6a3e28b
diff --git a/brain/knowledge/ai-intelligence/mcp-server.md b/brain/knowledge/ai-intelligence/mcp-server.mdindex d6bb3bbb3f9..c0270a900f6 100644--- a/brain/knowledge/ai-intelligence/mcp-server.md+++ b/brain/knowledge/ai-intelligence/mcp-server.md@@ -86,8 +86,9 @@ Exposes an Activepieces project as an MCP server so AI clients (Claude Desktop,- **`email_verified` is `user_identity.verified`, and that flag means different things per signup path.** Cloud's passwordless path creates the identity `verified: false` and only flips it after the OTP is entered, and Google/SAML/SCIM are attested by the IdP — all genuine. But `authenticationService.signUp` (the CE/EE password path) creates the identity `verified: true` outright, with no mailbox confirmation, so on a self-host with `AP_ALLOW_OPEN_SIGN_UP=true` anyone can register any address and have us assert `email_verified: true` for it. `assertDomainIsAllowed` is not a backstop there: it returns early on Community and on any platform without `ssoEnabled`. Two consequences — a relying party doing enterprise domain restriction is trusting our signup path, not a mailbox check; and a platform whose users never verified will fail such a check outright. Fixing this properly means not auto-verifying on the password path, which needs SMTP that a CE install may not have.- **One bearer gate gets it right for both surfaces.** `mcpOAuthTokenService.authenticate` (verify + revocation-list check, 503 on a revocation-store outage, never fail-open) backs both `POST /mcp` and `/userinfo`. Adding a token check to only one of them is the bug this consolidation exists to prevent, and `/userinfo` is the laxer copy's blast radius because it returns PII.- External MCP-server validation for the agent piece lives under `agents/`, NOT here (it's a probe, not the AP-as-server feature).-- **Every registered tool must declare all three safety hints** — `readOnlyHint`, `destructiveHint`, `openWorldHint`. `McpToolDefinition.annotations` is optional and `buildToolConfig` passes it straight through, so an omitted hint is silent: MCP clients fall back to protocol defaults, but a ChatGPT Apps submission treats any missing hint as a blocker. The two dynamic paths are the easiest to miss because they build their tool config inline instead of from an `McpToolDefinition` — `registerFlowTools` (one tool per enabled MCP-trigger flow) and `registerPlaceholderTools` (the no-project-selected state, which is what a fresh external reviewer meets first). Placeholders annotate per list — locked names get the read-only triple, controllable names get `destructive: true, openWorld: true` — so a stand-in never advertises itself as safer than the tool it represents.-- **`openWorldHint` means the tool can change state in a third-party system**, not that it makes an outbound call. Anything that executes real connector steps needs it: `ap_test_flow`, `ap_test_step`, `ap_retry_run`, `ap_run_action`, and every dynamic flow tool. A read that only calls a connected account to populate dropdowns (`ap_get_piece_props`, `ap_resolve_property_options`, `ap_resolve_property_chain`) does not. `ap_retry_run` originally declared `false` here and was wrong — a retry re-runs the published flow and can resend the same Slack message or repeat an outbound write.+- **Every registered tool must declare all three safety hints** — `readOnlyHint`, `destructiveHint`, `openWorldHint`. `McpToolDefinition.annotations` is optional and `buildToolConfig` passes it straight through, so an omitted hint is silent: MCP clients fall back to protocol defaults, but a ChatGPT Apps submission treats any missing hint as a blocker. The two dynamic paths are the easiest to miss because they build their tool config inline instead of from an `McpToolDefinition` — `registerFlowTools` (one tool per enabled MCP-trigger flow) and `registerPlaceholderTools` (the no-project-selected state, which is what a fresh external reviewer meets first). Placeholders annotate per list — locked names get `readOnly: true, destructive: false, openWorld: true` (some locked tools reach a connected account), controllable names get `destructive: true, openWorld: true` — so a stand-in never advertises itself as safer than the tool it represents.+- **`openWorldHint` means the tool talks to a connected third-party account at all, reads included.** OpenAI's ChatGPT Apps scan rejected the narrower "only if it writes to a third party" reading. So it is `true` on anything that runs connector code: `ap_test_flow`, `ap_test_step`, `ap_retry_run`, `ap_run_action`, every dynamic flow tool, the dropdown resolvers that run `EXECUTE_PROPERTY` with the user's connection (`ap_get_piece_props`, `ap_resolve_property_options`, `ap_resolve_property_chain`), and anything that enables a flow (`ap_lock_and_publish`, `ap_change_flow_status`), since enabling runs the trigger's `onEnable` against the service.+- **`destructiveHint` is `true` for anything that is not purely additive**, overwrites included. The same scan flagged `ap_update_step`, `ap_update_trigger` and `ap_manage_notes` (it has a `DELETE` op). Don't mark a tool `false` because its common path is additive; one destructive operation in the tool makes it `true`. Anything that runs real connector steps (`ap_run_action`, `ap_test_flow`, `ap_test_step`, `ap_retry_run`, every dynamic flow tool) is `true` too, because the step it runs can delete or overwrite in the third-party system. So are `ap_lock_and_publish` (replaces the live version) and `ap_change_flow_status` (can switch off a running flow). `mcp-activity-recorder.test.ts` pins the exact destructive and open-world sets, so a flip has to update that test on purpose.- The hints are **advisory metadata for the client, never enforcement**. Authorization stays with `permissionChecker.wrapExecute` and each tool's `permission`; changing an annotation changes what a client is told, not what a caller is allowed to do.- **A `❌` in a tool result is not a failure signal — `isError` is, and most error returns omit it.** `McpToolResult.isError` is optional, so anything deriving an outcome from a tool call (an activity row, telemetry, a client's retry logic) reads a bare `{ content: [...] }` as success no matter what the text says, and `structuredContent.errorSummary` is not a substitute — nothing reads it as a status. The `mcpUtils` helpers set the flag (`mcpToolError`, `lookupPieceComponent`, `validateAuth`); inline error returns are where it goes missing, and `executePieceActionRun` had seven of them, including the failed-run path that formats `❌ … failed (run …)` from a terminal `FAILED` outcome. Set it where the failure is known rather than at the call site, and grep the file for `isError` before trusting any status derived from a tool result.- **Activity recording is a decorator around the tool, never a hook inside `wrapExecute`.** `mcp_activity` records exactly one tool — the predicate is `tool.title === 'ap_run_action'`, the only tool that runs a real connector step against a real connected account. The obvious place to hang that is `PermissionChecker.wrapExecute`, since it already wraps every static tool. It is the wrong place: **CE uses `ALLOW_ALL`, whose `wrapExecute` is the identity function**, so a recorder hung there silently records nothing in Community Edition and everything in Cloud/EE — a divergence that would look like a data bug, not an edition bug. `withActivityRecording` composes *around* the already-permission-wrapped `execute` at the registration sites in `mcp-server-builder.ts` instead. Only two sites can now fire: `registerStaticTools` and the late-bound branch of `registerPlatformTools` — `ap_run_action` is not in `PLATFORM_LEVEL_TOOL_NAMES` (those five are all read-only), so that branch registers `tool.execute` bare.diff --git a/packages/server/api/src/app/mcp/mcp-server-builder.ts b/packages/server/api/src/app/mcp/mcp-server-builder.tsindex a0ee19cc30c..de8a70bda3f 100644--- a/packages/server/api/src/app/mcp/mcp-server-builder.ts+++ b/packages/server/api/src/app/mcp/mcp-server-builder.ts@@ -358,9 +358,9 @@ function buildToolConfig(tool: McpToolDefinition): Record<string, unknown> {}}-const FLOW_TOOL_ANNOTATIONS = { readOnlyHint: false, destructiveHint: false, openWorldHint: true }-const LOCKED_PLACEHOLDER_ANNOTATIONS = { readOnlyHint: true, destructiveHint: false, openWorldHint: false }-const CONTROLLABLE_PLACEHOLDER_ANNOTATIONS = { readOnlyHint: false, destructiveHint: true, openWorldHint: true }+export const FLOW_TOOL_ANNOTATIONS = { readOnlyHint: false, destructiveHint: true, openWorldHint: true }+export const LOCKED_PLACEHOLDER_ANNOTATIONS = { readOnlyHint: true, destructiveHint: false, openWorldHint: true }+export const CONTROLLABLE_PLACEHOLDER_ANNOTATIONS = { readOnlyHint: false, destructiveHint: true, openWorldHint: true }type RegisterToolsParams = {server: McpServerdiff --git a/packages/server/api/src/app/mcp/tools/ap-change-flow-status.ts b/packages/server/api/src/app/mcp/tools/ap-change-flow-status.tsindex 0c8d32f4689..627c97c5202 100644--- a/packages/server/api/src/app/mcp/tools/ap-change-flow-status.ts+++ b/packages/server/api/src/app/mcp/tools/ap-change-flow-status.ts@@ -20,7 +20,7 @@ export const apChangeFlowStatusTool = ({ mcp, userId }: McpToolContext, log: FasflowId: z.string().describe('The id of the flow'),status: z.enum([FlowStatus.ENABLED, FlowStatus.DISABLED]).describe('The new status: ENABLED to activate the flow, DISABLED to pause it'),},- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },execute: async (args) => {const { flowId, status } = changeFlowStatusInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-get-piece-props.ts b/packages/server/api/src/app/mcp/tools/ap-get-piece-props.tsindex 138c837c12b..1b3d57e089b 100644--- a/packages/server/api/src/app/mcp/tools/ap-get-piece-props.ts+++ b/packages/server/api/src/app/mcp/tools/ap-get-piece-props.ts@@ -16,7 +16,7 @@ export const apGetPiecePropsTool = (mcp: ProjectScopedMcpServer, log: FastifyBastitle: 'ap_get_piece_props',description: 'Get the input schema for a piece action or trigger, plus AI guidance for using it: an AI-written description of what it does, an idempotency hint, and — when available — the output field paths it produces (for triggers, also derived from sample data). Use the AI description to pick the right action; when output fields are listed, reference them directly downstream as {{step[\'output\'].path}}. Pass auth to resolve dynamic dropdowns and dynamic property sub-fields (e.g. Custom API Call url/body fields).',inputSchema: getPiecePropsInput.shape,- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },execute: async (args) => {try {const { pieceName, actionOrTriggerName, type, auth, flowId, input: providedInput } = getPiecePropsInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-lock-and-publish.ts b/packages/server/api/src/app/mcp/tools/ap-lock-and-publish.tsindex ffe129dc9e9..864923f18fd 100644--- a/packages/server/api/src/app/mcp/tools/ap-lock-and-publish.ts+++ b/packages/server/api/src/app/mcp/tools/ap-lock-and-publish.ts@@ -18,7 +18,7 @@ export const apLockAndPublishTool = ({ mcp, userId }: McpToolContext, log: FastiinputSchema: {flowId: z.string().describe('The id of the flow to publish'),},- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },execute: async (args) => {const { flowId } = lockAndPublishInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-manage-notes.ts b/packages/server/api/src/app/mcp/tools/ap-manage-notes.tsindex bb90471cc5f..a158ca3c3b6 100644--- a/packages/server/api/src/app/mcp/tools/ap-manage-notes.ts+++ b/packages/server/api/src/app/mcp/tools/ap-manage-notes.ts@@ -42,9 +42,7 @@ export const apManageNotesTool = ({ mcp, userId }: McpToolContext, log: FastifyBheight: z.number(),}).optional().describe('Size of the note (optional, defaults to 200x200)'),},- // destructiveHint is false because ADD and UPDATE are the common paths;- // DELETE is possible but clients shouldn't over-restrict the whole tool.- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },execute: async (args) => {const { flowId, operation: op, noteId, content, color, position, size } = manageNotesInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-resolve-property-chain.ts b/packages/server/api/src/app/mcp/tools/ap-resolve-property-chain.tsindex 01bb5a6ac1b..b62ec66386d 100644--- a/packages/server/api/src/app/mcp/tools/ap-resolve-property-chain.ts+++ b/packages/server/api/src/app/mcp/tools/ap-resolve-property-chain.ts@@ -14,7 +14,7 @@ export const apResolvePropertyChainTool = (mcp: ProjectScopedMcpServer, log: Fastitle: 'ap_resolve_property_chain',description: 'Resolve a chain of dependent dropdown properties in one call. For actions with cascading fields (e.g. Spreadsheet → Sheet → Columns), this resolves each property sequentially, feeding each selected value into the next resolution. Pass `selectedValue` for properties whose value you already know; the tool stops and returns options when it hits a property without a `selectedValue`. Always use `value` from returned options, not `label`.',inputSchema: resolvePropertyChainInput.shape,- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },execute: async (args) => {try {const { pieceName, actionOrTriggerName, type, propertyChain, auth, currentInput: providedInput } = resolvePropertyChainInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-resolve-property-options.ts b/packages/server/api/src/app/mcp/tools/ap-resolve-property-options.tsindex e39a2aa3cca..ccfb31380a2 100644--- a/packages/server/api/src/app/mcp/tools/ap-resolve-property-options.ts+++ b/packages/server/api/src/app/mcp/tools/ap-resolve-property-options.ts@@ -10,7 +10,7 @@ export const apResolvePropertyOptionsTool = (mcp: ProjectScopedMcpServer, log: Ftitle: 'ap_resolve_property_options',description: 'Resolve dropdown options for a single piece property. Returns the available options with labels and values (IDs). Use this to discover valid values for DROPDOWN fields (e.g. Slack channels, Google Sheets, email labels). Always use the `value` from the returned options, not the `label`.',inputSchema: resolvePropertyOptionsInput.shape,- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },execute: async (args) => {const { pieceName, actionOrTriggerName, type, propertyName, auth, input: providedInput, searchValue } = resolvePropertyOptionsInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-retry-run.ts b/packages/server/api/src/app/mcp/tools/ap-retry-run.tsindex 22284aa7dde..0f96adc557f 100644--- a/packages/server/api/src/app/mcp/tools/ap-retry-run.ts+++ b/packages/server/api/src/app/mcp/tools/ap-retry-run.ts@@ -20,7 +20,7 @@ export const apRetryRunTool = (mcp: ProjectScopedMcpServer, log: FastifyBaseLoggpermission: Permission.WRITE_RUN,description: 'Retry a failed flow run. FROM_FAILED_STEP resumes at failure point, ON_LATEST_VERSION re-runs entirely.',inputSchema: retryRunInput.shape,- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },execute: async (args) => {try {const { flowRunId, strategy } = retryRunInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-test-flow.ts b/packages/server/api/src/app/mcp/tools/ap-test-flow.tsindex 34a0d359fce..90dd81b5277 100644--- a/packages/server/api/src/app/mcp/tools/ap-test-flow.ts+++ b/packages/server/api/src/app/mcp/tools/ap-test-flow.ts@@ -17,7 +17,7 @@ export const apTestFlowTool = ({ mcp, userId }: McpToolContext, log: FastifyBasepermission: Permission.WRITE_FLOW,description: 'Test a flow end-to-end in the test environment. Requires a configured trigger. Waits up to 120s. Pass triggerTestData to provide mock trigger output when no sample data exists.',inputSchema: testFlowInput.shape,- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },execute: async (args) => {try {const { flowId, triggerTestData } = testFlowInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-test-step.ts b/packages/server/api/src/app/mcp/tools/ap-test-step.tsindex 9b8a607379a..46aa2badb15 100644--- a/packages/server/api/src/app/mcp/tools/ap-test-step.ts+++ b/packages/server/api/src/app/mcp/tools/ap-test-step.ts@@ -18,7 +18,7 @@ export const apTestStepTool = ({ mcp, userId }: McpToolContext, log: FastifyBasepermission: Permission.WRITE_FLOW,description: 'Test a single step within a flow. Runs all steps up to and including the specified step. The flow must have a configured trigger. Pass triggerTestData when no sample data exists.',inputSchema: testStepInput.shape,- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },execute: async (args) => {try {const { flowId, stepName, triggerTestData } = testStepInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-update-branch.ts b/packages/server/api/src/app/mcp/tools/ap-update-branch.tsindex c135a44d69a..c16503d3e52 100644--- a/packages/server/api/src/app/mcp/tools/ap-update-branch.ts+++ b/packages/server/api/src/app/mcp/tools/ap-update-branch.ts@@ -26,7 +26,7 @@ export const apUpdateBranchTool = ({ mcp, userId }: McpToolContext, log: FastifybranchName: z.string().optional().describe('New display name for the branch'),conditions: mcpUtils.BRANCH_CONDITIONS_INPUT_SCHEMA.optional().describe('New conditions array (outer array = OR groups, inner array = AND conditions). Replaces the existing conditions entirely.'),},- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },execute: async (args) => {try {const { flowId, routerStepName, branchIndex, branchName, conditions } = updateBranchInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-update-record.ts b/packages/server/api/src/app/mcp/tools/ap-update-record.tsindex 94af2bee249..a461bb883de 100644--- a/packages/server/api/src/app/mcp/tools/ap-update-record.ts+++ b/packages/server/api/src/app/mcp/tools/ap-update-record.ts@@ -18,7 +18,7 @@ export const apUpdateRecordTool = (mcp: ProjectScopedMcpServer, log: FastifyBasepermission: Permission.WRITE_TABLE,description: 'Update specific cells in a record. Only specified fields are changed.',inputSchema: updateRecordInput.shape,- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },execute: async (args) => {try {const { tableId, recordId, fields: fieldValues } = updateRecordInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-update-step.ts b/packages/server/api/src/app/mcp/tools/ap-update-step.tsindex 0aa658b8f91..1da54d07ecf 100644--- a/packages/server/api/src/app/mcp/tools/ap-update-step.ts+++ b/packages/server/api/src/app/mcp/tools/ap-update-step.ts@@ -41,7 +41,7 @@ export const apUpdateStepTool = ({ mcp, userId }: McpToolContext, log: FastifyBacontinueOnFailure: z.boolean().optional().describe('For CODE/PIECE steps: set true on the step that can fail (the one whose failure you want to react to), NOT on the recovery step. The flow keeps running on failure and the step gains On success / On failure branches — add handler steps into them with ap_add_step using stepLocationRelativeToParent INSIDE_ON_SUCCESS_BRANCH / INSIDE_ON_FAILURE_BRANCH and parentStepName = this step.'),retryOnFailure: z.boolean().optional().describe('For CODE/PIECE steps: whether to retry this step on failure.'),},- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },execute: async (args) => {const { flowId, stepName, displayName, input, auth, actionName, loopItems, skip, sourceCode, packageJson, continueOnFailure, retryOnFailure } = updateStepInput.parse(args)diff --git a/packages/server/api/src/app/mcp/tools/ap-update-trigger.ts b/packages/server/api/src/app/mcp/tools/ap-update-trigger.tsindex 9150b0e8205..492c42bc32c 100644--- a/packages/server/api/src/app/mcp/tools/ap-update-trigger.ts+++ b/packages/server/api/src/app/mcp/tools/ap-update-trigger.ts@@ -29,7 +29,7 @@ export const apUpdateTriggerTool = ({ mcp, userId }: McpToolContext, log: Fastifauth: z.string().optional().describe('Connection `externalId` from `ap_list_connections`. The tool wraps it automatically as `{{connections[\'externalId\']}}`.'),displayName: z.string().optional().describe('Display name for the trigger step'),},- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },execute: async (args) => {const { flowId, pieceName, triggerName, input: rawInput, auth, displayName: rawDisplayName } = updateTriggerInput.parse(args)diff --git a/packages/server/api/test/unit/app/mcp/mcp-activity-recorder.test.ts b/packages/server/api/test/unit/app/mcp/mcp-activity-recorder.test.tsindex ef2a5dd978b..fdcabe8ddf0 100644--- a/packages/server/api/test/unit/app/mcp/mcp-activity-recorder.test.ts+++ b/packages/server/api/test/unit/app/mcp/mcp-activity-recorder.test.ts@@ -3,6 +3,7 @@ import { MCP_ACTIVITY_PAYLOAD_MAX_BYTES, McpServerType, McpToolResult, ProjectScimport { FastifyBaseLogger } from 'fastify'import { describe, expect, it } from 'vitest'import { capPayload, runActionFieldsFrom, shouldRecord, withActivityRecording } from '../../../../src/app/mcp/activity/mcp-activity-recorder'+import { CONTROLLABLE_PLACEHOLDER_ANNOTATIONS, FLOW_TOOL_ANNOTATIONS, LOCKED_PLACEHOLDER_ANNOTATIONS } from '../../../../src/app/mcp/mcp-server-builder'import { activepiecesTools } from '../../../../src/app/mcp/tools'const noopLog: FastifyBaseLogger = {@@ -37,6 +38,58 @@ describe('MCP activity recording predicate', () => {expect(missing).toEqual([])})+ it('flags exactly the tools that can overwrite, delete, or run connector steps as destructive', () => {+ const destructive = activepiecesTools(mcp, apId(), noopLog)+ .filter((tool) => tool.annotations?.destructiveHint === true)+ .map((tool) => tool.title)+ .sort()++ expect(destructive).toEqual([+ 'ap_change_flow_status',+ 'ap_delete_branch',+ 'ap_delete_flow',+ 'ap_delete_records',+ 'ap_delete_step',+ 'ap_delete_table',+ 'ap_lock_and_publish',+ 'ap_manage_fields',+ 'ap_manage_notes',+ 'ap_retry_run',+ 'ap_run_action',+ 'ap_test_flow',+ 'ap_test_step',+ 'ap_update_branch',+ 'ap_update_record',+ 'ap_update_step',+ 'ap_update_trigger',+ ])+ })++ it('flags exactly the tools that reach a connected third-party account as open-world', () => {+ const openWorld = activepiecesTools(mcp, apId(), noopLog)+ .filter((tool) => tool.annotations?.openWorldHint === true)+ .map((tool) => tool.title)+ .sort()++ expect(openWorld).toEqual([+ 'ap_change_flow_status',+ 'ap_get_piece_props',+ 'ap_lock_and_publish',+ 'ap_resolve_property_chain',+ 'ap_resolve_property_options',+ 'ap_retry_run',+ 'ap_run_action',+ 'ap_test_flow',+ 'ap_test_step',+ ])+ })++ it('never labels a dynamic flow tool or placeholder as safer than the tool it stands for', () => {+ expect(FLOW_TOOL_ANNOTATIONS).toEqual({ readOnlyHint: false, destructiveHint: true, openWorldHint: true })+ expect(LOCKED_PLACEHOLDER_ANNOTATIONS).toEqual({ readOnlyHint: true, destructiveHint: false, openWorldHint: true })+ expect(CONTROLLABLE_PLACEHOLDER_ANNOTATIONS).toEqual({ readOnlyHint: false, destructiveHint: true, openWorldHint: true })+ })+it('records ap_run_action and nothing else', () => {const tools = activepiecesTools(mcp, apId(), noopLog)const recorded = tools.filter(shouldRecord).map((tool) => tool.title)