create_composition_plan
Generate a composition plan for music from a text prompt, defining style, sections, and duration. Optionally source an existing plan. The plan is used by the compose music tool to create the final audio.
Instructions
Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. Composition plans can be used when generating music with the compose_music tool.
Args:
prompt: Prompt to create a composition plan for
music_length_ms: The length of the composition plan to generate in milliseconds. Must be between 10000ms and 300000ms. Optional - if not provided, the model will choose a length based on the prompt.
source_composition_plan: An optional composition plan to use as a source for the new composition planInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| music_length_ms | No | ||
| source_composition_plan | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| positive_global_styles | Yes | ||
| negative_global_styles | Yes | ||
| sections | Yes |
Implementation Reference
- elevenlabs_mcp/server.py:1256-1267 (handler)The handler function that executes the create_composition_plan tool logic. It takes a prompt, optional music_length_ms, and optional source_composition_plan, then calls client.music.composition_plan.create() and returns the composition plan.
def create_composition_plan( prompt: str, music_length_ms: int | None = None, source_composition_plan: MusicPrompt | None = None, ) -> MusicPrompt: composition_plan = client.music.composition_plan.create( prompt=prompt, music_length_ms=music_length_ms, source_composition_plan=source_composition_plan, ) return composition_plan - elevenlabs_mcp/server.py:1255-1260 (schema)The @mcp.tool decorator that registers this function as a tool, with its description and argument schema (prompt: str, music_length_ms: int | None, source_composition_plan: MusicPrompt | None, returns MusicPrompt).
) def create_composition_plan( prompt: str, music_length_ms: int | None = None, source_composition_plan: MusicPrompt | None = None, ) -> MusicPrompt: - elevenlabs_mcp/server.py:1246-1246 (registration)The @mcp.tool decorator registers the function as an MCP tool named 'create_composition_plan' (the Python function name becomes the tool name).
@mcp.tool( - elevenlabs_mcp/server.py:30-30 (helper)Import of MusicPrompt type from elevenlabs.types, used as the type for the composition_plan parameter and return value.
from elevenlabs.types import MusicPrompt