Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Create Agentforce Action

sf_create_agent_action
Idempotent

Creates an Agentforce Action (GenAiFunction) to expose an existing Flow or Apex class as a capability for an agent. Call once per flow or class, then link actions to the agent topic.

Instructions

Creates an Agentforce Action (GenAiFunction) — step 2 of the agent setup sequence. Call this once per capability (once per flow, once per Apex class). IMPORTANT by type: For Flow — the flow must already exist as an Active AutoLaunchedFlow (use sf_create_flow with flowType='AutoLaunchedFlow' and status='Active' first). For ApexClass — the class must already exist AND have @InvocableMethod (use sf_create_apex_class first). The 'reference' is the exact API name of the flow or class. After ALL actions are created, call sf_create_agent_topic (passing all action API names in 'actions' array), then sf_create_agent_planner. Do not stop between steps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesAction type: 'Flow' (AutoLaunchedFlow only — must be Active), 'ApexClass' (must have @InvocableMethod), 'PromptTemplate', etc.
labelYesAction label
inputsNoInput parameter mappings
agentNameNoParent agent API name — optional and informational only, NOT written to the action XML. Safe to omit.
referenceYesExact API name of the resource to invoke. For Flow: the flow API name (e.g. 'Get_Account_Details'). For ApexClass: the class name (e.g. 'AccountHelper'). For PromptTemplate: the template API name. Must already exist in Salesforce.
topicNameNoParent topic API name — optional and informational only, NOT written to the action XML. Safe to omit. You must still pass this action's API name (actionName) in the 'actions' array when calling sf_create_agent_topic.
actionNameYesAction API name. Letters, numbers, underscores. Remember this name — you must pass it in the 'actions' array when calling sf_create_agent_topic.
descriptionYesWhat this action does — used by the AI to decide when to invoke it
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations, the description discloses important behavioral constraints: the flow must be an Active AutoLaunchedFlow, the ApexClass must have @InvocableMethod, and the action references an existing API name. It also communicates the once-per-capability pattern and the need to complete all steps without stopping. This adds valuable context without contradicting the provided annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, uses a clear IMPORTANT callout for type-specific guidance, and every sentence covers a necessary point: sequencing, prerequisites, and next steps. It is concise with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the agent setup workflow thoroughly: it explains prerequisites per type, invocation frequency, and the dependent next steps. It does not describe return values, but there is no output schema and the creation semantics are reasonably clear. Overall, it is complete for an 8-parameter tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides 100% coverage for all 8 parameters, including descriptions for type, reference, and optional fields. The description largely repeats schema information (e.g., 'reference is the exact API name') rather than adding new parameter meanings, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the verb and resource: 'Creates an Agentforce Action (GenAiFunction)'. It also positions the tool as 'step 2 of the agent setup sequence', which distinguishes it from sibling tools like sf_create_agent_topic and sf_create_agent_planner.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly details when to invoke this tool and the surrounding sequence: call it once per capability, use sf_create_flow or sf_create_apex_class first, then follow with sf_create_agent_topic and sf_create_agent_planner. It also states the prerequisite conditions for Flow and ApexClass types, providing clear alternatives and steps.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/semwalajay83-sem/salesforce-metadata-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server