Skip to main content
Glama

profile

Profile Python code to identify performance bottlenecks in CPU, memory, and GPU usage. Analyze scripts or code snippets for optimization insights.

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 provided, the description carries full burden and adds valuable behavioral context: it explains profiling modes (CPU, memory, GPU), output filtering (reduced_profile), path inclusion/exclusion, and return structure. It clarifies dependencies (e.g., 'requires NVIDIA GPU' for GPU profiling) and default behaviors (e.g., thresholds), though it lacks details on execution environment or error handling.

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, followed by a parameter list and return info. Each parameter explanation is concise and front-loaded with key details. While dense due to many parameters, every sentence earns its place by clarifying usage without redundancy.

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 (13 parameters, no annotations, but has output schema), the description is complete: it covers purpose, all parameter semantics, behavioral traits, and return values. The output schema is noted, so the description need not explain return details further. It adequately addresses the tool's scope and usage.

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?

Given 0% schema description coverage, the description fully compensates by providing detailed semantics for all 13 parameters. It explains each parameter's purpose, requirements (e.g., 'Required if type="script"'), defaults implied (e.g., 'Skip memory/GPU profiling'), and usage examples (e.g., 'e.g., "myapp"'), adding significant value beyond the bare schema.

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 specific action ('Profile Python code using Scalene') and distinguishes it from siblings like 'analyze', 'compare_profiles', or 'list_profiles' by focusing on execution profiling rather than analysis or listing. It specifies the tooling (Scalene) and target (Python code), making the purpose unambiguous.

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 implies usage through parameter explanations (e.g., 'type: "script" (profile a file) or "code" (profile code snippet)'), suggesting when to use script_path vs. code, but does not explicitly state when to choose this tool over alternatives like 'analyze' or provide exclusions. Guidance is present but not comprehensive.

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