Skip to content

🧰 feat: Let a Schedule's Owner Authorize Each of the Agent's Tools, or Everything at Once - #18465

Draft
danny-avila wants to merge 2 commits into
devfrom
danny-avila/schedule-grant-all-tools
Draft

danny-avila wants to merge 2 commits into
devfrom
danny-avila/schedule-grant-all-tools

Conversation

@danny-avila

@danny-avila danny-avila commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

With interface.schedules.mcpConsent.enabled on, a schedule's owner authorizes the tools it may use while they are away. That authorization could only be offered for an agent whose tools were all MCP tools. An agent that also had code execution, web search, file search or an action could not be authorized at all: the offer failed, and a run of a schedule that had a grant was refused outright if its agent gained such a tool. Once the owner edited such a schedule, or the operator's deadline passed (#18274), its MCP tools stayed refused with nothing the owner could do.

After this change each of an agent's other tools is its own item in the offer, allowed or left out exactly like an MCP tool, and the dialog has one control that allows every server and tool at once.

  • A tool the owner allowed loads and runs.
  • A tool the owner left out is not loaded for the run and does not stop it.
  • The grant stores the choice per agent.

A grant still needs at least one MCP tool. A schedule whose agents use no MCP server has nothing to authorize and runs as before. An API key's grant (#18280) is unchanged and limits MCP tools only.

Related to #18260, #18274, #13824.

How it works

GET /api/schedules/:id/mcp-consent
  tools   { offered: ['execute_code', 'send_action_mail.example', 'web_search'],   # new
            allowed: ['web_search'] }

POST /api/schedules/:id/mcp-consent
  { ..., allow: { warehouse: ['query'] },
         tools: ['web_search'] }      # new; each must be on offer
                                      # left out: keeps what the stored grant allows
                                      # []: allows none
// Schedule.mcpConsent, beside `consents`. Optional and additive.
tools?: { agentId: string; tools: string[] }[];   // the non-MCP tools the owner allowed, per agent
offer      enrollment.ts   createScheduleMCPOffer(deps) -> { targets, tools }
                           one walk of the agent graph serves both; `tools` = every key an agent
                           carries that is neither an MCP tool nor an SDK control
confirm    service.ts      each chosen tool must be on offer; stored per agent that has it;
                           the offer digest covers the offered tools
load       execution.ts    narrow(agentId, keys): a non-MCP key loads only if the grant lists it
run        run.ts          the PreToolUse hook allows a non-MCP tool the grant lists;
                           the code environment's tools are all allowed by `execute_code`
readiness  mcp.ts          an agent's other tools no longer refuse the run

What counts as an item is the agent's own tool list: code execution, web search, file search, each action by its key, and any other tool the agent carries. The SDK's own controls (subagent, tool search, ask-user-question, handoffs) are not items and always load.

A grant made before this change lists none of these tools, so under it none of them loads until the owner confirms again. Such a grant could only have been made for an agent that had no such tools.

Type of change

  • Feature

Testing

Tested environments/configuration: WSL2, Node.js 24. Storage tests run against mongodb-memory-server. No external services.

Automated tests:

  • packages/api/src/schedules/authorization/enrollment.spec.ts: an agent with other tools is offered a grant; each tool is listed per agent, the SDK controls are not; both halves of the offer come from one walk; a grant that limits MCP tools only offers none.
  • packages/api/src/schedules/authorization/service.spec.ts (the agents' tools that are not MCP tools): offered once each with nothing allowed at first; stored for every agent that has them; nothing stored when none is allowed; a tool not on offer is rejected without writing; a confirmation that does not say keeps the stored choice for tools still on offer; a confirmation is bound to the tools the owner was shown.
  • packages/api/src/schedules/authorization/execution.spec.ts: under a grant a run loads the MCP tools and the other tools the owner allowed, per agent, and the SDK controls; none of the other tools when none was allowed; all of them under a grant that limits MCP tools only; the run hook allows an allowed tool, allows the code environment's tools only with code execution, and refuses a tool the owner left out or was never offered; once the grant has run out or been revoked the other tools neither load nor are allowed.
  • packages/api/src/schedules/authorization/runtime.spec.ts: a run is not refused because its agent has other tools; one that selects no MCP tool still is.
  • packages/api/src/agents/__tests__/initialize.test.ts: the initializer asks the loader only for the tools the owner allowed, MCP or not.
  • packages/data-provider/src/types/scheduleConsent.spec.ts, packages/data-schemas/src/methods/scheduleConsent.spec.ts: the request and stored shapes; a grant without the field reads as before; the choice survives revocation.
  • client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx: each other tool is its own box, named for built-in tools and shown by key otherwise; only ticked ones are sent; "Allow everything" ticks and sends every server, tool and other tool; the stored choice pre-fills, and is named when there is nothing to confirm.

Eleven mutations (the load filter, the deadline and revocation check, the hook, the code-tool rule, the offer check, the carry-over, the digest, the MCP-only option, the readiness check, and the two dialog behaviours) each fail a test.

npx tsc --noEmit is clean in packages/api, packages/data-schemas, packages/data-provider and client.

Not verified: in a browser, or against a running server. There are no screenshots yet of the new group and button.

Performance

Reading the consent view resolves the offer once: the MCP half and the other-tools half share one walk of the agent graph, one owner read and one configuration read. Confirming adds nothing. During a run the grant's other tools are a per-agent set built when the grant is attached, so loading and each tool call add set lookups only. No database or network call is added to a run. I did not measure latency before and after.

Risk / compatibility

Under a grant, an agent's other tools now load only if the owner allowed them. Before, an agent with such tools could not hold a grant, so no working schedule loses a tool it was using.

Revoking during a run stops the other tools from the next run, not at once. An MCP call is checked against the stored grant when it is made; the other tools have no such check, so a run holds them to the grant it read when it started. They stop at the grant's deadline, and a grant already revoked or expired when the run starts allows none.

A run is no longer refused because its agent gained another tool after the grant was made. The tool is left out until the owner confirms again.

Not items yet: tools that do not come from the agent's tool list, such as skills and memory. Under a grant they are still refused with tool_policy_denied, as before.

An "all tools on this server" selection and stdio servers still cannot be authorized, as before.

Mixed versions: the stored grant gains one optional field and the stored schema is strict, so a replica without this change reads a grant that lists other tools as incompatible and refuses its runs, as for the earlier consent fields.

Schedule consent is off by default.

…r Everything at Once

A schedule's grant could only be offered for an agent whose tools were all MCP tools. An
agent that also had code execution, web search, file search or an action could not be
authorized at all, and once its owner edited the schedule or the operator's deadline
passed its MCP tools stayed refused with no way out.

Each of an agent's other tools is now its own item in the offer, allowed or left out like
an MCP tool. The grant stores the ones the owner allowed, per agent. Under a grant, one
the owner left out is not loaded for the run and does not stop it; one the owner allowed
loads and runs, with the code environment's tools all allowed by code execution. The
dialog lists them in their own group and gains one control that allows every server and
tool at once. An API key's grant still limits MCP tools only.
…cation

An MCP call is checked against the stored grant when it is made. The agents' other tools
have no such call, so a grant that had expired or been revoked still loaded and allowed
them. The run now holds them to the grant it read when it started: none loads from a
revoked grant, and they stop at the grant's deadline.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant