Skip to main content
Glama
certinia

Apex Log MCP Server

Official
by certinia

Execute Anonymous Apex

apexlog_execute_anonymous
Destructive

Execute anonymous Apex against a Salesforce org, save the debug log locally, and return a summary with the file path for analysis tools.

Instructions

Execute a snippet of anonymous Apex against an authenticated Salesforce org (via SF CLI). Saves the resulting debug log to a local file and returns a summary with the file path, which the analysis tools accept. Production orgs require per-call user confirmation or the --allow-production-orgs server flag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apexYesThe anonymous Apex to be executed
outputDirNoDirectory to save the debug log file. Defaults to .apex-log-mcp/ in the project root.
targetOrgNoAlias or username of the target Salesforce org. Uses the project default if not specified.
debugLevelNoTrace flag log levels. "default" restores the defaults; a bare level sets every category to it; an object sets only the categories named and leaves the rest unchanged. Defaults: apexCode, apexProfiling, visualforce, workflow FINE; callout, system, validation DEBUG; database FINEST; nba, wave INFO.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.1

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare destructive/openWorld/non-idempotent, so the safety profile is covered. The description adds real behavioral value on top: it writes a debug log to a local file, returns a summary containing that path, and requires confirmation or a server flag for production orgs. It omits whether execution runs with the authenticated user's permissions and how failures surface, keeping it below 5.

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?

Three sentences, each earning its place: what it does, what it returns, and the production caveat. Front-loaded with the action and no filler.

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

Completeness5/5

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

Covers action, execution context, side effect (local log file), return contract, and the production-org gate. No output schema exists, yet the description explains the return shape adequately, and the 100%-covered input schema handles parameters.

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?

Schema description coverage is 100%, and the schema itself documents apex, outputDir default, targetOrg fallback, and the full debugLevel semantics including category defaults, so the baseline is 3. The description adds no parameter-level detail beyond that.

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?

States a specific verb+resource ('Execute a snippet of anonymous Apex') and the mechanism ('via SF CLI'), and distinguishes itself from the siblings by noting the returned file path is what 'the analysis tools accept'. An agent can tell this is the producer tool and the others are consumers without opening schemas.

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

Usage Guidelines4/5

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

Clear situational context: run ad-hoc Apex against an authenticated org, with an explicit prerequisite for production orgs (per-call confirmation or the --allow-production-orgs server flag). It never names an alternative tool or says when NOT to use it, so it stops short of a 5.

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