Skip to main content
Glama

eval_python

Execute Python code within a live PySide6 app to inspect widgets, call methods, and debug issues directly.

Instructions

Evaluate a Python expression or execute a statement inside the app process. Context provides:

  • app: QApplication instance

  • widgets: dict mapping widget_id → QWidget Examples: eval_python("app.activeWindow().windowTitle()") eval_python("widgets['3'].isEnabled()") eval_python("list(app.allWidgets())") WARNING: runs arbitrary code in the app — use only for debugging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNoApp pid from launch_app. Omit to target the last launched app. Required only when several apps are running and you need a specific one.
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly warns that arbitrary code runs in the app, implying direct mutation and potential for damage. It also discloses the injected context variables. It doesn't mention crash risk or persistence of changes, but the arbitrary-code warning is a strong and honest disclosure.

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?

The description opens with the core purpose, then provides the essential context variables, compact examples, and a clear safety warning. Every line earns its place, and the structure makes the tool immediately understandable.

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 that an output schema exists, the description does not need to explain return values. It covers the critical context availability, shows realistic usage examples, and warns about arbitrary code execution. A mention of the potential to crash the app or that the modification is in-memory would make it fully complete, but the current level is strong.

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 description coverage is 50%; the required 'code' parameter has no schema description, so the tool description compensates with examples showing valid expression forms and available context objects. The 'pid' parameter is adequately documented in the schema and does not need repetition.

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 evaluates Python expressions or executes statements inside the app process, which is a specific and distinct capability. It is easily distinguished from sibling tools like click, get_logs, or get_widget_tree, all of which are more constrained operations.

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 warning 'use only for debugging' gives an explicit constraint on when it should be used, and the examples show practical invocation patterns. However, it does not explicitly state when to prefer sibling tools over this one or describe conditions that should rule out its use.

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

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/com55/pyside6-mcp'

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