Skip to main content
Glama

generate_score

Run a music21 Python script to produce a MusicXML score file, returning the output file paths and execution results.

Instructions

Run a music21 Python script to generate a score file (MusicXML).

Write a COMPLETE, self-contained music21 script that builds the whole score and ends by exporting it, e.g. score.write("musicxml", fp="My Piece.musicxml"). Use a plain file name (no directory) so the file lands in the working directory and is reported back in output_files. Read the score_generation_guide tool first: it holds the music21 conventions this project relies on (flats are written B- not Bb, metadata, repeats, volta brackets, transposing instruments, and a full template).

The script runs on the user's machine with the user's privileges, in the same Python interpreter as this server (so music21 is importable). Only send code the user would be comfortable running themselves.

Args: script: Complete Python source of the generation script. output_dir: Working directory for the run. Defaults to a fresh directory under the user's Desktop (or home directory when there is no Desktop). Created if it does not exist. timeout: Seconds to wait before killing the script (default: 120).

Returns: JSON. On success: {"success": true, "output_files": [absolute paths of files created in the working directory], "stdout": ...}. On failure: {"error": ..., "stderr": last lines, "returncode": n}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes
timeoutNo
output_dirNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

No annotations exist, so the description carries the full burden of behavioral disclosure — and it delivers. It discloses that the script runs with the user's privileges in the same Python interpreter as the server, exposes the timeout-kill behavior, states that files land in the working directory and are reported back in output_files, and specifies both success and failure return shapes. For a tool that executes arbitrary code, this is exemplary safety and behavior disclosure.

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 longer than average but every block earns its place: core purpose is front-loaded, then the file-naming convention, guide pointer, environment/privilege warning, parameters, and return format. There is minor redundancy in re-formatting the argument list that the schema already names, and the return JSON structure is verbose — but given the 0% schema coverage and the dangerous execution context, the length is justified rather than padded.

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?

For a complex, arbitrary-code-execution tool with zero schema descriptions and no annotations, this description is essentially complete. Even though an output schema exists (so returns need not be spelled out), it documents the success/failure JSON formats anyway. It covers the guide dependency, naming conventions, environment, security posture, all parameters, and output behavior — nothing an agent needs to call it correctly is missing.

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% (the schema only has titles), so the description must compensate — and it does fully. It explains all three parameters: script ('Complete Python source'), output_dir (defaults to a fresh Desktop subdirectory, created if missing, null/empty handling implied), and timeout (seconds before kill, default 120). The description goes well beyond the bare schema and covers every parameter's semantics.

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 opens with a specific verb-resource pair: 'Run a music21 Python script to generate a score file (MusicXML).' This clearly distinguishes it from siblings like render_score (renders an existing score), connect_to_musescore, and the informational score_generation_guide. An agent can identify what this tool does without opening the schema.

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

Usage Guidelines4/5

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

Provides explicit prereq guidance: 'Read the score_generation_guide tool first: it holds the music21 conventions this project relies on.' It also frames the appropriate context by stating the script runs on the user's machine and that only code the user would be comfortable running should be sent. It doesn't explicitly state when NOT to use it versus render_score or the live-editing siblings, but the context and prerequisite routing are clear.

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