Skip to main content
Glama
Apex Log MCP Server

Apex Log MCP Server

Official
by certinia

Create Trace Flag

apexlog_create_trace_flag

Create a Salesforce trace flag for a user, class, or trigger to capture debug logs until it expires, with optional duration and debug levels; overlapping flags of the same log type are refused.

Instructions

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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "tracedEntity": "<tracedEntity>"
    },
    "name": "apexlog_create_trace_flag"
  }
}

Input Schema

NameRequiredDescriptionDefault
targetOrgNoAlias or username of the target Salesforce org. Uses the project default if not specified.
debugLevelNoA level for every category, or the named ones over apexlog_execute_anonymous's defaults (default: those)
tracedEntityYesA username or user id, or a class or trigger name (ns.Name if namespaced)
durationMinutesNoHow long it logs (default: 30)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.2

TDQS

A3.9/5.0
Behavior4/5

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

With only destructiveHint=false in annotations, the description carries real weight and delivers: side effect (a user flag fills log storage), overlap refusal rule, expiration behavior, and a residue side effect ('Leaves a debug level in the org'). It doesn't cover required permissions or what the response is, and the debug-level residue is stated opaquely, but this is strong disclosure for a low-annotation mutation.

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?

Four sentences, each adding distinct information, with the core action and the storage-cost caveat front-loaded. Minor loss from 'Leaves a debug level in the org', which is terse to the point of ambiguity about cleanup expectation.

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?

For a four-parameter creation tool with no output schema and sparse annotations, the description covers purpose, entity-type trade-offs, the refusal condition, and side effects. What's missing is the response shape and any cleanup/permission context around the residue debug level, but the essentials an agent needs to invoke it correctly are present.

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 coverage is 100%, so the schema already documents all four parameters. The description adds context tying tracedEntity semantics to the user-vs-class/trigger distinction, but says nothing about durationMinutes, targetOrg, or debugLevel. Baseline 3 is appropriate where the schema does the heavy lifting.

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?

The description names a specific action and resource: tracing a user, class, or trigger in a Salesforce org with a trace flag that runs until expiration. It's clear this is a creation/tracing operation distinct from the read-oriented siblings. It doesn't explicitly name a sibling, but the operation is unambiguous.

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?

It explains when to choose each entity type: a user flag captures every transaction as a debug log (with storage cost), while a class or trigger flag only sets that code's levels. That's real selection guidance. It stops short of naming sibling tools or explicitly excluding them, but the trade-off framing is solid context for calling it correctly.

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