Skip to main content
Glama
advancedcommunities

Salesforce MCP Server

run_apex_tests

Destructive

Execute Apex unit tests in a Salesforce Org with options for test level, classes, suites, sync/async runs, and code coverage. Use it to validate Apex code and ensure test coverage.

Instructions

Run Apex tests in a Salesforce Org. This command allows you to execute unit tests with various options including test level, specific classes, suites, and code coverage collection. Tests can be run synchronously or asynchronously. Use this to validate your Apex code and ensure proper test coverage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.7.0

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare destructiveHint, openWorldHint, and non-idempotent, so the safety profile is covered. The description adds the sync/async execution choice, which is useful behavioral context, but it says nothing about runtime cost, wait semantics, or how results are surfaced, and does not contradict the annotations.

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

Conciseness3/5

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

Front-loaded with the core action, but four sentences with redundancy — 'Run Apex tests' and 'execute unit tests with various options' restate the same idea, and the option list duplicates the nested schema. One or two sentences would suffice.

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

Completeness3/5

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

For a test-runner with no output schema and rich nested parameter docs, the description covers the main option surface adequately. However, it omits the follow-up path (get_apex_test_results) and any note on execution timing/results, leaving the agent with an incomplete picture of the end-to-end flow.

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?

Top-level schema coverage is 0% (single 'input' wrapper), but the nested properties carry rich descriptions including mutual-exclusion rules (--tests vs --class-names vs --suite-names). The description only lists the option categories at a high level and adds no semantics beyond the nested schema, so baseline 3 is appropriate.

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

Purpose4/5

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

States a specific verb+resource ('Run Apex tests in a Salesforce Org') and names the concrete options involved (test level, classes, suites, coverage). It is clear what the tool does, though it never explicitly contrasts itself with the sibling get_apex_test_results, so sibling differentiation is only implicit.

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

Usage Guidelines3/5

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

Provides implied usage ('Use this to validate your Apex code and ensure proper test coverage') but gives no when-not conditions and never points to alternatives such as get_apex_test_results for retrieving results or execute_anonymous_apex. The agent must infer the workflow.

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