Skip to main content
Glama
Apex Log MCP Server

Apex Log MCP Server

Official
by certinia

Search Apex Log Events

apexlog_search_events
Read-only

Search Apex debug log events in log order by type, method, namespace, parent event, or text to inspect validation rules, statements, and debug output without a shell.

Instructions

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.

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": {
      "logFilePath": "<logFilePath>"
    },
    "name": "apexlog_search_events"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNoOnly these log event types, e.g. USER_DEBUG, VALIDATION_RULE
limitNoPage size (default: 50)
offsetNoRows to skip (default: 0): the last page's nextOffset
eventIdNoOnly this event, with more of its text
containsNoOnly events whose text holds this, ignoring case
namespaceNoOnly these namespaces
logFilePathYesAbsolute path
parentEventIdNoOnly events below this one

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.1.0
    • addedInput schema / properties / eventId
      Added value: +{
      +  "description": "Only this event, with more of its text",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedInput schema / properties / eventIndex
      Removed value: -{
      -  "description": "Only this event, with more of its text",
      -  "minimum": 0,
      -  "type": "integer"
      -}
    • addedInput schema / properties / parentEventId
      Added value: +{
      +  "description": "Only events below this one",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedInput schema / properties / parentEventIndex
      Removed value: -{
      -  "description": "Only events below this one",
      -  "minimum": 0,
      -  "type": "integer"
      -}
  2. Addedv2.0.2

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already establish read-only and closed-world, so the description focuses on operational behavior: results come back in log order, text is elided past 400 characters, and a single-event lookup raises that ceiling to 30,000. That elision/expansion trade-off is the key non-obvious trait an agent needs. It stops short of describing the response envelope, though the schema hints at nextOffset.

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 short clauses, front-loaded with what the tool does, then the cheaper alternative, then the truncation caveat. Every sentence carries distinct information; nothing is restated from the schema.

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 an 8-parameter read tool with no output schema, the description covers the essentials: ordering, truncation limits, the escape hatch for full text, and paging. It could say slightly more about what a returned event row looks like, but the schema descriptions already carry the parameter-level detail.

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%, so baseline is 3, but the description adds real meaning beyond it: eventId is not just a filter, it is the mode that unlocks up to 30,000 characters of text versus the 400-character elision in list mode. It also frames the result set as paged via the schema's nextOffset.

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 and resource ('Search the events of an Apex debug log') and immediately enumerates the event kinds it targets (USER_DEBUG, validation rules, statements, all events under a method), plus the ordering guarantee ('in log order'). That is enough to distinguish it from sibling summary/listing tools without opening any schema.

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?

Explicitly names the alternative ('grep is cheaper' for plain text in a saved .log) and the three conditions that select this tool instead: event types, nesting, or no shell. It also gives a second routing rule — use eventId when you need the full text of one event.

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