Skip to main content
Glama

execute_sql

Execute a PerfettoSQL query on a loaded trace to return columnar JSON results. Use for custom aggregations and joins not covered by dedicated tools.

Instructions

Run a PerfettoSQL query against the loaded trace and return rows as columnar JSON. Read-only against trace data; SQLite operates in-memory per session. Aggregates are strongly preferred over raw row data; results are capped at 5000 rows.

Use when: composing analyses not covered by the dedicated tools — custom aggregations, joins across stdlib modules, or queries against base tables (slice, thread, process, sched).

Don't use for: questions the dedicated chrome_* tools answer — they return the same data with the JOIN shape already correct. Don't hand-roll slice scans with LIKE '%x%' patterns when a stdlib module covers the data; INCLUDE PERFETTO MODULE chrome.tasks is faster and the joins are pre-baked.

Parameters: sql is a single PerfettoSQL statement (the INCLUDE PERFETTO MODULE foo; and SELECT ... can be in the same call). Requires load_trace to have run first.

Empty rows means the query matched nothing — distinct from a SQL error, which is returned as an error string with a hint pointing at the most likely cause (missing module, missing column, missing table).

Reference docs (fetch when you need exact column names or function signatures): https://perfetto.dev/docs/analysis/stdlib-docs (24 stdlib packages — chrome / android / sched / slices / linux / wattson / v8 / ...; use per-package anchors like #package-chrome), https://perfetto.dev/docs/analysis/perfetto-sql-syntax (syntax).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query to execute (PerfettoSQL syntax).
Behavior4/5

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

No annotations are provided, so the description carries full responsibility. It discloses read-only nature, in-memory SQLite, result cap of 5000 rows, preference for aggregates, and error vs. empty result behavior. Lacks detail on potential latency or side effects, but covers the main behavioral traits comprehensively.

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?

Description is moderately long but well-structured: purpose first, then usage guidelines, parameter detail, edge cases, and references. Every section earns its place. Could trim the reference links slightly, but overall efficient and organized.

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?

Given the complexity of a generic SQL tool with many sibling tools, the description covers all needed context: what it does, when to use, when not to, parameter semantics, error handling, and even links to documentation. No output schema exists, but return behavior (columnar JSON, empty rows vs errors) is fully addressed.

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% (only one parameter, sql, with a brief description). The description adds value by explaining that INCLUDE PERFETTO MODULE and SELECT can be combined in one call, specifying it's a single statement. This goes beyond the schema's basic explanation.

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?

Description opens with a clear, specific verb-resource pair: 'Run a PerfettoSQL query against the loaded trace and return rows as columnar JSON.' It distinguishes itself from sibling tools dedicated to chrome metrics, making it easy to recognize when this general SQL tool is needed.

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 states 'Use when:' (custom aggregations, joins, etc.) and 'Don't use for:' (dedicated chrome tools, hand-rolled slice scans with LIKE patterns). Also notes the prerequisite that load_trace must have run first.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tooluse-labs/perfetto-mcp-rs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server