智能体工作流

platform-mcp-tool-widget-coordinate

forcedotcom/sf-skills

Orchestrate object-based Lightning Type + HXL widget generation to render the output of a custom MCP server tool backed by an Apex Invocable Action. TRIGGER only when the prompt EXPLICITLY involves rendering an MCP tool result: user says 'MCP server', 'MCP tool', 'custom MCP server', references a tool 'output schema' / 'tool output' / 'outputValues' envelope, names an 'invocable action' backing an MCP tool, or asks to build a widget or rich UI rendition for the output of an Apex-invocable-backed MCP tool. DO NOT TRIGGER when: customizing an Apex-backed agent action output (use platform-lightning-type-widget-coordinate), authoring only a Custom Lightning Type (use platform-custom-lightning-type-generate), authoring only an Apex class (use platform-apex-generate), or building a standalone widget with no Lightning Type or MCP tool involved (use platform-widget-generate).

  • 2398 次安装
  • 1100 星标
  • 收录于

安装命令

npx skills add https://github.com/forcedotcom/sf-skills --skill platform-mcp-tool-widget-coordinate

SKILL.md

Rendering a Custom MCP Tool Output With a Widget

Coordinate two object-based Custom Lightning Types (CLTs) and an HXL widget to render the output of a custom MCP server tool whose implementation is an Apex @InvocableMethod. This skill never authors content directly — it loads and invokes leaf skills in dependency order, gates progress on user approval, and runs validation gates before reporting completion.

Ownership boundary — this skill owns only:

  1. the MCP-tool use case — resolving the tool's output shape and orchestrating the leaf skills in the right order; and
  2. the envelope CLT's default renderer.json — the one artifact it authors inline, bridging the envelope to the widget.

The CLTs are authored by platform-custom-lightning-type-generate, and all widget metadata (schema + body + .uiwidget-meta.xml) is authored and validated by platform-widget-generate. This skill never writes widget metadata and never modifies the Apex class — it supplies each leaf skill its inputs and wires the result together.

Scope

Custom MCP server tools backed by an Apex Invocable Action only. The MCP tool returns the platform's invocable-action result envelope — an object with actionName, isSuccess, and an outputValues node that carries the tool's real payload. To render this envelope with a widget, model it as two object-based CLTs (lightning__objectType) of equal standing — the only reason there are two is that one must reference the other by name (a CLT cannot reference itself), so they need distinct deployed names. Name and describe each by what it actually models — never by an invented role-label pair like "Payload CLT"/"Envelope CLT" or "Inner CLT"/"Outer CLT":

  • The CLT that mimics the tool-result envelope, named <toolApiName>. Its outputValues property is typed to the other CLT via c__<responseCLT> (the CLT-reference prefix — see the namespace note below).
  • The CLT that is the exact shape of the Invocable Action's response (@InvocableVariable fields on the @InvocableMethod response class), named <toolApiName>Response — "Response" is not an invented role word; it is the word the Apex source itself uses for that class.

The widget grounds on the response fields (flat), and the default renderer.json in the envelope CLT bridges the envelope nesting to the flat widget via {!$attrs.outputValues.<field>}.