Skip to main content
Glama
boejucci

Salesforce MCP Server (Extended)

by boejucci

salesforce_execute_anonymous

Run anonymous Apex code in Salesforce to perform data operations or updates not directly supported by other tools. Includes optional debug logging.

Instructions

Execute anonymous Apex code in Salesforce.

Examples:

  1. Execute simple Apex code: { "apexCode": "System.debug('Hello World');" }

  2. Execute Apex code with variables: { "apexCode": "List accounts = [SELECT Id, Name FROM Account LIMIT 5]; for(Account a : accounts) { System.debug(a.Name); }" }

  3. Execute Apex with debug logs: { "apexCode": "System.debug(LoggingLevel.INFO, 'Processing accounts...'); List accounts = [SELECT Id FROM Account LIMIT 10]; System.debug(LoggingLevel.INFO, 'Found ' + accounts.size() + ' accounts');", "logLevel": "DEBUG" }

Notes:

  • The apexCode parameter is required and must contain valid Apex code

  • The code is executed in an anonymous context and does not persist

  • The logLevel parameter is optional (defaults to 'DEBUG')

  • Execution results include compilation success/failure, execution success/failure, and debug logs

  • For security reasons, some operations may be restricted based on user permissions

  • This tool can be used for data operations or updates when there are no other specific tools available

  • When users request data queries or updates that aren't directly supported by other tools, this tool can be used if the operation is achievable using Apex code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apexCodeYesApex code to execute anonymously
logLevelNoLog level for debug logs (optional, defaults to DEBUG)
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses that code runs anonymously, does not persist, includes debug logs, and may be restricted by permissions. However, it stops short of explicitly warning about potential data mutation or destructive actions.

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

Conciseness4/5

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

The description is well-structured with a clear opening, three concise examples, and a bulleted notes section. It is front-loaded with purpose. The three examples could be trimmed to two without loss of clarity, but overall it is efficient.

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?

Given the complexity of executing arbitrary code and the absence of an output schema, the description adequately covers execution results, debug logs, and security. It also positions the tool as a fallback, which adds important context.

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

Parameters4/5

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

Schema coverage is 100%, setting a baseline of 3. The description adds value by providing examples, noting that 'apexCode' must be valid Apex, and clarifying the 'logLevel' defaults. This goes beyond the schema, justifying a higher score.

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 states 'Execute anonymous Apex code in Salesforce' with a specific verb and resource. Examples demonstrate common use cases, and it distinguishes itself from sibling tools by noting it can be used as a fallback when other tools are unavailable.

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?

Explicit guidance: 'This tool can be used for data operations or updates when there are no other specific tools available.' It provides a clear condition for use and implies prefer specific tools, which helps in decision-making.

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/boejucci/mcp-server-salesforce'

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