Skip to main content
Glama

Run Python

run_python

Execute Python snippets with PyMOL cmd in scope to script molecular visualization and analysis; opt-in via PYMOL_MCP_ALLOW_CODE_EXEC=1.

Instructions

[opt-in] Execute a Python snippet with PyMOL cmd in scope. Requires PYMOL_MCP_ALLOW_CODE_EXEC=1.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "run_python"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesPython snippet; PyMOL `cmd` is in scope. Set a `result` variable to return a value.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and it does disclose the most consequential trait: execution is opt-in and gated behind an environment variable, which signals arbitrary-code-execution risk. It also mentions that a `result` variable is used to return a value, but it does not state that arbitrary code can mutate or destroy the PyMOL session state.

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?

Two short sentences, zero filler, with the opt-in caveat placed up front where an agent will see it before deciding to call.

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?

A one-parameter tool with a 100%-documented schema and an output schema, so return values need no explanation. The gating condition is covered; only the side-effect surface on the PyMOL session is left implicit.

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

Parameters3/5

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

Schema coverage is 100% and the single `code` parameter is already described as a Python snippet with `cmd` in scope. The description adds essentially nothing beyond that, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: execute a Python snippet with PyMOL `cmd` in scope. That is enough for an agent to distinguish it from command-style siblings like run_pml, though it never names that alternative explicitly.

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?

Gives a real gate: the tool is `[opt-in]` and requires PYMOL_MCP_ALLOW_CODE_EXEC=1, which tells the agent it may be unavailable. However, there is no guidance on when to prefer this over run_pml or when a prebuilt tool would be safer, so the choice between siblings is left to inference.

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