Repository navigation
Conversation
tool-search now returns the closest actions the app's own agent can run that the connection doesn't serve, under notServed, with a pointer to ask_app. externalAgents.writes: "ask_app_only", set or implied, warns once that it is deprecated.
…te the access-control change
…gainst what the connection can call
…eck can't orphan a rejected one
There was a problem hiding this comment.
Builder reviewed your changes and found 2 potential issues 🟡
Review Details
Code Review Summary
This PR adds MCP tool-search hints for app actions the connection cannot call directly, while directing eligible signed-in users to ask_app. It also deprecates the blanket ask_app_only writes policy and updates the core access-control documentation, translations, template skills, and tests. The approach keeps suggestions separate from callable search results and adds targeted discovery checks; the added test coverage exercises OAuth scopes, denials, grants, and discovery failures. I classified this as high risk because it changes authorization-adjacent MCP discovery behavior.
Key Findings
- 🟡
notServedcandidates are not filtered by the caller’s service-principal action grant, which can expose names/descriptions outside the grant. - 🟡 The writes-policy deprecation warning recommends action flags that do not serve writes while
ask_app_onlyremains active.
🧪 Browser testing: Skipped — PR only modifies backend/config/docs/tests, no browser-facing UI impact.
| filterActionsAvailableForDiscovery( | ||
| Object.fromEntries( | ||
| Object.entries(mergedActions).filter( | ||
| ([name, entry]) => |
There was a problem hiding this comment.
🟡 Apply the service-principal grant to unserved matches
callable is grant-scoped, but this candidate filter uses all of mergedActions without checking the service-principal grant. A user-assurance principal with a restricted grant that includes tool-search and ask_app can therefore see names and descriptions for actions outside its grant; apply the same isActionGranted filtering used for served actions here.
| console.warn( | ||
| `[agent-native] ${setting} sends every write through ask_app, which is deprecated. ` + | ||
| `Decide each write on its action instead: \`mcpTool: false\` keeps it in the app, where outside ` + | ||
| `agents reach it through ask_app, and \`mcpTool: true\` or \`"search"\` serves it to them directly.`, |
There was a problem hiding this comment.
🟡 Clarify the required write-policy migration
With writes: "ask_app_only" (or its implied automatic-read default), setting mcpTool: true or "search" still does not serve a write; the policy filters it out. The warning’s suggested action-level change therefore has no effect unless the app also moves to writes: "allowlisted"—please make that prerequisite explicit.
There was a problem hiding this comment.
Builder reviewed your changes and has a few items to flag 🟡
Review Details
Incremental Code Review Summary
I reviewed the current PR head and rechecked the two open comments against the updated implementation. Both issues remain unchanged: notServedActions still does not apply service-principal action grants, and the ask_app_only deprecation warning still implies action flags alone can serve writes. I left those comments open and did not repost them. The update does not introduce another confirmed issue in the reviewed MCP discovery, authorization, matching, or policy paths. The implementation remains focused on advisory search results and preserves the direct-call surface; however, the open authorization and migration-guidance findings still need attention. Risk remains high because the change affects authorization-adjacent MCP behavior.
🧪 Browser testing: Skipped — PR only modifies backend/config/docs/tests, no browser-facing UI impact.
Why
Each action in an app now carries its own decision about outside agents (Claude, ChatGPT, Cursor and other MCP clients).
mcpTool: truelists it as a tool,"search"serves it throughtool-searchandcall-tool(#8921), andfalsekeeps it in the app. An outside agent reaches a kept action only by asking the app's own agent throughask_app.tool-searchsearched only what the connection serves. An agent looking for something the app keeps for its own agent found nothing, and told the person the app can't do it, when oneask_appcall would have done it.Separately,
externalAgents.writes: "ask_app_only"still keeps every write in the app at once. Now that each action carries its own decision (#8888), that blanket policy overrides the writes an app chose to serve.What changes
When a search's query, names or task match actions this connection can't call, MCP
tool-searchadds anotServedfield. It holds up to three of them, each with its name and a one-line description, and a message telling the caller to describe the task toask_app. Results the connection can call come back as before:Only a signed-in person whose connection can call
ask_appgets it. Service principals (automated callers limited to a list of actions), callers whose grant leaves outask_app, read-only tokens and apps that denyask_appsee no change. Neither does a menu search (no query, names or task) or areadOnlyOnlyone, sinceask_appisn't read-only."Can't call" is decided when the search runs, against the tools this connection can actually call, so an action the app serves but whose input MCP refuses (a raw
sqlstring, say) is named too.It never names actions the operator denies, framework tools every app carries (such as
navigate), actions the app's own agent can't run (agentTool: false), actions that end the in-app turn (endsTurn), UI-only actions, names the framework never serves over MCP (db-*,provider-api-*and the like), or anything the caller's OAuth scope or the app's discovery checks hide from this caller. (A discovery check,agentDiscoveryAvailable, is an action's own test of whether a given caller should see it, such as whether a provider it needs is connected.)Those discovery checks now run for actions kept in the app, under an MCP caller, which they never did before. So the lookup is advisory: if a check throws or hasn't answered by the 1.3-second deadline task searches already use (counted from the start of the search), the search returns its results without
notServed. Each check now starts inside its promise, so one that throws can't leave another's rejection unhandled.writes: "ask_app_only", set or implied byauthenticatedReads: "auto", logs a deprecation warning once at startup. It still works. The warning says to decide each write on its action instead:mcpTool: falseto keep it in the app.The access-control and external-agents docs, the external-agents skill (synced to the template copies) and a changeset describe both.
Risk
notServedtells a caller an action exists without letting it call the action, so the danger is naming something the caller shouldn't learn about. It goes only to a signed-in person who can already ask the app's own agent to run that action, applies the caller's OAuth scope, and leaves out what that agent can't run or what the app hides from this caller. It returns names and one-line descriptions, never parameters or schemas.The other new cost is running apps' discovery checks for actions they keep in the app. Only targeted searches run them, each check runs once per search, and a failing or slow check costs the search its
notServedfield, never its results.The warning changes no behavior. An app that relies on
ask_app_onlykeeps it until it moves its writes to per-action decisions.Verification
build-server.not-served.spec.ts: 26 tests through an in-memory MCP client. They cover what gets named: closest matches, exact names, a task's text, at most three, served writes the app sends throughask_app, and an action whose input MCP refuses. They cover what doesn't: served tools, denied,agentTool: false, UI-only and turn-ending actions, actions a discovery check hides, framework tools,db-*names, a deniedask_app, a grant withoutask_app, a read-only token, a service principal, areadOnlyOnlysearch, and a read action hidden from a write-only token through an app's owntool-search. And they cover the lookup itself: skipped for a menu search, given the caller's identity, and dropped (keeping the results) when a check throws, when one check rejects and a later one throws, and when a check never answers. The file is named afterbuild-server.tsbecause the mutation check runs only the specs named after a changed file.tool-search.spec.ts: 8 tests ofclosestToolMatches(ranking and limit, several queries plus a task, exact names in any case, what it skips, one-line descriptions) andnamesUnservedTools.mcp-options.spec.ts: 3 tests of the warning: set explicitly, implied byauthenticatedReads: "auto", and quiet forallowlistedwrites or no policy.pnpm typecheck, oxfmt and oxlint on the changed files, the three specs andpnpm guardspass.src/mcp,src/agent,src/server/agent-chatandaction.spec.tspass (364 files, 9,514 tests), andpnpm mutation:changedscores 87.8% against its 50% threshold. The two added assertions cover the surviving mutants that changed behavior; the rest leave output unchanged, such as fields of a search candidate that never reach the response.🤖 Generated with Claude Code