Skip to main content
Glama

create_midi_item

Create an empty MIDI item on a track by entering track index, start position, and length. Returns item_id for adding MIDI notes.

Instructions

Create an empty MIDI item on a track. Returns item_id for use with add_midi_note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
track_indexYes
start_positionYes
lengthYes

Implementation Reference

  • The create_midi_item tool handler: creates an empty MIDI item on a track using reapy, returns item_id and metadata.
    @mcp.tool()
    def create_midi_item(track_index: int, start_position: float, length: float) -> dict:
        """Create an empty MIDI item on a track. Returns item_id for use with add_midi_note."""
        try:
            project = get_project()
            track = project.tracks[track_index]
            item = track.add_midi_item(start_position, start_position + length)
            take = item.active_take
            return {
                "success": True,
                "item_id": item.id,
                "item_index": track.n_items - 1,
                "position": item.position,
                "length": item.length,
                "track_index": track_index,
            }
        except Exception as e:
            logger.error(f"create_midi_item failed: {e}")
            return {"success": False, "error": str(e)}
  • Type signature/input schema: takes track_index (int), start_position (float), length (float), returns dict.
    def create_midi_item(track_index: int, start_position: float, length: float) -> dict:
  • Tool registration via the @mcp.tool() decorator inside register_tools(), which is called from server.py.
    @mcp.tool()
    def create_midi_item(track_index: int, start_position: float, length: float) -> dict:
  • The midi_tools.register_tools() function is imported and called in server.py to register all MIDI tools (including create_midi_item).
    from reaper_mcp.midi_tools import register_tools as _reg_midi
    from reaper_mcp.fx_tools import register_tools as _reg_fx
    from reaper_mcp.audio_tools import register_tools as _reg_audio
    from reaper_mcp.mixing_tools import register_tools as _reg_mixing
    from reaper_mcp.render_tools import register_tools as _reg_render
    from reaper_mcp.mastering_tools import register_tools as _reg_mastering
    from reaper_mcp.analysis_tools import register_tools as _reg_analysis
    
    _reg_project(mcp)
    _reg_track(mcp)
    _reg_midi(mcp)
  • Helper function get_project() used by create_midi_item to obtain the REAPER project object.
    def get_project() -> reapy.Project:
        ensure_connected()
        return reapy.Project()
Behavior2/5

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

No annotations are provided, and the description does not disclose side effects, permissions, or constraints (e.g., whether items can be overwritten, parameter limits). It only states creation and return value, lacking behavioral depth.

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 very concise (two sentences) and front-loaded with the core action. However, it may be overly sparse, sacrificing useful details for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema, no annotations, and zero parameter descriptions in either schema or description, the tool is severely underdocumented. Missing details include error handling, return value format, and parameter constraints.

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

Parameters1/5

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

The description adds no information about the parameters (track_index, start_position, length) beyond the input schema. With 0% schema description coverage, the description should compensate, but it fails to explain units, valid ranges, or how parameters affect behavior.

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 action ('Create an empty MIDI item on a track') and the resource (MIDI item). It also indicates the return value (item_id) and links to a sibling tool (add_midi_note), helping differentiate its role in the workflow.

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 description implies a usage chain (create item then add notes), but does not explicitly state when to use this tool versus alternatives, nor does it provide exclusions or prerequisites beyond the implicit workflow.

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

Install Server

Other Tools

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/bonfire-audio/reaper-mcp'

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