Repository navigation
feat: add sf agent mcp asset afscript (W-24729191) - #519
Merged
nico-pappagianis merged 10 commits intoNov 16, 2026
Merged
nico-pappagianis merged 10 commits into
nico-pappagianis merged 10 commits into
Conversation
Live 264 org: asset list returns no active field. Only active=false blocks now.
Human output places action blocks at 8 spaces and reasoning entries at 12, as Agentforce Builder does. Live check: every non-blank line equals the Builder modal output.
…729191) The asset list returns 15-char ids, so an exact compare rejected a correct 18-char id before the API call. An 18-char id with a wrong checksum still counts as missing.
…and --subagent (W-24729191) With --authoring-bundle <name> and one or more --subagent <name>, the command adds each action block under the subagent's actions: and each reasoning action under its reasoning: actions:, the places Agentforce Builder uses. It creates a missing section, skips an action the subagent already has, then compiles the bundle in the org and restores the file if the compile fails. Without the flags it prints the blocks as before.
adharsh-salesforce
force-pushed
the
w24729191-mcp-asset-afscript
branch
from
November 13, 2026 18:56
18264f8 to
455c37b
Compare
…4729191) A live run on a workspace org showed the compile call can throw (AgentApiNotFound) instead of returning errors. The command now restores the .agent file in that case too and fails with AgentScriptCompileUnavailable. Adds command tests for the three compile outcomes: success, compile errors, and a thrown compile error.
…729191) Compiling is a separate API (agent validate authoring-bundle). Calling it from this command blocked every run where that API is not reachable, and blocked agents that already had unrelated compile errors. The command now only writes the blocks and reports what it added and skipped; validate the bundle after it.
2.5.0 is the first release with McpAgentScript.generateActions, which agent mcp asset afscript calls.
nico-pappagianis
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the command
sf agent mcp asset afscript -i <0Le server id> --tool <name> [--asset-id <1XO id>]. The command resolves the tool names and asset ids on the MCP server, callsMcpAgentScript.generateActions, and prints the action blocks and reasoning entries. The text output is indented for the.agentfile (8 and 12 spaces).--jsonreturns the blocks without indentation. The help text says that the API also assigns MCP runtime permissions.Why
The output is the same text that Agentforce Builder writes. A headless
.agentfile gets the same key,sourceandtargetas Builder. On a 264 development org, all non-blank lines matched the Builder output.How tested
yarn build,yarn lint,yarn test: exit 0, including the JSON schema check.test/commands/agent/mcp/mcp.test.ts: 34 passing.MCP tool call success.Dependency
This PR needs forcedotcom/agents#395 (same change as #393) (adds
McpAgentScript.generateActions). Before merge, release@salesforce/agentsand bump it inpackage.json(^2.4.0on main today). This branch does not changepackage.jsonyet, so CI is expected to fail until the bump.Notes
--toolvalues first, then all--asset-idvalues.🤖 Generated with Claude Code
Work item: @W-24729191@
Same change as #515. This copy comes from the fork of the internal account
adharsh-salesforce, to check the CLA.Update an authoring bundle (--authoring-bundle, --subagent)
From review feedback: instead of printing the blocks for someone to paste, the command can now add them to a local authoring bundle.
sf agent mcp asset afscript -o myOrg -i <0Le server id> --tool hello_world --authoring-bundle My_Agent --subagent order_status --subagent returnsactions:(8 spaces) and each reasoning action underreasoning:>actions:(12 spaces), the places Agentforce Builder uses. It creates a missingactions:,reasoning:or reasoningactions:section.--jsonadds abundlefield with the same data.findAuthoringBundlefrom@salesforce/agentsand writes the.agentfile. It does not compile it: compiling is a separate API, so runsf agent validate authoring-bundleafter it. (An earlier version compiled the bundle; that blocked every run where the compile API is not reachable, such as dev workspace orgs, and every agent that already had unrelated compile errors.)--target-org, like the other commands that work on a bundle.Tests: new
test/commands/agent/mcp/afscriptBundle.test.ts: 7 tests for the insert (existing sections, missing sections, idempotent second run, other subagents unchanged, unknown subagent, start agent, CRLF) and 2 command tests (writes the file and does not callAgent.init; a second run changes nothing). The 36 existing mcp tests still pass. I also ran the insert on a real.agentfile from an end-to-end test (it skipped the action the subagent already had and added only the new one), and live against a dev org on a workspace.command-snapshot.jsonandschemas/agent-mcp-asset-afscript.jsonare updated for the new flags and thebundlefield.All commits on this branch are signed now.
End-to-end test (2026-11-16)
On a dev org with the Core API from 264.13, a headless Claude with the agentforce-generate skill (updated in project-codey #4572) got "add the MCP tool calculate_quote from the MCP server ComplexESTypeFinal to the router of the agent P0Mcp_SkillTest, then validate and deploy it".
sf agent mcp asset afscript -i <server> --tool calculate_quote --authoring-bundle P0Mcp_SkillTest --subagent agent_router --jsonand made no hand edit to the.agentfile. The command reportedadded: [<key>],skipped: [].start_agent agent_router. The action block and the reasoning entry are byte-equal to the--jsonoutput, and the key equals the tool's GenAiFunctionDefinition DeveloperName.filtered 0 inaccessible actionsandMCP tool call success: <key>.Merge order: forcedotcom/agents#395 and its release, then this PR with the
@salesforce/agentsbump, then the skill in project-codey #4572.