parse_and_execute
Execute a single PyMOL command in literal PyMOL syntax. Translate your request into a precise PyMOL command, then call this tool to run it and return the output.
Instructions
Executes a single PyMOL command given in literal PyMOL syntax.
NOT a natural-language interface. user_input is matched against a fixed
table of command patterns; anything else is rejected rather than guessed at.
Translate the user's request into PyMOL syntax yourself, then call this once
per command. Use list_commands to look up exact syntax.
instance is the port of the PyMOL to drive. Leave it unset when only one
is running. With several running an unset instance is an error rather than
a guess, since driving the window the user is not watching looks exactly
like the command doing nothing. Call list_instances to see the choices.
Translating requests: "Load PDB 1UBQ and show it as cartoon" -> parse_and_execute("fetch 1ubq") -> parse_and_execute("as cartoon, 1ubq") "Colour chain A red" -> "color red, chain A" "Show sticks for residues 1-50" -> "show sticks, resi 1-50" "Open /data/model.pdb" -> "load /data/model.pdb" "Select the binding site" -> "select site, byres (polymer within 5 of ligand)"
Common mistakes:
Multiple commands in one call. "fetch 1ubq and show cartoon" fails; the whole string is read as one filename/code.
loadfor a PDB ID.loadtakes a file path; usefetchfor a 4-character accession code like 1ubq.Selections as prose. Write
show cartoon, chain A, notshow cartoon for chain A-- the selection is a second argument after a comma.Conversational filler. "please show cartoon" does not match; send "show cartoon".
Selections use full PyMOL algebra (chain A and resi 1-50, not solvent,
byres (... within 5 of ...)). Commas separate arguments, so a selection
containing a comma must be rewritten with + (resi 1+2+3).
Returns PyMOL's output, or a message describing the parse/execution failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance | No | ||
| user_input | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |