Repository navigation
fix: update topic->subagent @W-21951412@ - #393
Merged
Merged
Conversation
shetzel
approved these changes
Apr 20, 2026
shetzel
left a comment
Contributor
There was a problem hiding this comment.
NUTs are known to fail due to a server side issue.
nico-pappagianis
pushed a commit
that referenced
this pull request
Nov 16, 2026
## 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, calls `McpAgentScript.generateActions`, and prints the action blocks and reasoning entries. The text output is indented for the `.agent` file (8 and 12 spaces). `--json` returns 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 `.agent` file gets the same key, `source` and `target` as 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. - Live run against the Core API on a 264 development org. - Runtime check: an agent built from the output called the MCP tool in Builder preview. The reasoner logged `MCP tool call success`. ## Dependency This PR needs forcedotcom/agents#395 (same change as #393) (adds `McpAgentScript.generateActions`). Before merge, release `@salesforce/agents` and bump it in `package.json` (`^2.4.0` on main today). This branch does not change `package.json` yet, so CI is expected to fail until the bump. ## Notes - The output lists all `--tool` values first, then all `--asset-id` values. - An org below API 68.0 gets a clear not-found message. - Input errors exit with code 1. API errors exit with code 4. 🤖 Generated with [Claude Code](https://claude.com/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 returns` - The two flags need each other. Without them the command prints the blocks as before. - For each subagent (or the start agent), it adds each action block under `actions:` (8 spaces) and each reasoning action under `reasoning:` > `actions:` (12 spaces), the places Agentforce Builder uses. It creates a missing `actions:`, `reasoning:` or reasoning `actions:` section. - It skips an action key that the subagent already has, so a second run changes nothing. The output lists what it added and skipped for each subagent; `--json` adds a `bundle` field with the same data. - It finds the bundle with `findAuthoringBundle` from `@salesforce/agents` and writes the `.agent` file. It does not compile it: compiling is a separate API, so run `sf agent validate authoring-bundle` after 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.) - The org comes from `--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 call `Agent.init`; a second run changes nothing). The 36 existing mcp tests still pass. I also ran the insert on a real `.agent` file 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.json` and `schemas/agent-mcp-asset-afscript.json` are updated for the new flags and the `bundle` field. 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". - It ran `sf agent mcp asset afscript -i <server> --tool calculate_quote --authoring-bundle P0Mcp_SkillTest --subagent agent_router --json` and made no hand edit to the `.agent` file. The command reported `added: [<key>]`, `skipped: []`. - The diff is +59 -0 lines, all inside `start_agent agent_router`. The action block and the reasoning entry are byte-equal to the `--json` output, and the key equals the tool's GenAiFunctionDefinition DeveloperName. - Deploy: Succeeded. In Builder Simulate the agent answered a quote request; the reasoner logged `filtered 0 inaccessible actions` and `MCP tool call success: <key>`. Merge order: forcedotcom/agents#395 and its release, then this PR with the `@salesforce/agents` bump, then the skill in project-codey #4572.
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 does this PR do?
updates tests only, surprisingly, to use updated agentscript
Org support coming 4/12
What issues does this PR fix or reference?
@W-21951412@
should be merged in tandem with: forcedotcom/agents#253