apex-log-mcp

v2.1.0
@certinia/apex-log-mcp Checked 12 hours ago Published 29 days ago

MCP server that analyzes Salesforce Apex debug logs for slow operations and governor limit usage, and runs Apex, fetches logs and sets trace flags in an org.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

apexlog_list_slow_operations List Slow Apex Log Operations

Rank what an Apex debug log spent its time on by self-execution time, or on the heap it retains - code units, methods, queries, searches, DML, callouts, flows and workflows in one table, each row with its calls, durations, database counts and rows, so the caller can see what to optimize and why, beside the query optimizer's plan for the queries among them.

ParameterTypeDescription
logFilePath *stringAbsolute path
debugCategoryarrayRank only these debug log categories
groupBystringFold repeats into one row; default name. callerNamespace attributes platform DML to the package that drove it. debugCategory folds a namespace's event types together and so states no type or name. non…
limitintegerPage size (default: 10); fewer if the page would be too large
minSelfMsnumberDrop operations below this self time (default: 0), whichever sortBy is used
namespacearrayRank only these namespaces
offsetintegerRanked rows to skip (default: 0): the last page's nextOffset
sortBystringDefault durationSelfMs. heapSelfNetBytes adds that column.
typearrayRank only these log event types, e.g. SOQL_EXECUTE_BEGIN, DML_BEGIN, METHOD_ENTRY

apexlog_get_summary Get Apex Log Summary

Get a high-level summary of an Apex debug log: how long the transaction ran, where the time went by debug log category and the level each was logged at, every governor limit it and each namespace consumed, whether the log is complete, the exceptions and flow errors it raised, and what ended the transaction if it failed. Best for a quick overview.

ParameterTypeDescription
logFilePath *stringAbsolute path

apexlog_list_limit_risks List Apex Log Limit Risks

List the governor limits an Apex log transaction has nearly used up - CPU time, heap, SOQL queries and rows, SOSL queries, DML statements and rows, callouts and every other limit - worst first, with how much of each was used

ParameterTypeDescription
logFilePath *stringAbsolute path
thresholdnumberMinimum usedPercentage to report (default: 80)

apexlog_search_events Search Apex Log Events

Search the events of an Apex debug log in log order: what the code printed (USER_DEBUG), validation rules, statements, or every event under one method. For plain text in the saved .log, grep is cheaper; use this for event types, nesting, or without a shell. Text past 400 characters is elided; ask for one event by eventId to read up to 30,000.

ParameterTypeDescription
logFilePath *stringAbsolute path
containsstringOnly events whose text holds this, ignoring case
eventIdintegerOnly this event, with more of its text
limitintegerPage size (default: 50)
namespacearrayOnly these namespaces
offsetintegerRows to skip (default: 0): the last page's nextOffset
parentEventIdintegerOnly events below this one
typearrayOnly these log event types, e.g. USER_DEBUG, VALIDATION_RULE

apexlog_list_org_logs List Org Debug Logs

List the debug logs stored in a Salesforce org, with how many match. Pass ids to apexlog_get_org_logs to download them.

ParameterTypeDescription
cursorstringnextCursor from the previous page
limitintegerPage size (default: 20)
minFileSizeBytesinteger
operationstringPart of the operation, any case, e.g. "aura" for /aura
requeststringe.g. "Api" or "Application"
sortBystringDescending (default: startTime)
startTimeFromstringISO 8601 with a zone, e.g. 2026-10-09T09:00:00Z
startTimeTostring
succeededbooleantrue: succeeded logs only; false: failed logs only
targetOrgstringAlias or username of the target Salesforce org. Uses the project default if not specified.
userstringUsername whose activity was logged

apexlog_get_org_logs Get Org Debug Logs

Download debug logs from a Salesforce org, by id or the newest N, and return each saved file's path, which the analysis tools accept.

ParameterTypeDescription
idsarrayLog ids, from apexlog_list_org_logs
latestintegerThe newest N logs, in place of ids (default: 1)
outputDirstringLog directory (default: .apex-log-mcp/ in the first client root, else cwd)
targetOrgstringAlias or username of the target Salesforce org. Uses the project default if not specified.

apexlog_create_trace_flag Create Trace Flag

Trace a user, class or trigger in a Salesforce org until the trace flag expires. A user's flag stores each transaction they run as a debug log, which can fill log storage; a class or trigger flag only sets that code's levels. Refused if a flag of its log type overlaps the new one. Leaves a debug level in the org.

ParameterTypeDescription
tracedEntity *stringA username or user id, or a class or trigger name (ns.Name if namespaced)
debugLevelA level for every category, or the named ones over apexlog_execute_anonymous's defaults (default: those)
durationMinutesintegerHow long it logs (default: 30)
targetOrgstringAlias or username of the target Salesforce org. Uses the project default if not specified.

apexlog_execute_anonymous Execute Anonymous Apex

Execute anonymous Apex in a Salesforce org as the targetOrg user; DML commits unless the run fails. Saves the debug log and returns its path for the analysis tools. With no active trace flag, adds one for the run, deleted after, and a debug level, left in the org.

ParameterTypeDescription
apexstringThe anonymous Apex to execute, or use apexFilePath
apexFilePathstringAbsolute path to a file of anonymous Apex
debugLevelThis run's log levels. Omit for the user's trace flag levels, else the defaults; "default" forces the defaults; a bare level sets every category; an object sets the named categories over the defaults.…
outputDirstringLog directory (default: .apex-log-mcp/ in the first client root, else cwd)
targetOrgstringAlias or username of the target Salesforce org. Uses the project default if not specified.