Skip to main content
Glama
walac

perf-mcp

by walac

perf_annotate

Annotate function source and assembly with per-line sample percentages to pinpoint exactly where CPU time is spent, enabling targeted optimization.

Instructions

Source/assembly annotation: shows per-line or per-instruction sample percentages inside a specific function.

Use this after perf_report to drill into a hot function and see exactly which lines or instructions are consuming time.

Key parameters:

  • symbol: function name to annotate (default: hottest symbol).

  • dsos: restrict to a specific binary/library.

  • source: true (default) to interleave source code with assembly.

  • disassembler_style: 'intel' for Intel syntax (default: AT&T).

  • percent_type: 'local-period' (default), 'global-period', 'local-hits', 'global-hits'.

  • data_type: annotate a specific data type (DWARF data-type profiling).

  • code_with_type: show data type annotations on code.

Output: source/assembly listing with % annotations per line. Requires: debuginfo packages for source interleaving. Works on any perf.data from perf record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cpuNoList of CPUs to filter
dsosNoOnly consider these DSOs
forceNoDon't complain, do it
groupNoShow event group information
inputYesPath to perf.data file
quietNoDo not show any warnings or messages
symfsNoSymbol filesystem root
itraceNoInstruction Tracing options
prefixNoAdd prefix to source file paths
sourceNoInterleave source code with assembly (default on)
symbolNoSymbol name to annotate
asm_rawNoDisplay raw encoding of assembly
modulesNoLoad module symbols
verboseNoVerbosity level (0-2)
vmlinuxNovmlinux pathname
demangleNoSymbol demangling (default on)
data_typeNoName of data type to annotate
insn_statNoShow instruction statistics
type_statNoShow type annotation statistics
full_pathsNoDisplay full source file paths
print_lineNoPrint source line number
skip_emptyNoDo not display empty events
percent_typeNoPercent type
prefix_stripNoStrip first N entries of source file path
skip_missingNoSkip symbols that cannot be annotated
percent_limitNoDon't show entries under this percent
code_with_typeNoShow data type annotation for code
dump_raw_traceNoDump raw trace in ASCII
ignore_vmlinuxNoDon't load vmlinux even if found
demangle_kernelNoEnable kernel symbol demangling
show_nr_samplesNoShow column with sample count
show_total_periodNoShow column with sum of periods
disassembler_styleNoDisassembler style (e.g. 'intel')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the output format (source/assembly listing with % annotations), the key requirement (debuginfo for source interleaving), and compatibility (works on any perf.data). It doesn't explicitly state it's read-only, but the verbs 'shows' and 'annotation' strongly imply a non-mutating analytical operation. The provided behavioral details (output, requirements) go beyond the bare minimum.

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?

The description is front-loaded with the purpose, then provides usage context, key parameters, output, and requirements. It is organized with a 'Key parameters:' section and uses concise bullet-like formatting. While it lists seven parameters, each earns its place by clarifying important defaults or options. It remains reasonably compact for a tool with 33 parameters.

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?

Given the tool's complexity (33 params), the description covers the essential workflow, key parameters, output, and dependency (debuginfo). The output schema exists, so return values are already specified. The only minor gaps are not discussing every parameter or potential limitations (e.g., permission requirements), but the schema covers parameter details. Overall it provides enough context for an agent to invoke the tool correctly.

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 the baseline is 3. The description adds meaningful semantic context for several key parameters: symbol (default: hottest), dsos (restrict to binary/library), source (interleave source), disassembler_style (Intel vs AT&T), percent_type (enumerating options), data_type, and code_with_type. These enrich the terse schema descriptions, especially for percent_type where the schema only says 'Percent type.'

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?

The description opens with 'Source/assembly annotation: shows per-line or per-instruction sample percentages inside a specific function.' This clearly states the verb (shows), the resource (source/assembly annotation with percentages), and the specific scope (inside a specific function). It also differentiates from siblings by positioning it as a follow-up to perf_report for drilling into hot functions.

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?

Explicitly says 'Use this after perf_report to drill into a hot function,' giving clear workflow context. It doesn't explicitly list alternatives or exclusion cases, but the 'after perf_report' instruction implies its role relative to sibling tools. The description also notes requirements (debuginfo packages) which further guides when to use.

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/walac/perf-mcp'

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