Skip to content

fix(mcp): stop project tools advertising agent_name for a user key - #4630

Merged
vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/4616-mcp-project-agent-name
Nov 18, 2026
Merged

vybe merged 2 commits into
Abilityai:devfrom
pcbeingused333:fix/4616-mcp-project-agent-name

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4616

Description

The Workspace project tools told a user-scoped key to "pass agent_name with an admin's user key", but the backend refuses that route with 403 agent_key_required (as the docs were corrected to say in #4613). A caller who followed the advice was refused a second time with the same advice.

This is the wording-only option from the issue's technical notes:

  • the agent_key_required explanation now says the project tools need an agent-scoped key (the agent itself) and that a user key, including an admin's, is refused;
  • a user key that passes no agent_name gets that same message (nothing is sent, as before) instead of "pass agent_name";
  • the agent_name parameter on the project tools has its own description saying it is not usable with a user key, instead of the shared "admin's user key acts on behalf of an agent" text.

The asks, reports, metrics, objectives and canvas tools keep their wording and behaviour (they still use ACT_AS_PARAM_DESCRIPTION). A comment in projects.ts records that the wording is to be restored if the route is opened later. Requests that do name an agent still go out with the act-as header, so behaviour is unchanged.

Related Issue

Fixes #4616

Journey Impact

Journey Impact: none: only the wording of the MCP project tools' refusals and agent_name descriptions changes; no request a working caller sends is altered

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

node --import tsx --test src/act_as_agent.test.ts src/tools/projects.test.ts (in src/mcp-server): the tests assert that neither refusal suggests agent_name, that both name an agent-scoped key, and that create_project with agent_name answered by a 403 agent_key_required returns the agent-key guidance instead of the raw backend text. tsc --noEmit passes.

Mutation: with src/mcp-server/src/tools/projects.ts reverted to dev, 3 tests go red — "a user key without agent_name is told to use an agent's key, and nothing is sent" (act_as_agent.test.ts), "list: a string 403 is unlicensed, a code 403 is the agent-key gate", and "create_project: a 403 agent_key_required with agent_name gets the agent-key guidance" (projects.test.ts).

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • My commits are signed off (git commit -s) — required for contributors outside the core team
  • If this PR was written with an AI assistant, I say so above, and I have read and can explain every line
  • I have added appropriate logging for new functionality

This PR was prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

…bilityai#4616)

The project tools told a user-scoped key to call them with agent_name and an admin's key, but the backend refuses that with 403 agent_key_required (docs corrected in Abilityai#4613). Say instead that an agent-scoped key (the agent itself) is needed, drop the agent_name suggestion from the refusal and from the parameter description, and keep sending nothing for a user key with no agent_name. Asks, reports, metrics, objectives and canvas tools are untouched.

Signed-off-by: Alex Castillo <[email protected]>

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train 2026-11-18: validated at 636db5b (/validate-pr + /review), merged individually on Tier 1.

@vybe
vybe merged commit 0134633 into Abilityai:dev Nov 18, 2026
23 checks passed
@vybe

vybe commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Merged via merge-train 2026-11-18 — thanks! Validation found two small follow-ups, neither blocking:

  1. No test pins the new agent_name description: setting the 17 .describe(PROJECT_AGENT_NAME_DESCRIPTION) calls back to ACT_AS_PARAM_DESCRIPTION leaves the suite green (acceptance criterion 2 of MCP project tools tell a caller to pass agent_name with an admin's key, and that call is refused #4616). One test walking createProjectTools and asserting no agent_name description equals ACT_AS_PARAM_DESCRIPTION would close it.
  2. A non-admin user key passing agent_name still gets the backend's act_as_not_permitted message ("Only an admin's user key can act on behalf of an agent…") passed through by fail() in tools/projects.ts, which points the caller at an admin key that the project routes then refuse. Giving that code the same explain() treatment as agent_key_required would finish the wording fix.

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.

2 participants