Skip to main content
Glama

profile

Profile Python code with Scalene to identify CPU, memory, and GPU bottlenecks using script or code snippet inputs.

Instructions

Profile Python code using Scalene.

Args: type: "script" (profile a file) or "code" (profile code snippet) script_path: Required if type="script". Path to Python script code: Required if type="code". Python code to execute cpu_only: Skip memory/GPU profiling include_memory: Profile memory allocations include_gpu: Profile GPU usage (requires NVIDIA GPU) reduced_profile: Show only lines >1% CPU or >100 allocations profile_only: Comma-separated paths to include (e.g., "myapp") profile_exclude: Comma-separated paths to exclude (e.g., "test,vendor") use_virtual_time: Measure CPU time excluding I/O wait cpu_percent_threshold: Minimum CPU % to report malloc_threshold: Minimum allocation bytes to report script_args: Command-line arguments for the script

Returns: {profile_id, summary, text_summary}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
script_pathNo
codeNo
cpu_onlyNo
include_memoryNo
include_gpuNo
reduced_profileNo
profile_onlyNo
profile_excludeNo
use_virtual_timeNo
cpu_percent_thresholdNo
malloc_thresholdNo
script_argsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations, the description discloses behavioral traits: profiling mode via 'type', optional exclusions (cpu_only, include_*), thresholds, and return type. It does not mention permissions or side effects, but is transparent about options.

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 well-structured with a clear opening sentence and bullet list of parameters. It is slightly verbose but efficiently conveys information.

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 13 parameters and output schema, the description covers input semantics and return structure. It lacks guidance on error scenarios or performance implications, but is sufficient for typical use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description fully compensates by explaining each parameter's purpose concisely (e.g., 'cpu_only: Skip memory/GPU profiling'). This adds meaning beyond parameter names and types.

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 clearly states the tool profiles Python code using Scalene, a specific verb-resource pairing. It distinguishes from siblings like analyze and compare_profiles.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists parameters but offers no explicit guidance on when to use this tool versus siblings. Usage context is implied by the tool name, but not elaborated.

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/ptmorris05/scalene-mcp'

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