Skip to main content
Glama
grandMA2 MCP
by drohi-r

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
GMA_HOSTYesgrandMA2 console IP address (required).
GMA_PORTNoTelnet port. Default: 30000 (30001 = read-only).30000
GMA_USERNograndMA2 console username. Default: administrator.administrator
GMA_SCOPENoOAuth scope tier (tier:0 through tier:5) mapping to the corresponding console user and MA2 rights level.
LOG_LEVELNoLog level. Default: INFO.INFO
GMA_PASSWORDNograndMA2 console password. Default: admin.admin
RAG_EMBED_MODELNoEmbedding model used by the RAG pipeline. Default: openai/text-embedding-3-small.openai/text-embedding-3-small
GMA_SAFETY_LEVELNoSafety level: standard (default), admin, or read-only.standard
GMA_TOOL_PROFILENoTool profile: core (28 tools), standard (104 tools), or full (237 tools, default).full
GMA_ELICIT_CONFIRMNoSet to 0 to never open confirm dialogs for destructive calls.1
GITHUB_MODELS_TOKENNoOptional GitHub PAT with models:read scope for semantic RAG embeddings.
GMA_MAX_REPLY_CHARSNoCap on raw console text returned per reply. Default: 20000.20000
RAG_EMBED_DIMENSIONSNoVector dimensions for RAG embeddings. Default: 1536.1536

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

grandMA2 MCP server — tools, resources, and prompts for console control via Telnet.

Use suggest_tool_for_task(task_description) to find the right tool for any task. Use ma2://docs/tool-taxonomy resource to browse all tools by category.

Core workflows: Inspect → navigate_console, list_console_destination, query_object_list, get_object_info Plan → plan_agent_goal (preferred) or inspect + list_system_variables + suggest_tool_for_task Execute → run_agent_goal (preferred agent harness) or run_task (lower-level rule-based orchestration)

SAFETY: DESTRUCTIVE tools require confirm_destructive=True. Rights: read ma2://docs/rights-matrix before any mutating operation.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
completions
{}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
reconfigure_connectionA

Swap the active console connection and (optionally) persist to .env.

Atomic swap: rebuilds the SessionManager under the manager lock so in-flight
tool calls either complete on the old manager or fail with ConnectionError
(operator-recoverable). With ``verify=True`` (default), a fresh client is
opened against the candidate host and ``ListVar`` is executed before any
swap; failure aborts the call and leaves the previous connection intact.

Args:
    host: New console host (IPv4 or hostname).
    port: Telnet port (default 30000).
    user: Console user.
    password: Console password.
    persist: When True, also write GMA_HOST/GMA_PORT/GMA_USER/GMA_PASSWORD to
        .env so the next server start uses them (default False: this run only).
    verify: When True, run a SAFE_READ probe before committing the swap.
        With False the reply says ``verified: false``. To just free the
        console, use disconnect_console instead of pointing at a dummy host.

Returns:
    JSON envelope: ``{success, previous_host, new_host, verified, persisted_to,
    note, warning, error}``.
decompose_taskA
    Break a high-level lighting goal into an ordered rule-based plan.

    Returns the plan summary and full step list so you can review
    before executing. Call run_task to actually execute.

    For the richer agent harness in src/server.py, prefer
    plan_agent_goal and run_agent_goal.

    Args:
        goal:     Natural-language intent, e.g. 'blue wash on movers'
        color:    Target color name or hex
        group:    Fixture group name
        sequence: Target sequence number for cue storage
        cue:      Target cue number
        preset:   Preset name or ID to apply
    
run_taskA
    Execute a full rule-based orchestration task from a natural-language goal.

    Orchestrates sub-agents with risk-tier isolation, working memory,
    and per-step evaluation.

    For the richer agent harness in src/server.py, prefer run_agent_goal.

    Args:
        goal: Natural-language show intent
        auto_confirm_destructive: Set True to allow DESTRUCTIVE steps
            without manual confirmation. Default False for safety.
    
list_agent_sessionsC
    List recent multi-agent task sessions from long-term memory.

    Args:
        limit: Number of most recent sessions to return (default 10)
    
recall_agent_sessionA
    Restore the full WorkingMemory snapshot from a past agent session.

    Args:
        session_id: 8-char session ID from list_agent_sessions
    
agent_token_reportB
    Report token consumption across recent agent sessions.

    Args:
        limit: Number of sessions to analyse
    
register_decomposition_ruleA
    Register a new task decomposition rule at runtime (admin only).

    Args:
        pattern:    Regex pattern matched against natural-language goals
        steps_json: JSON array of step dicts with keys:
                    name, agent_role, description,
                    allowed_risk (SAFE_READ|SAFE_WRITE|DESTRUCTIVE),
                    mcp_tools (array), depends_on (array), eval_criteria
    
resolve_object_refA
    Resolve a pool object name or ID to a correctly-quoted MA2 command token.
    Uses in-memory index only — zero telnet cost.

    match_mode="literal" (default): quotes names with special chars; * is literal.
    match_mode="wildcard": * is active operator — may match multiple objects.

    Args:
        object_type: Group | Sequence | Preset | Macro | Effect | Timecode |
                     Timer | View | Layout | World | Filter | Page |
                     Executor | Fixture | Channel | Cue
        name:        Display name (use name OR id, not both)
        id:          Numeric ID (0 = not provided)
        match_mode:  "literal" (default) or "wildcard"
        preset_type: Required for Preset objects (1=Dimmer … 9=Video)
    
list_pool_namesA
    List all known names and IDs for a pool type from the in-memory index.
    Zero telnet cost.

    Args:
        object_type: Any MA2 pool type (Group, Sequence, Macro, etc.)
        preset_type: For Preset objects only (1-9)
    
hydrate_console_stateA
    Trigger a fresh ConsoleStateSnapshot hydration on demand.
    Populates all 19 memory gaps + PoolNameIndex for all 16 pool types.

    Call this after load_show, new_show, or before DESTRUCTIVE multi-step tasks.

    Args:
        sequence_ids: Comma-separated sequence IDs for deep cue/part
                      hydration (e.g. "1,2,5"). Leave empty for fast path.
    
get_console_stateA
    Return the cached ConsoleStateSnapshot without re-hydrating.

    Zero telnet cost. Includes staleness flag and full summary.
    Call hydrate_console_state first if the snapshot is missing or stale.

    Returns:
        str: JSON with hydrated, staleness_warning, age_seconds, partial, summary.
    
get_park_ledgerA
    Return all currently parked fixtures from the snapshot ledger.

    Park state is tracked as a write-tracker (Gap 3). Parked fixtures
    silently ignore At commands — check this before any DESTRUCTIVE preset
    or intensity operation.

    Returns:
        str: JSON with parked_fixtures list, count, and a warning if non-empty.
    
get_filter_stateA
    Return the active filter ID and V/VT/E layer flags from the snapshot.

    Gap 1. An active filter silently restricts which attributes are stored
    in a cue or preset. Check this before any Store operation.

    Returns:
        str: JSON with active_filter, filter_vte dict, and a warning if active.
    
get_world_stateA
    Return the active world ID and known world labels from the snapshot.

    Gap 2. An active world gates which fixtures are visible. Critical for
    multi-universe shows where selection counts vary per world.

    Returns:
        str: JSON with active_world, world_labels dict, and a warning if active.
    
get_matricks_stateA
    Return the write-tracked MAtricks programmer state from the snapshot.

    Gap 6. No telnet readback exists for MAtricks — this write-tracker is
    the only source of truth. Updated by manage_matricks on every call.

    Returns:
        str: JSON with all MAtricksTracker fields and a human summary.
    
get_programmer_selectionA
    Return $SELECTEDFIXTURESCOUNT, $SELECTEDEXEC, and $SELECTEDEXECCUE from snapshot.

    Gaps 18 & 19. Zero telnet cost — reads hydrated system variable values.
    Use assert_selection_count to validate count against an expected value.

    Returns:
        str: JSON with selected_fixture_count, selected_exec, selected_exec_cue.
    
hydrate_sequencesA
    Deep-hydrate cues and parts for specific sequence IDs (Gaps 7 & 9).

    Triggers orchestrator.hydrate_snapshot(sequence_ids=[...]) for only the
    requested sequences, avoiding a full console re-scan. Use after
    creating or modifying specific sequences when you need cue detail.

    Args:
        sequence_ids: Comma-separated sequence IDs, e.g. "1,2,5".

    Returns:
        str: JSON with hydrated flag, sequence_ids list, partial flag.
    
get_sequence_memoryA
    Return the in-memory SequenceEntry and its CueRecords for a given ID.

    Zero telnet cost — reads from snapshot. Call hydrate_sequences first
    if the sequence is not yet in the snapshot.

    Args:
        sequence_id: The sequence ID to retrieve.

    Returns:
        str: JSON with sequence properties and cue list.
    
assert_selection_countA
    Assert that $SELECTEDFIXTURESCOUNT matches an expected value.

    Eval step for SelectionAgent. Reads from snapshot — zero telnet cost.
    A mismatch usually indicates a world/filter/park issue.

    Args:
        expected: Expected fixture count.
        tolerance: Acceptable delta (default 0 — exact match).

    Returns:
        str: JSON with passed bool, actual count, expected count, and message.
    
assert_preset_existsA
    Assert that a preset slot exists in the snapshot's pool inventory.

    Pre-flight check before store_preset or store_cue. Reads from snapshot
    name index — zero telnet cost.

    Args:
        preset_type: PresetType ID (1=Dimmer, 2=Position, 3=Gobo, 4=Color,
                     5=Beam, 6=Focus, 7=Control).
        preset_id: The preset slot ID to check.

    Returns:
        str: JSON with exists bool, preset_type, preset_id, and optional warning.
    
get_executor_detailA
    Return the full ExecutorState for a given executor ID from the snapshot.

    Gap 10. Includes priority, button/fader function, autostart, killprotect.
    Zero telnet cost — reads from snapshot. Call hydrate_console_state first.

    Args:
        executor_id: The executor ID to retrieve.

    Returns:
        str: JSON with all ExecutorState fields, or an error if not found.
    
diff_console_stateA
    Compare the current ConsoleStateSnapshot against a caller-supplied baseline.

    Pass a JSON dict with any subset of: active_filter, active_world,
    selected_fixture_count, fader_page, active_user_profile,
    has_unsaved_changes, console_modes, filter_vte, parked_count.
    Unrecognised keys are ignored.

    Args:
        baseline: JSON string with baseline field values to compare against.

    Returns:
        str: JSON with changed_fields, unchanged_count, snapshot_age_seconds.
    
get_showfile_infoA
    Return show identity and host info from the cached ConsoleStateSnapshot.

    Zero telnet cost — reads fields hydrated during hydrate_console_state.
    For live $DATE/$TIME values, use get_variable with var_name=DATE or TIME.

    Returns:
        str: JSON with showfile, version, host_status, active_user, hostname.
    
watch_system_varA
    Poll a grandMA2 system variable until it matches an expected value or times out.

    Uses ListVar telnet command. Requires an active telnet connection.

    Args:
        var_name:        Variable name (with or without leading $, case-insensitive).
                         e.g. "FADERPAGE" or "$FADERPAGE"
        expected_value:  Value to wait for (string comparison).
        timeout_seconds: Maximum wait time in seconds (capped at 30.0).
        poll_interval:   Seconds between polls (minimum 0.1).

    Returns:
        str: JSON with matched, final_value, elapsed_seconds, polls.
    
confirm_destructive_stepsA
    Preview the DESTRUCTIVE steps in a task plan before running it.

    Decomposes the goal and returns only the steps that require explicit
    human confirmation (risk_tier == DESTRUCTIVE). Show this to the user
    before calling run_task with auto_confirm_destructive=True.

    Args:
        goal:     Natural-language task goal (same as run_task)
        color:    Target color name or hex
        group:    Fixture group name
        sequence: Target sequence number
        cue:      Target cue number
        preset:   Preset name or ID
    
abort_taskA
    Mark a task session as aborted and return its completion status.

    Looks up the session in long-term memory and surfaces its completed/failed
    step list with an aborted label. Use this when a running task must be halted
    mid-way or when a completed session needs to be retroactively voided.

    Args:
        session_id: 8-char session ID from list_agent_sessions or run_task output.
        reason:     Abort reason string (default "user_requested").

    Returns:
        str: JSON with aborted, session_id, reason, steps_completed, steps_failed.
    
retry_failed_stepsA
    Retry all failed steps from a prior task session.

    Loads the session from long-term memory, retrieves its original goal,
    and re-executes the task via run_task. Returns the retry outcome.

    This is a full re-run of the original goal, not a selective step replay.
    For selective step control, use decompose_task + run_task directly.

    Args:
        session_id: 8-char session ID from list_agent_sessions.

    Returns:
        str: JSON with retried, session_id, original_goal, new_session_id,
             failed_steps_before, outcome.
    
assert_fixture_existsA
    Assert that a fixture ID exists in the console patch.

    Two-tier lookup:
      1. If a ConsoleStateSnapshot is available and the Fixture pool is
         indexed, performs a zero-telnet check against the in-memory index.
      2. Otherwise sends `list fixture {id}` via telnet and checks for
         "NO OBJECTS FOUND" in the response (same mechanism as park_fixture).

    Use this before any selection or programming operation when the fixture
    ID is not guaranteed to be in the current patch.

    Args:
        fixture_id: The numeric fixture ID to check (e.g. 101).

    Returns:
        str: JSON with exists, fixture_id, source ("snapshot" or "live_telnet"),
             and a hint if the fixture is not found.
    
get_tool_metricsA
    Return latency and error-rate statistics for a single MCP tool.

    Queries the ``tool_invocations`` telemetry table for all recorded
    calls to ``tool_name`` in the last ``days`` days.

    Returns call count, error rate, p50/p95 latency in milliseconds,
    and the distinct error classes seen.  Returns ``{"calls": 0}`` if
    no invocations have been recorded yet.

    Args:
        tool_name: Exact name of the MCP tool (e.g. "list_objects").
        days: Look-back window in days (default 7).
    
list_skillsA
    Search the skill registry for stored playbooks.

    If ``query`` is provided, performs a case-insensitive substring
    search across skill name, description, and applicable_context.
    If ``query`` is empty, returns the most recently updated skills.

    DESTRUCTIVE-scope skills are included in results regardless of
    their ``approved`` status so operators can review them.

    Args:
        query: Optional search term (e.g. "wash look", "color preset").
        limit: Maximum number of results to return (default 20).
    
get_skillA
    Return full detail for a single skill including its lineage chain.

    Walks the ``parent_id`` chain to return all ancestor versions
    oldest-first, so you can see how the skill evolved over time.

    Args:
        skill_id: UUID of the skill to retrieve.
    
promote_session_to_skillA
    Promote a completed agent session to a named, versioned Skill.

    The skill is stored in the registry with a quality score derived
    from the session's step success ratio.

    Safety rule: if ``safety_scope`` is ``DESTRUCTIVE``, the skill is
    created with ``approved=False`` and cannot be used until an operator
    calls ``approve_skill`` (requires SYSTEM_ADMIN scope).

    Args:
        session_id:        ID of the session to promote (8-char prefix or full UUID).
        name:              Short human name for the skill (e.g. "blue_wash_look").
        description:       One-line purpose statement.
        body:              Markdown playbook — steps, caveats, example inputs.
        safety_scope:      "SAFE_READ" | "SAFE_WRITE" | "DESTRUCTIVE"  (default SAFE_WRITE).
        applicable_context: Free-text retrieval hint (e.g. "color wash cue storage").
    
get_improvement_suggestionsA
    Return repair suggestions and promotion candidates from the analyser.

    Repair suggestions: tools failing >= ``min_failures`` times in the
    last ``days`` days, with a human-readable hint for each.

    Promotion candidates: successful sessions not yet promoted to Skills,
    with quality score >= ``min_quality``.

    This tool is read-only — it never writes to the skill registry.

    Args:
        days:          Look-back window for failure detection (default 7).
        min_failures:  Minimum error count to flag a tool (default 3).
        min_quality:   Minimum session quality to suggest promotion (default 0.8).
    
approve_skillA
    Approve a DESTRUCTIVE-scope skill for agent use.

    Sets ``approved=True`` on the named skill.  Once approved, agents
    with sufficient OAuth scope may invoke the skill's playbook.

    This tool requires ``OAuthScope.SYSTEM_ADMIN`` (tier 5 / ``GMA_SCOPE=tier:5``).
    It is the human gate that prevents autonomous DESTRUCTIVE skill promotion.

    Args:
        skill_id: UUID of the skill to approve.
    
assert_showfile_unchangedA
    Verify the currently open show matches the baseline captured at last hydration.

    Performs a live ListVar read and compares $SHOWFILE against the cached
    ConsoleStateSnapshot. Use this before committing a batch of DESTRUCTIVE
    changes to confirm the operator has not loaded a different show since
    the last hydrate_console_state call.

    Returns:
        JSON with {"ok": true, "showfile": name} when unchanged.
        JSON with {"ok": false, "expected": baseline, "actual": live}
        when the show has changed.
        JSON with {"ok": false, "reason": "..."} when not yet hydrated
        or telnet is unavailable.

    Risk tier: SAFE_READ
    
snapshot_console_baselineA
Snapshot a console-state baseline for divergence detection (SAFE_READ).

Records a cheap fingerprint of the console — showfile, user, page
counters, selected executor, and the ID sets of the group/sequence/
macro/world/filter pools. Call this at the start of a working session
(or before handing the desk to another operator); later, call
detect_console_divergence to see what changed outside this MCP session.

Returns:
    str: JSON with the recorded baseline and captured_at timestamp.
run_agent_goalA

Execute a high-level production goal using the agent runtime.

The agent runtime decomposes the goal into a sequenced plan, validates
it against safety policies, executes steps with verification, and
produces a structured execution trace.

SAFETY: Destructive steps require confirmation. Set auto_confirm=True
to skip confirmation prompts (use with caution).

Args:
    goal: Natural language goal, e.g. "Patch 8 Mac 700 fixtures
        starting at address 1.001 and assign to executor 1"
    auto_confirm: If True, auto-confirm all destructive steps.
        If False (default), destructive steps remain blocked unless
        the runtime can obtain an explicit confirmation callback.
    dry_run: If True, generate and validate the plan but do NOT
        execute it. Returns the plan and policy warnings.

Returns:
    str: JSON execution trace with goal, plan, steps, result,
        and timing information.

Examples:
    - "List all groups" → discovery workflow
    - "Patch 4 Mac 700 fixtures at 1.001" → patch workflow
    - "Create a color preset for group 1" → preset workflow
plan_agent_goalA

Generate a plan for a goal WITHOUT executing it.

Useful for previewing what the agent would do before committing.
Returns the parsed goal, generated plan steps, and any policy warnings.

Args:
    goal: Natural language goal to plan for.

Returns:
    str: JSON with intent, plan steps, confidence, and warnings.
find_preset_usagesA
Find all sequences and cues that reference a specific preset (SAFE_READ).

Scans sequence cue data for Preset references before you update or delete.
Also reports which executors play sequences that use this preset.

Args:
    preset_type: Preset type name (e.g. "color", "position", "gobo").
    preset_id: Preset slot number.
    max_sequences: Max sequences to scan (default 50, higher = slower).

Returns:
    str: JSON with usages, executor_references, total_references, risk_if_deleted.
diff_cuesA
Structured diff of two cues showing per-attribute changes (SAFE_READ).

More detailed than compare_cue_values — parses attribute names, timing,
labels, and block status. Falls back to raw line diff if parsing fails.

Args:
    sequence_id: Sequence containing both cues.
    cue_a: First cue number.
    cue_b: Second cue number.

Returns:
    str: JSON with changes[], timing_diff, label_diff, block_diff, identical.
get_page_mapA
Get a complete topology map of an executor page (SAFE_READ).

Returns every executor with its assignment, fader role, trigger type,
priority, width, and label. Richer than scan_page_executor_layout.

Args:
    page: Executor page number (default 1).

Returns:
    str: JSON with executors[], occupied count, free_slots[], total_slots.
lint_macroA
Static analysis of a grandMA2 macro for unsafe patterns (SAFE_READ).

Checks for: destructive commands without gates, broken jump targets,
missing quotes, unsafe raw patterns, potential infinite loops.

Args:
    macro_id: Macro number to lint.

Returns:
    str: JSON with issues[], overall (clean/warning/error), lines_checked.
detect_programmer_contaminationA
Check for leftover programmer state before critical operations (SAFE_READ).

Detects: selected fixtures, active filters, active worlds, MAtricks state,
highlight/freeze/solo modes, and parked fixtures. Run this before storing
cues, presets, or making show-critical changes.

Returns:
    str: JSON with contaminated bool, checks[], recommendation.
preview_preset_update_impactA
Assess the impact of updating or deleting a preset (SAFE_READ).

Calls find_preset_usages internally and classifies the risk level.
Run this before any Store, Update, or Delete on a preset.

Args:
    preset_type: Preset type name (e.g. "color", "position").
    preset_id: Preset slot number.

Returns:
    str: JSON with impact_level (safe/risky/catastrophic), affected details, recommendation.
detect_tracking_leaksB
Find attributes unintentionally tracking into later cues (SAFE_READ).

Compares adjacent cue pairs to find values that persist without an
explicit Block. Tracking leaks cause unexpected looks in later cues.

Args:
    sequence_id: Sequence to analyze.
    max_cues: Max cues to compare (default 20).

Returns:
    str: JSON with leaks[], total_leaks, recommendation.
audit_page_consistencyA
Audit an executor page for layout consistency issues (SAFE_READ).

Checks: all executors labeled, speed masters assigned, first-button
protocol followed, no orphan executors, consistent naming.

Args:
    page: Executor page to audit (default 1).

Returns:
    str: JSON with checks[], overall_status, recommendation.
plan_fixture_swapA
Plan a fixture type swap and assess compatibility (SAFE_READ).

Compares attributes between old and new fixture types to identify
what will transfer cleanly and what needs manual attention.

Args:
    old_fixture_type: Current fixture type name (e.g. "Mac 700 Profile").
    new_fixture_type: Target fixture type name (e.g. "Mac Viper").

Returns:
    str: JSON with compatible_attributes, missing_attributes, risk_level, migration_steps.
incident_snapshotA
Capture full console state for incident reporting (SAFE_READ).

Creates a comprehensive snapshot of the current console state including
page, modes, selection, parks, filter/world, active executors, and
recent errors. Use this when something goes wrong on site.

Returns:
    str: JSON with full state capture and human-readable summary.
trace_attribute_lineageA
Trace likely sources of an attribute's current value (SAFE_READ).

This is a best-effort lineage tool for debugging "why is this here?"
scenarios. It combines live snapshot context with cue text scans to find
candidate sequence/cue sources mentioning the attribute and, optionally,
the target fixture.

Args:
    attribute: Attribute name to search for (e.g. "Dimmer", "ColorRGB1").
    fixture_id: Optional fixture ID to narrow the lineage search.
    sequence_id: Optional sequence to inspect directly.
    max_sequences: Max sequences to inspect when sequence_id is omitted.
    max_cues_per_sequence: Max cues per sequence to inspect.

Returns:
    str: JSON with live_context, candidate_sources, inspected_sequences, summary.
find_executor_dependenciesB
Inspect a playback executor and extract likely dependencies (SAFE_READ).

Args:
    page: Executor page number.
    executor_id: Executor number on the page.

Returns:
    str: JSON with assignment info, dependency fields, and warnings.
find_unused_objectsA
Find likely unused object candidates using grounded heuristics (SAFE_READ).

Supported types:
  - sequence: not assigned to any hydrated executor
  - macro: not referenced by another macro and not currently active
  - preset: no cue references found via find_preset_usages

Args:
    object_type: One of "sequence", "macro", or "preset".
    max_objects: Max objects to inspect.
    preset_type: Required for object_type="preset".

Returns:
    str: JSON with candidate_unused list and heuristic notes.
validate_universal_preset_coverageB
Check whether a universal preset slot range is populated cleanly (SAFE_READ).

Args:
    preset_type: Preset type name (e.g. "color", "position").
    start_id: First preset slot in the expected range.
    end_id: Last preset slot in the expected range.

Returns:
    str: JSON with occupied slots, missing slots, coverage percent, and recommendation.
compare_patch_to_show_expectationA
Compare the current patch against expected fixture-type counts (SAFE_READ).

Args:
    expected_fixture_types: Comma-separated "Fixture Type=Count" entries.
        Example: "Mac Aura XB=8, Viper Profile=4"

Returns:
    str: JSON with expected vs actual counts, missing types, and fit status.
snapshot_programmer_stateA
Capture a structured programmer-state snapshot for later review (SAFE_READ).

Returns:
    str: JSON with a restorable snapshot subset plus non-restorable context.
restore_programmer_stateA
Preview or apply a conservative programmer-state restore (SAFE_WRITE).

This tool intentionally restores only fields that can be expressed
confidently through existing MA2 telnet commands. It does not attempt to
recreate exact fixture selections, parked-fixture state, or MAtricks.

Args:
    snapshot_json: JSON payload from snapshot_programmer_state().
    apply: If False (default), return the restore plan only.
    clear_before_restore: If True, begin with ClearAll when apply=True.

Returns:
    str: JSON with planned commands, executed commands, and skipped fields.
generate_song_macro_packA
Draft a song macro pack using a practical busking-page structure (SAFE_READ).

This returns macro labels and line content only. It does not store any
macros on the console.

Args:
    song_name: Human-readable song title.
    sequence_id: Primary playback sequence for the song.
    start_macro_id: First macro ID to assign in the draft pack.
    target_page: Page operators should jump to before loading the song.

Returns:
    str: JSON with draft macro definitions and first-button protocol notes.
assign_effect_to_executorA
Assign an effect template to a fader executor slot (DESTRUCTIVE).

Binds an effect from the effect library to an executor so the fader controls
effect intensity in live busking mode. This is the core primitive for the
fader-per-effect busking model.

Args:
    effect_id: Effect pool ID to assign (1-based).
    executor_id: Target executor slot number on the page.
    page: Optional page number. When given, qualifies as 'Page {page}.{exec}'.
    confirm_destructive: Must be True to execute (DESTRUCTIVE — modifies executor assignment).

Returns:
    JSON result with command sent and console response.
modulate_effectA
Set rate or speed on active effects in real time (SAFE_WRITE).

Used in busking to live-modulate effect tempo without stopping playback.
Rate is a relative multiplier (100 = normal, 200 = double).
Speed is an absolute BPM target (overrides rate).

Args:
    mode: "rate" (relative 1–200, 100=normal) or "speed" (absolute BPM).
    value: Numeric value for the chosen mode.

Returns:
    JSON result with command sent and console response.
clear_effects_on_pageA
Release (kill) all effect executors across a page range (SAFE_WRITE).

Sends Off commands to every executor in the range, stopping all running
effects. Use during song transitions to clean up the previous song's state.
Does not change fader positions — use normalize_page_faders for that.

Args:
    page: Fader page number.
    start_exec: First executor slot to release (default 1).
    end_exec: Last executor slot to release (default 20).

Returns:
    JSON result with command count and console response.
normalize_page_fadersA
Set all faders on a page to 0 without releasing executors (SAFE_WRITE).

Silences all effects while keeping them armed for instant recall — the
standard busking blackout technique. Faders return to zero but executors
remain active; pushing the fader up immediately restores the effect.

Args:
    page: Fader page number.
    start_exec: First executor slot (default 1).
    end_exec: Last executor slot (default 20).

Returns:
    JSON result with command count and console response.
classify_show_modeA
Inspect the show and classify its execution mode (SAFE_READ).

Queries the effect and macro libraries to determine whether the current
show is structured for busking (effect-fader model), sequence-driven
playback, or a hybrid of both.

Returns:
    JSON with mode classification and supporting evidence:
    - "busking"  — primarily effects assigned to fader executors
    - "sequence" — primarily cue sequences on executors
    - "hybrid"   — mix of effects and sequences
    - "empty"    — no content detected
list_tool_categoriesB
List auto-discovered tool categories (SAFE_READ).

Returns the ML-generated taxonomy of all MCP tools grouped by
functional similarity.  Categories are discovered via unsupervised
K-Means clustering over hybrid features (structural metadata +
docstring embeddings).

Args:
    category: Optional category name filter (case-insensitive partial match).

Returns:
    str: JSON with categories, tool lists, and clustering metadata.
recluster_toolsA
Trigger re-clustering of all MCP tools (SAFE_READ).

Runs the full ML pipeline: extract features from tool definitions,
embed docstrings, cluster via K-Means, and regenerate the taxonomy.

Args:
    provider: Embedding provider — "zero" (fast stub) or "github"
              (real embeddings, requires GITHUB_MODELS_TOKEN).
    k: Override number of clusters.  None = auto-select via silhouette.
    alpha: Structural feature weight (0–1). Embedding weight = 1 − alpha.

Returns:
    str: JSON summary with categories, silhouette score, and tool assignments.
get_similar_toolsA
Find the most similar MCP tools to a given tool (SAFE_READ).

Uses Euclidean distance in the combined feature space (structural +
embedding) from the last clustering run.

Args:
    tool_name: Name of the reference tool (e.g. "playback_action").
    top_n: Number of similar tools to return (default 5).

Returns:
    str: JSON array of similar tools ranked by distance, with category.
suggest_tool_for_taskA
Suggest MCP tools for a natural-language task description (SAFE_READ).

Embeds the task description and finds the closest tools by cosine
similarity against stored docstring embeddings.  Falls back to keyword
matching when using the zero-vector provider or when no embedding token
is available.

Args:
    task_description: What you want to accomplish (e.g. "fade out all fixtures").
    top_n: Number of suggestions to return (default 3).
    provider: Embedding provider — "zero" (keyword fallback) or "github".
        Overridden by ``prefer_semantic`` when a token is available.
    prefer_semantic: When True (default), automatically use embedding-based
        search if GITHUB_MODELS_TOKEN is set in the environment.  Falls back
        to keyword matching with a ``warning`` field when no token is present.
        Set to False to force keyword matching regardless of token availability.

Returns:
    str: JSON array of suggested tools with scores and descriptions.
         Includes a top-level ``warning`` key when semantic search was
         requested but fell back to keyword matching.
query_object_listA
List objects from the show file by type — cues, groups, presets, etc.

Sends typed `list <type>` commands with type-specific options.
Different from list_console_destination (which lists at the current
navigation location). This tool queries named object pools directly.

Args:
    object_type: Object type to list. Typed shortcuts:
        "cue", "group", "preset", "attribute", "messages".
        Or any generic type (e.g. "sequence", "macro", "executor").
        If omitted, lists all objects at the default scope.
    object_id: Optional object ID to list a specific item
    end: Optional end ID for range listing (e.g. cue 1 thru 10)
    sequence_id: Sequence to list cues from (only for object_type="cue")
    preset_type: Preset type name or number (only for object_type="preset",
        e.g. "color", "position", "4")
    filename: Optional filename to export the list output
    condition: Optional filter condition (for "messages" or generic types)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - List all cues: object_type="cue"
    - List cues in sequence 2: object_type="cue", sequence_id=2
    - List groups: object_type="group"
    - List color presets: object_type="preset", preset_type="color"
    - List attributes: object_type="attribute"
list_system_variablesA
List all grandMA2 built-in system variables (SAFE_READ).

Sends `ListVar` to the console and returns parsed key=value pairs.
System variables include $SELECTEDEXEC, $TIME, $DATE, $VERSION, $HOSTSTATUS,
$FADERPAGE, $BUTTONPAGE, $SELECTEDFIXTURESCOUNT, $USER, $HOSTNAME, etc.

Args:
    filter_prefix: Optional prefix filter (case-insensitive).
        e.g. "SELECTED" returns only $SELECTEDEXEC, $SELECTEDEXECCUE, etc.
        Omit to return all variables.

Returns:
    str: JSON with `variables` dict (name→value), `variable_count`, and `raw_response`.
playback_actionA
Execute playback operations — go, go back, goto, fast forward/back, etc.

Full-featured playback control with cue_mode and executor targeting.
Coexists with execute_sequence (which uses legacy go_sequence/pause_sequence).

Args:
    action: Playback action to perform:
        "go" — fire the next cue (optionally on a specific executor/sequence)
        "go_back" — fire the previous cue
        "goto" — jump to a specific cue (requires cue_id)
        "fast_forward" — skip forward (>>>)
        "fast_back" — skip backward (<<<)
        "def_go" — go on the selected executor (go+); response includes
                   selected_executor and selected_cue_before
        "def_go_back" / "def_goback" — go back on the selected executor;
                   response includes selected_executor and selected_cue_before
        "def_pause" — pause the selected executor; response includes
                   selected_executor and selected_cue_before
    object_type: Object type for go/go_back (e.g. "executor", "sequence")
    object_id: Object ID for go/go_back — single int or list of ints.
               List produces "N + M + ..." syntax for multi-executor targeting.
    cue_id: Target cue number (required for "goto")
    end: End ID for range (go/go_back)
    cue_mode: Cue execution mode: "normal", "assert", "xassert", "release"
    executor: Executor ID for goto/fast_forward/fast_back — single int or list of ints.
              List produces "N + M + ..." syntax (e.g. [1,2,3] → ">>> executor 1 + 2 + 3").
    sequence: Sequence ID for goto/fast_forward/fast_back

Returns:
    str: JSON with command_sent and raw_response.
         def_go/def_go_back/def_pause also include selected_executor and
         selected_cue_before (read from $SELECTEDEXEC before firing).

Examples:
    - Go on executor 1: action="go", object_type="executor", object_id=1
    - Go on executors 1+2+3: action="go", object_type="executor", object_id=[1,2,3]
    - Go back: action="go_back"
    - Goto cue 5: action="goto", cue_id=5
    - Goto cue 3 on sequence 2: action="goto", cue_id=3, sequence=2
    - Fast forward: action="fast_forward"
    - Fast forward executors 1,2,3: action="fast_forward", executor=[1,2,3]
    - Go on selected executor: action="def_go"
    - Go back on selected executor: action="def_go_back"
manage_variableA
Set, add to, or list console variables (global or user-scoped).

Variables are named values stored on the console that can be used in
macros and command line expressions. The $ prefix is automatically
added to var_name if not already present.

Args:
    action: "set" to assign a value, "add" to increment, "list" to show all variables
    scope: "global" for system variables, "user" for user-scoped variables
    var_name: Variable name (e.g. "myvar" or "$myvar" — $ auto-added)
    value: Value to set or add. Required for "add", optional for "set",
        ignored for "list"
    input_dialog: If True with action="set", shows an input dialog
        on the console for the user to enter a value

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Set global var: action="set", scope="global", var_name="myvar", value=42
    - Set user var: action="set", scope="user", var_name="speed", value=100
    - Add to global: action="add", scope="global", var_name="counter", value=1
    - List global vars: action="list", scope="global"
    - List user vars: action="list", scope="user"
label_or_appearanceA
Label or set the appearance of console objects.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    action: "label" to set a name, "appearance" to set visual styling
    object_type: Object type (e.g. "group", "sequence", "cue", "preset")
    object_id: Object ID
    name: Name to assign (required for action="label")
    end: End ID for range labeling (e.g. group 1 thru 5)
    preset_type: For labeling presets, the preset type (e.g. "color", "position").
        When set, uses the specialized label_preset builder.
    confirm_destructive: Must be True to execute (safety gate)
    color: Hex color string for appearance (e.g. "FF0000")
    red: Red component (0-100) for appearance
    green: Green component (0-100) for appearance
    blue: Blue component (0-100) for appearance
    hue: Hue value for appearance
    saturation: Saturation value for appearance
    brightness: Brightness value for appearance
    reset: Reset appearance to default
    source_type: Copy appearance from this object type
    source_id: Copy appearance from this object ID

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Label group 3: action="label", object_type="group", object_id=3, name="Front Wash"
    - Label color preset 1: action="label", object_type="preset", object_id=1,
      preset_type="color", name="Red"
    - Set group appearance: action="appearance", object_type="group", object_id=1,
      color="FF0000"
assign_objectA
Assign objects, functions, fades, or layout positions on the console.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    mode: Assignment mode:
        "assign" — assign source object to target (e.g. sequence to executor)
        "function" — assign a function to an executor (e.g. Toggle, Flash)
        "fade" — assign a fade time to a cue
        "layout" — assign an object to a layout position
        "empty" — deactivate an executor (assign empty function)
        "temp_fader" — assign temp fader function to an executor
    confirm_destructive: Must be True to execute (safety gate)
    source_type: Source object type (for "assign" and "layout" modes)
    source_id: Source object ID (for "assign" and "layout" modes)
    target_type: Target object type (for "assign", "function", "empty", "temp_fader")
    target_id: Target object ID
    function: Function name for "function" mode (e.g. "Toggle", "Flash", "Go")
    fade_time: Fade time in seconds for "fade" mode
    cue_id: Cue ID for "fade" mode
    sequence_id: Sequence ID for "fade" mode
    layout_id: Layout ID for "layout" mode
    x: X position for "layout" mode
    y: Y position for "layout" mode
    noconfirm: Skip console confirmation dialog

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Assign sequence 1 to executor 6: mode="assign", source_type="sequence",
      source_id=1, target_type="executor", target_id=6
    - Assign Toggle to executor 101: mode="function", function="Toggle",
      target_type="executor", target_id=101
    - Assign fade 3s to cue 5: mode="fade", fade_time=3, cue_id=5
    - Assign group to layout: mode="layout", source_type="group", source_id=1,
      layout_id=1, x=5, y=2
    - Empty executor 1: mode="empty", target_type="executor", target_id=1
edit_objectA
Edit, cut, or paste objects in the show.

- edit: Opens an object for editing (SAFE_WRITE)
- cut: Removes an object and places it on the clipboard (DESTRUCTIVE)
- paste: Places clipboard contents at a target location (DESTRUCTIVE)

SAFETY: cut and paste are DESTRUCTIVE and require confirm_destructive=True.
edit does not require confirmation.

Args:
    action: "edit", "cut", or "paste"
    object_type: Object type (e.g. "preset", "cue", "group")
    object_id: Object ID (for edit and cut)
    target_id: Target ID for paste destination
    end: End ID for range operations
    confirm_destructive: Must be True for cut/paste (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Edit cue 1: action="edit", object_type="cue", object_id=1
    - Cut preset 4.1: action="cut", object_type="preset", object_id="4.1"
    - Paste to group 5: action="paste", object_type="group", target_id=5
remove_contentA
Remove content from objects (fixtures from groups, effects, preset types, etc.).

Unlike delete (which removes the object itself), remove takes content out of
an object. For example, removing a fixture from a group, or removing an effect
from a cue.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: What to remove. Special types:
        "selection" — remove the current selection
        "fixture" — remove a fixture (from a group, cue, etc.)
        "effect" — remove an effect
        "presettype" — remove a preset type from the programmer
        Or any generic type for the generic remove command.
    object_id: Object ID to remove (not needed for "selection")
    end: End ID for range removal
    if_filter: Conditional filter (e.g. "PresetType 1")
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Remove selection: object_type="selection"
    - Remove fixture 1: object_type="fixture", object_id=1
    - Remove fixture with filter: object_type="fixture", object_id=1,
      if_filter="PresetType 1"
    - Remove effect 1: object_type="effect", object_id=1
    - Remove preset type: object_type="presettype", object_id="position"
store_objectA
Store (create) a generic object in the show — macros, effects, worlds, etc.

For cues, use store_current_cue. For presets, use store_new_preset.
For groups, use create_fixture_group. This tool handles everything else.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: Object type to store (e.g. "macro", "effect", "world",
        "sequence", "executor", "timecode")
    object_id: Object ID number or slot
    name: Optional name for the stored object
    merge: Merge into existing object if present
    overwrite: Overwrite existing object if present
    noconfirm: Skip console confirmation dialog
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Store macro 5: object_type="macro", object_id=5
    - Store effect 1 named "Rainbow": object_type="effect", object_id=1, name="Rainbow"
    - Overwrite sequence 3: object_type="sequence", object_id=3, overwrite=True
create_fixture_groupA
Create a group containing a specified range of fixtures (DESTRUCTIVE).

This tool selects the specified range of fixtures and saves them as a group.
Optionally, a name can be assigned to the group.

Args:
    start_fixture: Starting fixture number
    end_fixture: Ending fixture number
    group_id: Group number to save
    group_name: (Optional) Group name, e.g., "Front Wash"
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: Operation result message

Examples:
    - Save fixtures 1 to 10 as group 1
    - Save fixtures 1 to 10 as group 1 with name "Front Wash"
execute_sequenceB
Execute sequence-related operations.

Args:
    sequence_id: Sequence number
    action: Operation type: "go" (execute), "pause" (pause), or "goto" (jump to cue)
    cue_id: (Required for goto) Target cue number

Returns:
    str: Operation result message

Examples:
    - Execute sequence 1
    - Pause sequence 2
    - Jump to cue 5 of sequence 1
send_raw_commandA
Send a raw MA command to grandMA2 and return the console response.

WARNING: This is a low-level tool that sends commands directly to a LIVE
lighting console. Prefer the higher-level tools (create_fixture_group,
execute_sequence) whenever possible.

SAFETY: Commands are classified by risk tier before sending:
- SAFE_READ (list, info, cd): Always allowed
- SAFE_WRITE (at, go, clear, blackout): Allowed in standard and admin mode
- DESTRUCTIVE (delete, store, assign, shutdown): Blocked unless
  confirm_destructive=True. Set GMA_SAFETY_LEVEL=admin to skip checks.

Args:
    command: Raw MA command to send
    confirm_destructive: Must be True to send destructive commands
        (delete, store, assign, shutdown, newshow, etc.)

Returns:
    str: JSON with command_sent, risk_tier, raw_response, and any
        safety block information.

Examples:
    - go+ executor 1.1
    - list cue
    - store sequence 1 cue 1 (requires confirm_destructive=True)
run_command_batchA
Run many raw MA commands in order on one held connection (DESTRUCTIVE if any line is).

Every line (and every ';'-part of a line) is risk-classified before anything
is sent; if any is DESTRUCTIVE the whole batch needs confirm_destructive=True.
Each command waits for its own console prompt, so batches run far faster than
one send_raw_command call per line. Stops at the first console error or
pop-up unless stop_on_error=False (a pop-up always stops the batch).

Args:
    commands: Command lines to send, in order.
    commands_file: Path to a .txt/.cmd/.ma2/.macro file, one command per
        line; blank lines and lines starting with '#' are skipped.
    confirm_destructive: Required when any line is DESTRUCTIVE.
    stop_on_error: Stop at the first rejected command (default True).
    delay: Seconds to wait after each send before reading (default 0).
    timeout: Seconds to wait for each command's first output.

Returns:
    str: JSON summary — total, executed, failed (line, command, errors),
        stopped_early, duration_s, last_reply.
answer_console_popupA
Answer a console pop-up a previous tool reported as pending_popup.

Pass the option number from pending_popup.options. Choosing the Cancel
option is always allowed (give its number as cancel_option); any other
answer can confirm an overwrite or delete and needs confirm_destructive=True.

Args:
    choice: Option number to press (e.g. 1 for "Ok").
    cancel_option: The pop-up's Cancel option number, when known.
    confirm_destructive: Required for any answer other than Cancel.

Returns:
    str: JSON with command_sent and raw_response.
disconnect_consoleA
Close this server's Telnet session(s) to the console.

Use it to free the console for another Telnet client or to stop an idle
session; the next tool call reconnects automatically with the current
settings. Does not change any console state.

Returns:
    str: JSON with sessions_closed.
navigate_consoleA
Navigate the grandMA2 console's object tree using ChangeDest (cd).

Sends a cd command and captures the raw telnet response, attempting
to parse the resulting console prompt to determine the current
location in the object tree.

EXPLORATORY: The exact MA2 telnet prompt format is being validated.
The raw_response field always contains the unmodified telnet output
for manual inspection, regardless of whether parsing succeeded.

Args:
    destination: Navigation target. Supported formats:
        - "/" to go to root
        - ".." to go up one level
        - A number (e.g., "5") to navigate by index
        - An object type (e.g., "Group") when object_id is provided
          (uses dot notation: cd Group.1)
        - A quoted name (e.g., '"MySequence"') to navigate by name
    object_id: Object ID, produces dot notation cd [type].[id]
        (e.g., destination="Group", object_id=1 → cd Group.1)

Returns:
    str: JSON with command_sent, raw_response, parsed prompt details,
         and success indicator.

Examples:
    - Navigate to root: destination="/"
    - Go up one level: destination=".."
    - Navigate to Group 1: destination="Group", object_id=1 → cd Group.1
    - Navigate by index: destination="5"
    - After navigating, use list_console_destination to enumerate objects
get_console_locationA
Query the current grandMA2 console destination without navigating.

Sends an empty command to prompt the console to re-display its
prompt, then parses the response to determine the current location.

Returns:
    str: JSON with raw_response, parsed prompt details,
         and success indicator.
list_console_destinationA
List objects at the current grandMA2 console destination.

After navigating with cd (navigate_console), use this tool to
enumerate children at the current location.  Parses the list
feedback to extract object-type, object-id, and element names.

Args:
    object_type: Optional filter (e.g., "cue", "group", "preset").
        If omitted, lists everything at the current destination.

Returns:
    str: JSON with command_sent, raw_response, and parsed entries
         (each with object_type, object_id, name).
scan_console_indexesA
Scan numeric indexes via cd N → list → cd <reset_to>.

For each index N from 1 to max_index:
  1. cd N           — navigate into that index
  2. list           — enumerate children there
  3. cd <reset_to>  — return to the base location for the next iteration

The reset_to destination controls what each cd N is relative to:
  - "/"          (default) scan root-level indexes (Showfile, TimeConfig, …)
  - "Sequence"   reset to Sequence pool → cd N enters Sequence N → list shows its cues
  - "Group"      reset to Group pool → cd N enters Group N

Stops early after stop_after_failures consecutive indexes with no entries.

Args:
    reset_to: Where to navigate after each list before the next cd N (default "/").
    max_index: Highest index to try (default 50).
    stop_after_failures: Stop after this many consecutive empty indexes (default 3).

Returns:
    str: JSON with a list of scan results — one entry per index that
         returned list output, each with index, location, object_type,
         and parsed entries (object_type, object_id, name).
set_node_propertyA
Set a property on a node in the grandMA2 object tree (DESTRUCTIVE).

Uses the scan tree path notation (dot-separated indexes) to navigate
to a node and set an inline property using Assign [index]/property=value.

The path uses the same index-based notation as the scan tree output.
Split the path into parent segments and target index:
- "3.1" → cd 3 (Settings), then Assign 1/property=value (on Global)
- "4.1" → cd 4 (DMX_Protocols), then Assign 1/property=value (on Art-Net)
- "3" → at root, Assign 3/property=value (on Settings itself)

After setting, navigates back to root (cd /).
If verify=True (default), re-lists and confirms the property changed.

SAFETY: This modifies live console state. Requires confirm_destructive=True.

Args:
    path: Dot-separated index path (e.g. "3.1" for Settings/Global)
    property_name: Property to set (e.g. "Telnet", "OutActive")
    value: New value (e.g. "Login Enabled", "On")
    verify: Re-list after setting to confirm the change (default True)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with commands_sent, success, verified_value, and any errors.

Examples:
    - Set telnet to disabled: path="3.1", property_name="Telnet", value="Login Disabled"
    - Enable Art-Net output: path="4.1", property_name="OutActive", value="On"
set_intensityA
Set the intensity (dimmer) level on fixtures, groups, or channels.

This is the most fundamental lighting operation — controlling how bright
lights are. Selects the target and sets it to the specified percentage.

Args:
    target_type: Object type — "fixture", "group", or "channel"
    target_id: Object ID number
    level: Intensity percentage (0-100). Use 0 for off, 100 for full.
    end_id: End ID for range selection (e.g., fixture 1 thru 10)

Returns:
    str: JSON with command_sent and raw_response from the console.

Examples:
    - Set fixture 1 to 50%: target_type="fixture", target_id=1, level=50
    - Set group 3 to full: target_type="group", target_id=3, level=100
    - Set fixtures 1-10 to 75%: target_type="fixture", target_id=1, level=75, end_id=10
apply_presetA
Apply a preset to fixtures or groups.

Presets are stored lighting looks (color, position, gobo, etc.) that
can be recalled by type and ID. Optionally select fixtures/group first.

Preset types: "dimmer" (1), "position" (2), "gobo" (3), "color" (4),
"beam" (5), "focus" (6), "control" (7), "shapers" (8), "video" (9)

Args:
    preset_type: Preset type name or number (e.g. "color", "position", "4")
    preset_id: Preset number within that type
    fixture_id: Optional fixture to select first (single or range start)
    fixture_end: Optional end fixture for range selection
    group_id: Optional group to select first (alternative to fixture_id)

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Apply color preset 3 to current selection: preset_type="color", preset_id=3
    - Apply position preset 1 to group 2: preset_type="position", preset_id=1, group_id=2
    - Apply gobo preset 5 to fixtures 1-10: preset_type="gobo", preset_id=5, fixture_id=1, fixture_end=10
store_current_cueA
Store the current programmer state as a cue (DESTRUCTIVE).

Saves whatever is currently in the programmer (selected fixtures +
active values) into a cue in the specified sequence. This is how
lighting looks are programmed into a show.

Executor-sequence relationship:
  When sequence_id is omitted, MA2 stores into the sequence assigned to
  the currently selected executor on the console. Use select_executor()
  first to set the target, or pass sequence_id explicitly to make the
  destination unambiguous regardless of executor selection state.

  select executor N      → sets executor N as the active store target
  Store Cue M            → stores into the sequence on selected executor
  Store Cue M Sequence S → stores into sequence S directly (preferred)

Args:
    cue_number: Cue number to store (required)
    sequence_id: Sequence to store into. Omit to use the selected executor's
                 sequence (call select_executor() first if needed)
    label: Optional name for the cue
    merge: Merge new values into existing cue (default False)
    overwrite: Replace existing cue completely (default False)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Store cue 5 (explicit sequence): cue_number=5, sequence_id=1, confirm_destructive=True
    - Store cue 3 named "Opening Look": cue_number=3, label="Opening Look", confirm_destructive=True
    - Merge into cue 1: cue_number=1, merge=True, confirm_destructive=True
get_object_infoA
Query information about any object in the show.

Returns the console's info response for the specified object,
which includes its properties, status, and metadata.

Args:
    object_type: Object type (e.g. "fixture", "group", "cue",
        "sequence", "preset", "executor", "macro")
    object_id: Object ID. For presets use "type.id" format
        (e.g. "2.1" for color preset 1).

Returns:
    str: JSON with command_sent and raw_response containing
        the object's information.

Examples:
    - Get info on group 3: object_type="group", object_id=3
    - Get info on cue 5: object_type="cue", object_id=5
    - Get info on color preset 1: object_type="preset", object_id="2.1"
clear_programmerA
Clear the programmer to reset fixture selection and active values.

The programmer holds the current working state — selected fixtures
and any values you've applied. Clearing it gives you a clean slate.

Modes:
- "all": Empty the entire programmer (selection + values)
- "selection": Deselect all fixtures but keep active values
- "active": Deactivate values but keep fixture selection
- "clear": Sequential clear (selection → active → all on repeated calls)

Args:
    mode: Clear mode — "all" (default), "selection", "active", or "clear"

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Full reset: mode="all"
    - Just deselect fixtures: mode="selection"
    - Just drop active values: mode="active"
set_attributeA
Set a specific fixture attribute (Pan, Tilt, Zoom, etc.) to a value.

Controls individual fixture parameters beyond simple dimmer intensity.
Optionally select fixtures/group first.

Args:
    attribute_name: Attribute name (e.g. "Pan", "Tilt", "Zoom", "Focus", "Iris")
    value: Attribute value (typically 0-100 for percentage, or degrees for Pan/Tilt)
    fixture_id: Optional fixture to select first (single or range start)
    fixture_end: Optional end fixture for range selection
    group_id: Optional group to select first

Returns:
    str: JSON with commands_sent and raw_response.

Examples:
    - Set Pan to 120: attribute_name="Pan", value=120
    - Set Tilt to 50 on group 2: attribute_name="Tilt", value=50, group_id=2
    - Set Zoom on fixtures 1-10: attribute_name="Zoom", value=80, fixture_id=1, fixture_end=10
park_fixtureA
Park a fixture or DMX address at its current or specified output value.

Parking locks the output so it won't change when cues or programmer
values change. Useful for testing, worklights, or safety overrides.

Fixture targets are pre-validated: if the fixture does not exist on the
console, the command is not sent and an informative error is returned.
DMX targets (e.g. "dmx 101") bypass pre-validation.

Args:
    target: What to park (e.g. "fixture 20", "dmx 101", "fixture 20 thru 30")
    value: Optional output value to park at (0-255 for DMX, 0-100 for %)

Returns:
    str: JSON with command_sent (None if blocked), raw_response, exists.

Examples:
    - Park fixture 20 at current output: target="fixture 20"
    - Park DMX 101 at 128: target="dmx 101", value=128
    - Park fixture range: target="fixture 20 thru 30"
unpark_fixtureA
Unpark a previously parked fixture or DMX address.

Fixture targets are pre-validated before unparking. DMX targets bypass
pre-validation.

Args:
    target: What to unpark (e.g. "fixture 20", "dmx 101", "fixture 20 thru 30")

Returns:
    str: JSON with command_sent (None if blocked), raw_response, exists.

Examples:
    - Unpark fixture 20: target="fixture 20"
    - Unpark DMX 101: target="dmx 101"
run_macroB
Execute a macro by its ID number.

Macros are stored command sequences on the console. This triggers
the macro to run.

Args:
    macro_id: Macro number to execute

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Run macro 1: macro_id=1
    - Run macro 99: macro_id=99
delete_objectA
Delete an object from the show.

SAFETY: This is a DESTRUCTIVE operation. Requires confirm_destructive=True.

Args:
    object_type: Object type (e.g. "cue", "group", "preset", "fixture", "macro")
    object_id: Object ID to delete
    end_id: Optional end ID for range deletion (e.g. cue 1 thru 10)
    confirm_destructive: Must be True to execute (safety gate)

Returns:
    str: JSON with command_sent, raw_response, or block info.

Examples:
    - Delete cue 5: object_type="cue", object_id=5, confirm_destructive=True
    - Delete cues 1-10: object_type="cue", object_id=1, end_id=10, confirm_destructive=True
    - Delete group 3: object_type="group", object_id=3, confirm_destructive=True
copy_or_move_objectA
Copy or move an object to a new location (DESTRUCTIVE).

SAFETY: Both operations modify show data. Copy duplicates the object,
move relocates it (deleting the original). Requires confirm_destructive=True.

Args:
    action: "copy" or "move"
    object_type: Object type (e.g. "group", "cue", "preset", "macro")
    source_id: Source object ID
    target_id: Destination object ID
    source_end: Optional end ID for range copy/move
    overwrite: Overwrite target if it exists (default False)
    merge: Merge into target if it exists (default False)
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Copy group 1 to 5: action="copy", object_type="group", source_id=1, target_id=5
    - Move macro 3 to 10: action="move", object_type="macro", source_id=3, target_id=10
    - Copy cue range: action="copy", object_type="cue", source_id=1, target_id=20, source_end=10
store_new_presetA
Store the current programmer values as a preset.

Saves the active fixture values (from the programmer) into a preset
slot for later recall with apply_preset.

Preset types: "dimmer" (1), "position" (2), "gobo" (3), "color" (4),
"beam" (5), "focus" (6), "control" (7), "shapers" (8), "video" (9)

Scope flags (mutually exclusive — pick at most one):
  universal   — stores values indexed by fixture type (applies to any fixture
                of the same profile; not tied to specific fixture IDs).
  selective   — stores values tied to the specific fixtures selected during
                store. Recalled preset only affects those fixture IDs.
  global_scope — stores absolute values (no relative/tracking offset).

Workflow for universal color presets:
  1. SelFix 1 Thru 999
  2. attribute "ColorRgb1" at 100
  3. store_new_preset("color", 6, universal=True, overwrite=True, confirm_destructive=True)

SAFETY: This is a STORE operation which modifies show data.

Args:
    preset_type: Preset type name (e.g. "color", "position", "gobo")
    preset_id: Preset number within that type
    merge: Merge into existing preset (default False)
    overwrite: Replace existing preset with /overwrite flag (default False)
    universal: Store as universal preset — applies to any fixture of the same type
    selective: Store as selective preset — applies only to selected fixture IDs
    global_scope: Store with global (absolute) values
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with command_sent and raw_response.

Examples:
    - Store universal color preset: preset_type="color", preset_id=6, universal=True, confirm_destructive=True
    - Overwrite position preset 3: preset_type="position", preset_id=3, overwrite=True, confirm_destructive=True
console_loginA
Authenticate to the grandMA2 console as a specific user.

Sends a Login command over the active Telnet session, switching
the session to the specified user account and rights level.

Args:
    username: Console username (e.g. "operator", "administrator")
    password: Console password

Returns:
    str: JSON with command_sent and raw_response.
console_logoutB
Log out the current Telnet session user on the grandMA2 console.

Returns:
    str: JSON with command_sent and raw_response.
lock_console_uiA
Lock the grandMA2 console UI to prevent accidental input.

Sends the Lock command, which disables all physical panel input
until unlocked. Useful during live shows to prevent accidental
key presses.

Returns:
    str: JSON with command_sent and raw_response.
unlock_console_uiB
Unlock the grandMA2 console UI.

Args:
    password: Optional unlock password if the console was locked with one.

Returns:
    str: JSON with command_sent and raw_response.
list_layoutsB
List all Layout pool objects on the grandMA2 console.

Returns the raw console output of the List Layout command,
which shows all defined layout views and their IDs.

Returns:
    str: JSON with command_sent and raw_response.
list_worldsA
List all World pool objects on the grandMA2 console.

Worlds are used to restrict which fixtures a user can control.
Returns the raw console output of the List World command.

Returns:
    str: JSON with command_sent and raw_response.
store_worldA
Create (store) a new World pool object on the grandMA2 console. (DESTRUCTIVE)

Worlds restrict which fixtures a user profile can control. After storing,
use assign_world_to_user_profile to attach the world to a user.

Args:
    world_id: World slot number (1-256)
    name: Optional label applied immediately after store
    overwrite: If True, adds /overwrite flag (replaces existing slot)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with commands_sent and raw_responses.
label_worldB
Label an existing World pool object on the grandMA2 console. (DESTRUCTIVE)

Args:
    world_id: World slot number to label (1-256)
    name: Name to assign to the world
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent and raw_response.
list_timersA
List all Timer pool objects on the grandMA2 console.

Returns the raw console output of the List Timer command,
which shows all defined countdown / count-up timers.

Returns:
    str: JSON with command_sent and raw_response.
list_filtersA
List all Filter pool objects on the grandMA2 console.

Filters restrict which fixture attributes are stored or recalled.
Returns the raw console output of the List Filter command.

Returns:
    str: JSON with command_sent and raw_response.
list_effects_poolA
List all Effect pool objects on the grandMA2 console.

Returns stored effects (not the effect library) from the
Effects pool using the List Effect command.

Returns:
    str: JSON with command_sent and raw_response.
list_imagesA
List all Image pool objects on the grandMA2 console.

Returns the raw console output of the List Image command,
which shows all user-imported images (for gobo media servers, etc.).

Returns:
    str: JSON with command_sent and raw_response.
list_formsA
List all Form pool objects on the grandMA2 console.

Forms define the waveform shapes used by effects. Returns
the raw console output of the List Form command.

Returns:
    str: JSON with command_sent and raw_response.
list_timecode_eventsA
List all Timecode pool objects on the grandMA2 console.

Returns the raw console output of the List Timecode command,
which shows all stored timecode tracks and their slot IDs.

Returns:
    str: JSON with command_sent and raw_response.
list_agenda_eventsA
List all Agenda pool objects on the grandMA2 console.

Agendas are time-triggered events (sunrise/sunset/specific time) that can
fire macros or cues automatically. Returns the raw console output of the
List Agenda command, showing all agenda slots and their IDs.

Returns:
    str: JSON with command_sent and raw_response.
store_agendaA
Create (store) a new Agenda pool object on the grandMA2 console. (DESTRUCTIVE)

Agendas are time-triggered events (clock/sunrise/sunset) that fire macros or
cues automatically. After storing, use the assign tool to attach a macro trigger.

The store command creates the pool slot. To add time triggers to an existing
agenda, use store_timecode_event with object_type="agenda".

Args:
    agenda_id: Agenda slot number (1-256)
    name: Optional label applied immediately after store
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with commands_sent and raw_responses.
control_chaserA
Control a running chaser (rate, speed, skip, crossfade mode).

Actions:
- "rate"    : Set the rate (0-200, 100 = normal). Requires value.
- "speed"   : Set the BPM speed (0-65535). Requires value.
- "skip_fwd": Skip one step forward (SkipPlus).
- "skip_bk" : Skip one step backward (SkipMinus).
- "xfade_a" : Set crossfade mode A (CrossFadeA).
- "xfade_b" : Set crossfade mode B (CrossFadeB).
- "xfade_ab": Set crossfade mode AB (CrossFadeAB).

Args:
    action: One of: rate, speed, skip_fwd, skip_bk, xfade_a, xfade_b, xfade_ab
    value: Required for rate and speed actions.
    executor_id: Target executor ID (optional; uses selected if omitted).
    page: Page number (default 1).

Returns:
    str: JSON with command_sent and raw_response.
set_effect_paramA
Set an effect parameter in the programmer for the current fixture selection.

Valid parameters: bpm, hz, high, low, phase, width, attack, decay.

- bpm / hz   : Effect speed (beats per minute or Hertz)
- high / low : Upper and lower value limits (0-100)
- phase      : Phase offset (0-359 degrees)
- width      : Pulse width (0-100)
- attack     : Attack time (0-100)
- decay      : Decay time (0-100)

Args:
    param: Parameter name (case-insensitive). One of: bpm, hz, high, low,
           phase, width, attack, decay.
    value: Numeric value appropriate for the parameter.

Returns:
    str: JSON with command_sent and raw_response.
call_plugin_toolA
Execute a plugin on the grandMA2 console by ID or name.

Plugins are Lua scripts stored in the Plugin pool. This tool
invokes them using the Plugin keyword.

Args:
    plugin_id: Plugin number (int) or name (str).
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.
run_lua_scriptA
Execute an inline Lua script directly on the grandMA2 console.

Sends the script using the Lua keyword. Useful for one-off
automations without creating a persistent Plugin pool entry.

Args:
    script: Lua source code (e.g. 'print("hello")', 'gma.cmd("Blackout")').
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.
reload_all_pluginsA
Reload all plugins from disk on the grandMA2 console.

Sends ReloadPlugins, which rescans the plugin folder and reloads
all Lua plugin files. Use after editing plugin files on disk.

Args:
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.
control_special_masterA
Set the level of a grandMA2 SpecialMaster (Grand Master, Speed/Rate masters).

Special masters globally control intensity and timing for all playbacks.

Valid master names:
- "grandmaster"     : Grand Master (0-100 %)
- "playbackmaster"  : Playback Master (0-100 %)
- "speed1".."speed16" : Speed Masters (BPM)
- "rate1".."rate16"   : Rate Masters (%)

Args:
    master: Master name (case-insensitive). See valid names above.
    value: Level value appropriate for the master type.

Returns:
    str: JSON with command_sent and raw_response.
rdm_discoverA
Perform RDM device discovery on the grandMA2 console.

Actions:
- "automatch"  : Match discovered RDM devices to existing fixture types (RdmAutomatch).
- "autopatch"  : Auto-patch discovered RDM devices to free DMX addresses (RdmAutopatch).

RDM (Remote Device Management) allows two-way communication with
DMX fixtures that support the RDM protocol.

Args:
    action: "automatch" or "autopatch" (default: "automatch").

Returns:
    str: JSON with command_sent and raw_response.
rdm_get_infoA
Query RDM device information from the grandMA2 console.

- If fixture_id is provided: returns RDM device info for that fixture (RdmInfo Fixture N).
- If universe is provided (and no fixture_id): lists RDM devices on that universe (RdmList Universe N).
- If neither is provided: lists all discovered RDM devices (RdmList).

Args:
    fixture_id: Fixture ID to query (optional).
    universe: Universe number to filter by (optional).

Returns:
    str: JSON with command_sent and raw_response.
rdm_patchA
Patch or unmatch an RDM device on the grandMA2 console.

Actions:
- "setpatch" : Assign the RDM device at fixture_id to a specific DMX address.
               Requires universe and address.
- "unmatch"  : Detach the RDM match for a fixture (RdmUnmatch Fixture N).

Args:
    fixture_id: Fixture ID of the RDM device.
    action: "setpatch" or "unmatch".
    universe: Target universe number (required for setpatch).
    address: Target DMX address 1-512 (required for setpatch).
    confirm_destructive: Must be True to proceed. Defaults to False (blocked).

Returns:
    str: JSON with command_sent and raw_response.
batch_labelA
Label multiple objects in a single call (DESTRUCTIVE).

Instead of calling label_or_appearance once per object, batch_label applies
names to an entire list. Accepts a JSON array of {id, name} pairs.

Args:
    object_type: Object type (e.g. "group", "sequence", "macro", "preset")
    items: JSON array string, e.g. '[{"id": 1, "name": "Front Wash"}, {"id": 2, "name": "Back Light"}]'
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation)

Returns:
    str: JSON with labels_applied, commands, errors, risk_tier.

Examples:
    - Label groups 1-3: object_type="group", items='[{"id":1,"name":"Front"},{"id":2,"name":"Back"},{"id":3,"name":"Side"}]'
bulk_executor_assignA
Assign a sequence to an executor and configure it in one call (DESTRUCTIVE).

Combines assign + optional trigger/priority/fader/label into a single
operation instead of 4-5 separate tool calls.

Args:
    executor_id: Executor number to assign to.
    sequence_id: Sequence number to assign.
    executor_page: Executor page (default 1).
    trigger: Optional trigger type (e.g. "go", "flash", "toggle").
    priority: Optional priority level (e.g. "normal", "high", "super", "htp").
    fader_function: Optional fader function (e.g. "master", "crossfade", "speed").
    label: Optional label for the executor.
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with commands_sent, raw_responses, risk_tier.

Examples:
    - Assign seq 1 to exec 101: executor_id=101, sequence_id=1
    - Full setup: executor_id=101, sequence_id=1, trigger="go", priority="high", label="Main Wash"
auto_number_cuesA
Renumber all cues in a sequence with configurable start and spacing (DESTRUCTIVE).

Lists existing cues, then moves each to its new number. Useful for cleaning
up cue lists with irregular numbering (e.g. 1, 1.5, 3, 7 → 1, 2, 3, 4).

Args:
    sequence_id: Sequence to renumber.
    start: Starting cue number (default 1.0).
    spacing: Increment between cues (default 1.0).
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with cues_renumbered, old_to_new mapping, commands.

Examples:
    - Standard: sequence_id=1 → cues become 1, 2, 3, ...
    - By tens: sequence_id=1, start=10, spacing=10 → 10, 20, 30, ...
compare_cue_valuesA
Compare two cues in a sequence and show differences (SAFE_READ).

Lists both cues and diffs the raw console output to help identify
what changes between them. Useful for tracking analysis and cue cleanup.

Args:
    sequence_id: Sequence containing both cues.
    cue_a: First cue number.
    cue_b: Second cue number.

Returns:
    str: JSON with cue_a, cue_b, raw outputs, and line-by-line differences.
diagnose_no_outputA
Diagnostic tree for fixtures not producing output (SAFE_READ).

Runs a series of non-destructive checks to identify why fixtures
may not be responding: Grand Master level, blackout state, park status,
patch, executor state. Returns structured findings.

Args:
    fixture_id: Optional specific fixture to check.
    universe: Optional DMX universe to check.

Returns:
    str: JSON with checks list, each having check name, status (ok/warning/fail), detail.
list_fixturesA
List fixtures defined on the console, or check a specific fixture exists.

This is the correct way to discover fixture IDs before using park_fixture,
unpark_fixture, set_intensity, or set_attribute. Note: 'cd Fixture' is NOT
a valid MA2 navigation destination — this tool uses 'list fixture' instead.

Args:
    fixture_id: Optional fixture ID to inspect. If None, lists all fixtures.

Returns:
    str: JSON with command_sent, raw_response, exists (bool), fixture_id.
         exists is always True when fixture_id is None (listing all).

Examples:
    - List all fixtures: list_fixtures()
    - Check fixture 20: list_fixtures(fixture_id=20)
    - Check fixture 1 (likely missing): list_fixtures(fixture_id=1)
list_sequence_cuesA
List cues in a sequence, or check whether a specific cue exists.

Supports two ways to identify the sequence:
  - sequence_id: Direct sequence number (e.g. 278)
  - executor_id: Executor number — sequence is resolved via
    'list executor PAGE.ID' before listing cues

If both are supplied, sequence_id takes precedence.

Validated MA2 probes used:
  'list cue sequence N'     → all cues in sequence N
  'list cue M sequence N'   → specific cue M in sequence N
  'list executor P.E'       → resolve sequence from executor

Args:
    sequence_id: Sequence number to inspect.
    executor_id: Executor number — resolved to its linked sequence.
    executor_page: Executor page for resolution (default 1).
    cue_id: Optional specific cue to check for existence.

Returns:
    str: JSON with command_sent, raw_response, exists, resolved_sequence_id,
         and executor_probe_response (when executor_id was used).

Examples:
    - All cues in seq 278: list_sequence_cues(sequence_id=278)
    - Cue 5 in seq 278: list_sequence_cues(sequence_id=278, cue_id=5)
    - Cues for executor 1: list_sequence_cues(executor_id=1)
    - Check cue 99 on executor 1: list_sequence_cues(executor_id=1, cue_id=99)
check_pool_availabilityA
Check which slots are occupied and free in an object pool (SAFE_READ).

Navigates to the pool, lists all entries, and computes a full
availability map: occupied slots (with names), free ranges,
next 10 free slots, and contiguous-block analysis.

Use this **before importing XML** to verify target slots are free,
or to find the best slot range for bulk imports (filters, MAtricks).

Valid pool types (case-insensitive):
  Group, Sequence, Preset, Macro, Effect, Gel, World, Filter,
  Form, Timer, Layout, Timecode, Agenda, UserProfile, Camera,
  MAtricks, View, Remote

Numeric cd indexes also accepted (e.g. "13" for Macros, "19" for Filters).

Args:
    pool_type: Pool keyword or numeric cd index.
    start_from: First slot number to check (default 1).
    scan_up_to: Last slot number to check (default 200).
    needed_slots: If set, checks whether N contiguous free slots
        exist and returns can_fit + suggested_start.

Returns:
    str: JSON with occupied_slots, free_ranges, next_free_slots,
         total_occupied, total_free_in_range, largest_contiguous,
         can_fit, suggested_start, risk_tier.
discover_object_namesA
Navigate to an object pool and return all object names for wildcard pattern building.

This is the first step in the discover-names → derive-pattern → wildcard-command
workflow.  The returned names can be used directly with list_objects(),
info(), label(), etc. by passing them as the ``name`` argument with
``match_mode="literal"`` (exact match) or deriving a ``*``-pattern and
using ``match_mode="wildcard"``.

CD scope covered
----------------
Any destination accepted by navigate_console() works here:
  - Keyword form:      "Group", "Sequence", "Preset", "Macro", "Effect", …
  - Numeric index:     "22" (Groups), "25" (Sequences), "17" (Presets), …
  - Dot-notation:      "10.3" (LiveSetup/FixtureTypes)

Object pool destinations (cd 1–42 that have named user objects):
  Group=22, Sequence=25, Preset=17, Macro=13, Effect=24, Gel=16, World=18,
  Filter=19, Form=23, Timer=26, Layout=38, Timecode=35, Agenda=34,
  UserProfile=39, Remote=36.

System-config branches (cd 1=Showfile, cd 2=TimeConfig, cd 3=Settings,
cd 4=DMX_Protocols, …) hold property nodes, not named user objects — they
return empty names and are not useful for wildcard matching.

After this call the console is left at root (cd /).

Args:
    destination: Object pool to inspect.  Any format accepted by
        navigate_console: keyword ("Group"), numeric index ("22"),
        or dot path ("10.3").

Returns:
    str: JSON with destination, entries (id + name), names_only list,
         and a wildcard_tip suggesting how to build a pattern.

Example workflow::

    discover_object_names("Group")
    # → names: ["Mac700 Front", "Mac700 Back", "Wash", "ALL LASERS"]

    # Derive prefix pattern and use with list_objects:
    # list_objects("group", name="Mac700*", match_mode="wildcard")
    # → "list group Mac700*"
detect_console_divergenceA
Diff current console state against the recorded baseline (SAFE_READ).

Detects changes made outside this MCP session — a different show loaded,
user/page changes on the physical desk, pool objects added or deleted
(groups, sequences, macros, worlds, filters). Complements the tracked
snapshot for the write-only dimensions (MAtricks, park, filter VTE) that
have no telnet readback: when the pools or vars moved, assume those
write-trackers are stale too.

Call snapshot_console_baseline first; this tool errors without one.

Returns:
    str: JSON with diverged (bool), changed_vars, pool_changes
    (added/removed IDs per pool), baseline_age_seconds, risk_tier.
suggest_skills_for_taskA

Suggest skills from .claude/skills/ for a natural-language intent (SAFE_READ).

Args:
    intent: What you want to do, e.g. "make me a color picker".
    top_k: Max number of suggestions to return.
    include_destructive: When False, drop un-approved DESTRUCTIVE skills.
    prefer_semantic: When True, attempt embedding-based ranking when a
        ``GITHUB_MODELS_TOKEN`` env var is set. Path A ships keyword only;
        this flag controls the warning message rather than the algorithm.

Returns:
    JSON-encoded SuggestSkillsResponse: ``{intent, method, warning, suggestions}``.
discover_consolesA

Discover grandMA2 consoles via UDP broadcast (SAFE_READ).

Path A scope: broadcast only. mDNS path requires the optional
``[mdns]`` install (zeroconf) and is documented for Path B.

Args:
    timeout_seconds: Listen window after the probe is sent.
    network: Optional CIDR to constrain the broadcast (e.g. "192.168.1.0/24").
        None auto-detects local interfaces.
    methods: List of methods to attempt — subset of {"broadcast", "mdns"}.
        Default: ["broadcast"].

Returns:
    JSON envelope: ``{candidates, scanned_networks, elapsed_ms, note}``.
build_show_from_patchA

Build an expert-grade show scaffold from the current patch.

Strategies (per spec §B.1): ``rock-band`` | ``festival`` | ``theatrical``
| ``dj`` | ``broadcast`` | ``corporate``.

Defaults to ``dry_run=True``; mutation requires ``confirm_destructive=True``.
The plan is deterministic for a given (strategy, patch, options) triple,
and every step is run through ``expert_lint(domain="show")`` before return.

Args:
    strategy: One of the six strategies above.
    options: Optional ``ShowBuildOptions`` dict — overrides strategy defaults
        (e.g. ``{"songs": 14}``).
    dry_run: When True, build the plan but do not send any commands.
    confirm_destructive: Required for ``dry_run=False``. The plan is
        destructive — it creates groups, presets, cues, executors, worlds.

Returns:
    JSON envelope: ``{strategy, plan, rationale, expert_review, summary,
    dry_run, executed_steps, blocked}``.
architect_preset_libraryA

Architect a complete preset library against the current patch.

Strategies (per spec §C.4):
  - ``full-coverage`` — universal color (8 hues + warm/cool wash) + position
    + selective gobo/beam/focus/control + MIB for movers
  - ``minimal-viable`` — 4 cardinal hues only, no position/selective
  - ``color-first`` — 12-hue wheel + warm/cool + minimal position

Args:
    patch_filter: MA2 selection spec to constrain — None scans whole patch.
        (Path A note: filter wired through patch_reader's existing scope.)
    strategy: One of ``full-coverage`` | ``minimal-viable`` | ``color-first``.
    dry_run: When True, build the plan but don't send any commands.
    confirm_destructive: Required for ``dry_run=False``.

Returns:
    JSON envelope: ``{strategy, reference_fixtures, plan, coverage_report,
    naming_convention, expert_review, summary, dry_run, executed_steps, blocked}``.
build_layout_for_screenA

Build (and optionally apply) a layout for one of the MA2 screens.

Either ``template`` or ``content`` must be supplied (not both).

Templates (per spec §B.2): ``busking-master`` | ``preset-access`` |
``executor-monitor`` | ``macro-page`` | ``programmer-view`` |
``troubleshoot-view``.

Args:
    screen: Target screen number (1-5 on a full console; 1 on onPC).
    content: Optional list of ContentSpec cells (mutually exclusive with template).
    template: Optional template name (mutually exclusive with content).
    dry_run: When True, build the plan but don't send any commands.
    confirm_destructive: Required for ``dry_run=False`` (layout writes overwrite
        screen content).

Returns:
    JSON envelope: ``{screen, template, plan, content, preview_ascii,
    expert_review, summary, dry_run, executed_steps, blocked}``.
check_plugin_availableA

Check whether a plugin is loaded in the console plugin pool (SAFE_READ).

Used by skills (notably ``auto-layout-color-picker``) to decide whether to
invoke the plugin path or fall back to manual workflows.

Args:
    plugin_name: Human-readable plugin name (e.g. ``"EcubeColorPicker"``).
    use_cache: When True, reuse cached inventory if fresh.
    cache_ttl_seconds: How long a cached inventory stays fresh.

Returns:
    JSON envelope: ``{plugin_name, available, pool_id, match,
    last_checked_at, source}``.
generate_ma2_macroA

Generate an MA2 macro from natural-language intent (SAFE_READ when store=False).

Returns ``body_xml`` + lint + expert review. When ``store=True``, the tool
requires ``confirm_destructive=True`` AND ``pool_id``; in Path A the store
branch returns blocked / deferred-to-Path-B rather than mutating the pool.

Args:
    intent: Plain-English description of the macro to build.
    scope_hints: Optional dict of routing hints, e.g. ``{"executor": "1.1.1"}``.
    store: When True, store the generated macro to the macro pool.
    pool_id: Target pool slot (required if ``store=True``).
    confirm_destructive: Required if ``store=True`` (the store path is destructive).

Returns:
    JSON envelope:
    ``{intent, body_xml, line_count, validation, lint, expert_review,
    stored_as, blocked}``.
import_fixture_typeA
Import a fixture type from the MA2 library into the show (DESTRUCTIVE).

Navigates to EditSetup/FixtureTypes context, imports the fixture type
by 'manufacturer@fixture@mode' key, then returns to root context.

Use list_library(library_type="fixture") first to find the exact key values.

Args:
    manufacturer: Manufacturer name exactly as in MA2 library (e.g. "Martin", "Generic")
    fixture: Fixture model name (e.g. "Mac700Profile_Extended")
    mode: Mode name (e.g. "Extended", "Standard")
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with steps list (command + response per step), fixture_key, risk_tier
import_fixture_layerA
Import a fixture layer XML file into the show patch (DESTRUCTIVE).

Navigates to EditSetup/Layers context, imports the XML layer file,
then returns to root context. Use generate_fixture_layer_xml to
create the XML file before calling this tool.

The file must exist in the MA2 importexport directory:
  C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\importexport\

Args:
    filename: Layer XML filename without extension or path
    layer_index: Target layer slot. None = MA2 picks next free slot
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with steps list (command + response per step), filename, risk_tier
generate_fixture_layer_xmlA
Generate a grandMA2 fixture layer XML file and save it to the importexport directory (DESTRUCTIVE).

The output file can be imported immediately using import_fixture_layer.
No telnet connection required — this tool writes a local file only.

Output directory:
  C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\importexport\

Each fixture dict must contain:
    fixture_id (int): grandMA2 fixture ID (e.g. 111)
    name (str): Display name (e.g. "Dim 1" or "Mac 700 1")
    fixture_type_no (int): Fixture type number from list_fixture_types()
    fixture_type_name (str): Display name of the fixture type
    dmx_address (int): 1-based DMX start address within its universe
    num_channels (int): Total DMX channel count for this fixture type

Args:
    filename: Output filename without extension
    layer_name: Layer display name shown in MA2 UI
    layer_index: Layer index number (1-based) for the <Layer> XML element
    fixtures: List of fixture parameter dicts (see schema above)
    showfile: Show name embedded in XML <Info> element
    overwrite: If True, overwrite existing file; if False, return error on conflict
    confirm_destructive: Must be True to execute (writes files to console importexport directory)

Returns:
    str: JSON with file_path, filename, fixture_count, layer_index, layer_name
analyze_patch_typesA
Build a fixture-type model of the current patch (SAFE_READ).

Groups patched fixtures by fixture type, classifies each type into a
category (wash/mover/bar/strobe/blinder/conventional/other), and resolves
attribute capabilities (dimmer/position/gobo/color_mix/beam/focus/control)
either from live EditSetup attribute discovery or a curated fallback table.

This is the foundation for verify_fixture_id_blocks,
select_fixtures_by_type_order, run_preset_plugin, and
create_presets_for_patch.

Args:
    discover_attributes: When True, read each fixture type's ChannelType
        rows from the console (slower — several cd/list round-trips per
        type). When False, use the curated fallback capability table.

Returns:
    str: JSON with types (capabilities, category, members), categories,
    unmatched_fixtures, fixture_count, risk_tier.
verify_fixture_id_blocksA
Verify fixture IDs against the 100-block numbering scheme (SAFE_READ).

Scheme: 1-99 wash, 100-199 movers, 200-299 bars, 300-399 strobes,
400-499 blinders. Reports per-category compliance, out-of-block fixtures,
ID collisions, and a proposed renumbering plan (old_id -> new_id into the
lowest free slot of the correct block).

Preset/color-picker plugins depend on clean type blocks — run this before
run_preset_plugin or plugin-driven preset creation.

Args:
    discover_attributes: Passed through to the patch-model build.

Returns:
    str: JSON report with categories, out_of_block, collisions,
    renumber_plan, proposed_commands, compliant, risk_tier.
renumber_fixturesA
Plan renumbering of out-of-block fixtures into their category's 100-block (PLAN-ONLY).

Re-reads the patch fresh (never acts on a stale model) and computes the
renumbering plan from verify_fixture_id_blocks. This tool NEVER executes:
fixture IDs cannot be changed over telnet — live-verified 2026-07-17
(v3.9.60.50): ``Assign Fixture <old> /fixid=<new>`` and every
property-assign variant (FixId/ChaId at root, in the EditSetup and
LiveSetup layer contexts, and via ``Move``) return Error #66 CANNOT
ASSIGN, while sibling properties like ``/name=`` apply fine — the FixId
column is console-side read-only. Renumbering must be done by the
operator in Setup → Patch & Fixture Schedule; the returned ``commands``
are manual dialog steps.

Args:
    dry_run: Retained for API compatibility; every call is a dry run.
    confirm_destructive: Retained for API compatibility; execution is
        never possible, so this flag has no effect.

Returns:
    str: JSON with renumber_plan, commands (manual operator steps),
    executed (always 0), plan_only, blocked, risk_tier.
select_fixtures_by_type_orderA
Build (and optionally execute) a type-ordered fixture selection (SAFE_WRITE).

Emits one additive ``Fixture <ranges>`` command per fixture type, in
canonical category order (wash, mover, bar, strobe, blinder,
conventional, other) or a custom order — so the console's selection
order matches fixture-type order, which is what preset/color-picker
plugins require at runtime. Works even when ID blocks are dirty.

Args:
    order: Optional custom category order (subset of the canonical list).
    execute: When True, send the commands to the console; when False
        (default) return them for embedding in a macro or workflow.
    clear_first: Prepend ClearAll so selection order is deterministic.

Returns:
    str: JSON with commands, executed, selection_order (types in emission
    order), risk_tier.
run_preset_pluginA
Orchestrate a preset/color-picker plugin run end-to-end (DESTRUCTIVE).

Pipeline: (1) resolve the plugin in the pool; (2) verify preconditions
from its manifest — required groups exist, declared pool ranges are free;
(3) build the type-ordered fixture selection the plugin expects;
(4) run the plugin; (5) diff the output pools and report what was created.

Manifests for known plugins ship in src/plugin_manifests.py (e.g.
"auto-layout-color-picker"); pass manifest_overrides to adjust pool
ranges or required groups per show, or to describe an unknown plugin.

Args:
    plugin_name: Plugin pool name or builtin manifest key.
    manifest_overrides: Optional dict overriding manifest fields
        (pool_ranges, required_groups, selection, outputs).
    dry_run: When True (default) run only phases 1-3 and report the plan.
    confirm_destructive: Must be True to execute with dry_run=False.

Returns:
    str: JSON with plugin, preconditions, selection_commands, executed,
    outputs_created (per pool diff), blocked, risk_tier.
create_presets_for_patchA
Create presets natively from the patch, capability-aware (DESTRUCTIVE).

Combines the preset-library architect plan (architect_preset_library)
with the fixture-type model: each preset entry is only applied to
fixtures whose type actually has the required capability (color presets
to color-mixing fixtures, position to movers, etc.).

Entries with concrete values (the cardinal color presets) are stored
directly: selection of capable fixtures -> attribute values -> Store
Preset. Entries declared without concrete values (position, gobo, MIB —
which need operator-set reference values) are returned as ``declared``
for manual completion, matching the declared-vs-stored calibration.

Args:
    strategy: full-coverage | minimal-viable | color-first.
    dry_run: When True (default), return the command plan without executing.
    confirm_destructive: Must be True to execute with dry_run=False.

Returns:
    str: JSON with stored_plan (per-preset command lists), declared_only,
    skipped (no capable fixtures), executed_presets, blocked, risk_tier.
export_objectsA
Export objects from the show file to disk (DESTRUCTIVE — writes files).

Files are written to the grandMA2 data directory. MA2 routes each type
to its own subfolder automatically:
  - Macro → macros/    Effect → effects/    Plugin → plugins/
  - MAtricks → matricks/    Mask → masks/
  - All others → importexport/

On this system: C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\

Supported object types (19 validated):
  group, preset, macro, effect, sequence, view, page, camera, layout,
  form, plugin, matricks, mask, image, executor, timecode, userprofile,
  channel, screen

Preset syntax for object_id:
  - Single preset:  "1.3"  (type 1=Dimmer, 2=Position, 3=Gobo, 4=Color,
                             5=Beam, 6=Focus, 7=Control, 8=Shapers, 9=Video)
  - All of a type:  "1"    (exports all dimmer presets)
  - Range:          "1 thru 5"

Args:
    object_type: Object type (case-insensitive)
    object_id: ID, preset ref ("1.3"), range ("1 thru 5"), or name (UserProfile)
    filename: Output filename — no extension, no path needed
    style: "csv" or "html" — default is xml
    overwrite: Replace existing file without prompting
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier, data_path
import_objectsA
Import objects from a file into the show (DESTRUCTIVE — modifies show file).

MA2 locates the file using the destination type to determine the correct
subfolder automatically (same routing as export). The file must exist in
the grandMA2 data directory before calling this tool.

Files are read from: C:\ProgramData\MA Lighting Technologies\grandma\gma2_V_3.9.60\
  - Macro → macros/    Effect → effects/    Plugin → plugins/
  - MAtricks → matricks/    Mask → masks/
  - All others → importexport/

Supported destination types (17 validated):
  group, preset, macro, effect, sequence, view, page, camera, layout,
  form, plugin, matricks, mask, image, executor, timecode, userprofile

(Screen is export-only — import gives RESIZE FORBIDDEN error.)

Preset destination_id format: "T.N"  e.g. "1.99" = Dimmer slot 99

Args:
    filename: Source filename — no extension, no path needed
    destination_type: Object type for placement (REQUIRED — MA2 Error #28 without it)
    destination_id: Slot number or preset ref ("T.N"). None = next free slot.
    quiet: Suppress MA2 feedback output during import
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier
generate_companion_configA
Generate a Bitfocus Companion .companionconfig page from the current MA2 executor layout (SAFE_READ).

Reads the executor page and builds a Companion-importable JSON config
with one button per assigned executor. Each button sends the appropriate
Go+ command via Companion's grandMA2 telnet module.

The output is a JSON string in Companion v4 page-export format. Save it
to a .companionconfig file and import via Companion UI → Buttons → Import.

Args:
    page: MA2 executor page to export (default 1).
    companion_page: Target Companion page number (default 1).
    grid_columns: Companion grid width — 8 for Stream Deck XL, 5 for Stream Deck (default 8).

Returns:
    str: JSON with companion_config (the importable config), executor_count, and instructions.

Examples:
    - Export page 1: generate_companion_config()
    - Export page 2 for Stream Deck: generate_companion_config(page=2, grid_columns=5)
companion_button_pressA
Press a button on a running Bitfocus Companion instance via HTTP API (SAFE_WRITE).

Sends a GET request to Companion's REST API to trigger a button press.
Companion must be running and accessible at the specified host/port.

Args:
    page: Companion page number (1-based).
    button: Button index on the page (0-based).
    host: Companion host (default "localhost").
    port: Companion HTTP API port (default 8000).

Returns:
    str: JSON with status, url_called, response text.

Examples:
    - Press button 0 on page 1: companion_button_press(page=1, button=0)
    - Remote Companion: companion_button_press(page=1, button=3, host="192.168.1.50")
set_bpmA
Set the BPM on a grandMA2 Speed Master (SAFE_WRITE).

Designed for live BPM sync from external sources like ShowKontrol,
Beat Link Trigger, Ableton, or any system that provides real-time BPM.
Sends the SpecialMaster command to the console via Telnet.

The BPM value directly controls effect speed for any executor assigned
to this speed master. Common workflow: ShowKontrol reads CDJ BPM →
calls this tool → MA2 effects follow the DJ's tempo in real time.

Args:
    bpm: Beats per minute (1-300). Fractional values supported (e.g. 128.5).
    speed_master: Which speed master to control (1-16, default 1).

Returns:
    str: JSON with command_sent, raw_response, bpm, speed_master.

Examples:
    - Set 128 BPM on speed master 1: set_bpm(bpm=128)
    - Set 140 BPM on speed master 3: set_bpm(bpm=140, speed_master=3)
send_oscA
Send an OSC message to an external application like Resolume Arena (SAFE_WRITE).

Uses raw UDP — no extra dependencies. Works with any OSC-compatible software:
Resolume Arena/Avenue, QLab, TouchDesigner, Ableton, etc.

Common Resolume OSC addresses:
  /composition/tempocontroller/tempo  — set BPM (float)
  /composition/layers/N/clips/M/connect — trigger clip (int 1)
  /composition/layers/N/video/opacity — layer opacity (float 0.0-1.0)
  /composition/disconnectall — clear all clips (int 1)

Args:
    address: OSC address pattern (e.g. "/composition/tempocontroller/tempo").
    value: Value to send — float, int, or string.
    host: Target host (default "localhost").
    port: Target OSC port (default 7000, Resolume's default).

Returns:
    str: JSON with address, value, host, port, status.

Examples:
    - Set Resolume BPM: send_osc(address="/composition/tempocontroller/tempo", value=128.0)
    - Trigger clip: send_osc(address="/composition/layers/1/clips/1/connect", value=1)
    - Layer opacity: send_osc(address="/composition/layers/1/video/opacity", value=0.75)
detect_dmx_address_conflictsA
Scan the patch for DMX address conflicts — fixtures sharing overlapping channel ranges.

Queries list_universes and list_fixtures to build a channel-occupancy map,
then reports any fixtures whose DMX footprint overlaps with another fixture on
the same universe. Safe to run before any patching operation or during a show
health check.

Args:
    universe_id: Check only this universe (1-based). If None, checks all universes.

Returns JSON with:
- conflicts: list of {universe, fixture_a, fixture_b, overlap_channels}
- clean_universes: list of universe IDs with no conflicts
- total_fixtures_checked: int
update_objectA
Update any object with current programmer values (DESTRUCTIVE).

Generic update tool that works with all 16 object types.
For cue-specific updates with sequence scoping, prefer update_cue_data.

Args:
    object_type: Object type — cue, group, preset, sequence, effect, macro, etc.
    object_id: Object ID (optional; updates active if omitted for cue)
    sequence_id: Sequence ID for cue-scoped updates (only used when object_type="cue")
    merge: Merge programmer into existing values
    overwrite: Overwrite existing values with programmer
    cueonly: Prevent changes from tracking forward (True) or allow (False)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON with command_sent, raw_response, risk_tier
programming_actionA
Execute programmer operations — align, locate, flip, extract, learn,
block/unblock cue, record macro, store look.

Args:
    action: One of:
        SAFE_WRITE: "align", "locate", "flip", "extract", "learn"
        DESTRUCTIVE: "block", "unblock", "record_macro", "store_look"
    fixture_ids: Fixture number(s) for locate (single int or list)
    end: Ending number for locate range
    cue_id: Cue number for block/unblock
    sequence_id: Sequence ID for block/unblock scoping
    macro_id: Macro pool slot for record_macro
    executor_id: Executor ID for learn
    page: Page for learn page-qualified addressing
    look_id: Look pool slot for store_look
    mode: Alignment mode for align (">" "><" "<>" "<")
    merge: Merge option for store_look
    overwrite: Overwrite option for store_look
    confirm_destructive: Required for block/unblock/record_macro/store_look

Returns:
    str: JSON with command_sent, raw_response, risk_tier
master_controlB
Control master faders — set level, set special master, or list all masters.

Args:
    action: "set" (SAFE_WRITE), "set_special" (SAFE_WRITE), or "list" (SAFE_READ)
    master_id: Master pool slot number (required for set / set_special)
    master_type: Special master type number (required for set_special)
    level: Level 0-100 (required for set / set_special)

Returns:
    str: JSON with command_sent, raw_response, risk_tier
system_adminA
System administration — login, logout, lock, unlock, lua, chat,
reboot, restart, shutdown.

Args:
    action: One of:
        SAFE_READ: "logout"
        SAFE_WRITE: "login", "lock", "unlock", "chat"
        DESTRUCTIVE: "lua", "reboot", "restart", "shutdown"
    user: Username (required for login)
    password: Password (required for login; optional for lock/unlock)
    script: Lua script string (required for lua)
    message: Chat message text (required for chat)
    confirm_destructive: Must be True for lua/reboot/restart/shutdown

Returns:
    str: JSON with command_sent, raw_response, risk_tier
plugin_managementA
Manage Lua plugins — list available plugins or reload the plugin pool.

Args:
    action: "list" (SAFE_READ) or "reload" (SAFE_WRITE)

Returns:
    str: JSON with command_sent, raw_response, risk_tier
get_telemetry_reportA
Export tool invocation telemetry as a structured audit report.

Queries the tool_invocations table filtered by session, date range, and/or
risk tier. Returns a structured log suitable for SB 132 compliance reports,
insurance documentation, and safety audits.

Args:
    session_id: Filter to a specific session ID (from list_agent_sessions).
                If None, includes all sessions in the date range.
    days: Number of past days to include (default 1 = today only).
    risk_tier: Filter to "SAFE_READ", "SAFE_WRITE", or "DESTRUCTIVE" only.
               If None, includes all tiers.
    format: "json" (default) or "markdown" for human-readable report.

Returns structured report with:
- header: session info, date range, operator
- risk_summary: counts per tier
- destructive_log: full detail on every DESTRUCTIVE operation
- error_log: any operations that returned errors
- timeline: ordered list of all operations
generate_compliance_reportA
Generate a SB 132 / safety-audit compliance report from session telemetry.

Produces a structured report mapping MA2 Agent telemetry fields to
SB 132 documentation requirements: written risk assessment, operator
identification, DESTRUCTIVE operation log, and incident timeline.

Safe to run during any production. Reads telemetry only — no console side effects.

Args:
    session_id: Target session ID. If None, uses all sessions in date range.
    production_name: Name of production for report header.
    operator_name: Console operator name for report header.
    days: Days of telemetry to include (default 1).

Returns a markdown compliance report ready for inclusion in safety documentation.
validate_preset_referencesA
Scan a sequence's cues for references to presets that no longer exist in the pool.

Samples up to `sample_cues` cues from the sequence, inspects each for preset
references, and cross-checks against the current preset pool. Returns a list
of broken references that would cause silent failures during playback.

Safe to run before any performance. Read-only — no console side effects.

Args:
    sequence_id: The sequence to validate.
    sample_cues: Number of cues to sample (default 5). Use 0 for all cues.

Returns JSON with:
- sequence_id: int
- cues_checked: int
- broken_references: list of {cue_id, preset_type, preset_id, detail}
- valid_references: int count
- status: "PASS" or "FAIL"
list_macro_jump_targetsA
Parse a macro's lines and return all jump targets (Go Macro N."name".L references).

Reads macro lines via the console command tree and identifies all jump
instructions, their current target line numbers, and the total line count.
Use this before inserting or deleting macro lines to build an index-shift table.

Args:
    macro_id: The macro pool ID to inspect.

Returns JSON with:
- macro_id: int
- total_lines: int
- jump_targets: list of {source_line, target_line, raw_command}
- line_listing: ordered list of {line_num, command}
check_pool_slot_availabilityA
Check which pool slots are available (empty) and which are occupied in a range.

Pre-flight check before bulk import, PSR, or mass preset creation to prevent
silent overwrites. Safe to run at any time — read-only.

Args:
    pool_type: "sequence", "preset", "group", "macro", "effect", "world",
               "filter", "view", "layout", "timecode"
    slot_range_start: First slot ID to check (inclusive).
    slot_range_end: Last slot ID to check (inclusive).

Returns JSON with:
- pool_type: str
- range: [start, end]
- occupied: list of {slot_id, label} for occupied slots
- available: list of slot_ids that are empty
- first_available_block_of_10: smallest contiguous block of 10 empty slots
remap_fixture_idsA
Remap fixture references from one fixture ID to another within groups or presets.

Used after PSR import or cross-venue adaptation when imported cue data references
fixture IDs that have changed in the current rig. Updates group membership and/or
selective preset fixture references.

DESTRUCTIVE — modifies show data. Use check_pool_slot_availability and
list_fixtures first to confirm both fixture IDs exist in the current patch.

Args:
    source_fixture_id: The old fixture ID to replace.
    target_fixture_id: The new fixture ID to use.
    scope: "groups" (update group membership only), "presets" (update selective
           preset references only), or "both".
    confirm_destructive: Must be True to execute.

Returns JSON with:
- remapped_objects: list of modified pool objects
- skipped: list of objects where source_fixture_id was not found
- command_log: commands sent to console
browse_patch_scheduleA
Browse the fixture patch schedule from LiveSetup.

If fixture_type_id is provided, drills into that specific fixture type
to show its instances (fixtures, DMX addresses, channels).

Args:
    fixture_type_id: Fixture type index to drill into (optional).
                     Omit to see all fixture types.

Returns:
    str: JSON with raw_response, entries, risk_tier.
patch_fixtureA
Patch a fixture to a DMX address (DESTRUCTIVE — modifies the patch).

Assigns a DMX address to a fixture. Optionally assigns a fixture type first.

MA2 syntax:
  assign dmx [universe].[address] at fixture [fixture_id]
  assign fixture_type [type_id] at fixture [fixture_id]  (if fixture_type_id given)

Args:
    fixture_id: Fixture ID to patch.
    dmx_universe: DMX universe number (1-256).
    dmx_address: DMX address within universe (1-512).
    fixture_type_id: Fixture type to assign (optional).
    channel_id: Channel ID to assign (optional).
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with commands_sent, raw_responses, risk_tier.
unpatch_fixtureA
Unpatch a fixture (remove its DMX assignment) (DESTRUCTIVE).

MA2 syntax: delete fixture [fixture_id]
This removes the DMX assignment but does not delete the fixture from the show.

Args:
    fixture_id: Fixture ID to unpatch.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
set_fixture_type_propertyA
Set a property on a fixture type in LiveSetup (DESTRUCTIVE).

Navigates to LiveSetup/FixtureTypes/[N] and assigns a property value.
Path: cd 10 -> cd 3 -> assign [fixture_type_id]/property=value -> cd /

Args:
    fixture_type_id: Fixture type index (1-based).
    property_name: Property to set (e.g. "Mode", "Name").
    value: New value for the property.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with commands_sent, success, risk_tier.
highlight_fixturesA
Toggle highlight mode for the currently selected fixtures.

Highlight mode temporarily sets selected fixtures to full intensity to help
identify them on stage. Easily reversible (toggle off).

Args:
    on: True to enable, False to disable highlight mode.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
release_executorC
Release an executor, returning it to its default state.

Args:
    executor_id: Executor ID (1-999).
    page: Page number for page-qualified addressing (optional).

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
blackout_toggleA
Toggle master blackout (kills all lighting output).

Blackout is a toggle — call once to enable, again to disable.
SAFE_WRITE because it is easily reversible.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
list_showsB
List available show files on the console.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
load_showA
Load an existing show file (DESTRUCTIVE — replaces current show).

Args:
    name: Show file name to load.
    confirm_destructive: Must be True to proceed.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
new_showA
Create a new empty show (DESTRUCTIVE — replaces current show).

CONNECTIVITY WARNING
--------------------
Creating a new show clears Global Settings, which **disables Telnet login**
and severs the MCP connection.  ``preserve_connectivity=True`` (the default)
automatically adds /globalsettings + /network + /protocols so Telnet stays
enabled and network/DMX config is preserved.

Set ``preserve_connectivity=False`` only if you intend to manually
re-enable Telnet on the console afterwards (Setup → Console → Global
Settings → Telnet → Login Enabled).

Keep flags (correspond to un-checking "Clear …" in the MA2 New Show dialog):

| Flag               | Dialog checkbox          | MA2 flag        | Included by preserve_connectivity |
|--------------------|--------------------------|-----------------|-----------------------------------|
| keep_globalsettings| Clear Global Settings    | /globalsettings | YES — contains Telnet login       |
| keep_network       | Clear Network Config     | /network        | YES — IP / MA-Net2 config         |
| keep_protocols     | Clear Network Protocols  | /protocols      | YES — Art-Net, sACN, etc.         |
| keep_timeconfig    | Clear Time Config        | /timeconfig     | no                                |
| keep_localsettings | Clear Local Settings     | /localsettings  | no                                |
| keep_user          | Clear User Profiles      | /user           | no                                |

Args:
    name: New show file name.
    confirm_destructive: Must be True to proceed.
    preserve_connectivity: Auto-add /globalsettings + /network + /protocols
        to prevent Telnet being disabled (default True).
    keep_timeconfig: Preserve Time Config from current show.
    keep_globalsettings: Preserve Global Settings (overrides preserve_connectivity).
    keep_localsettings: Preserve Local Settings from current show.
    keep_protocols: Preserve Network Protocol settings (overrides preserve_connectivity).
    keep_network: Preserve Network Config (overrides preserve_connectivity).
    keep_user: Preserve User Profiles from current show.

Returns:
    str: JSON with command_sent, raw_response, risk_tier,
         and connectivity_flags listing which flags were applied.

AI assistant guidance
---------------------
Always confirm ``preserve_connectivity=True`` unless the user explicitly
wants a completely clean show AND understands Telnet will be disabled.
Ask about keep_timeconfig, keep_localsettings, keep_user separately —
these have no connectivity impact and are purely about preserving show data.
get_variableA
Read variables from the console (SAFE_READ).

Args:
    action: One of:
        "echo"         — read any variable via `Echo $NAME` (system + user vars).
                         Use this for built-in system variables: $SELECTEDEXEC,
                         $TIME, $DATE, $VERSION, $FADERPAGE, $BUTTONPAGE,
                         $SELECTEDFIXTURESCOUNT, $USER, $HOSTNAME, $HOSTSTATUS, etc.
        "get_user"     — read a user variable via GetUserVar.
        "list_var"     — list all global show variables.
        "list_user_var"— list all user-profile variables.
    var_name: Variable name (required for "echo" and "get_user").
              May include or omit leading $. E.g. "SELECTEDEXEC" or "$mycounter".

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
         For "echo", also includes `variable` and `value` keys.
list_preset_poolA
List presets stored in the show's Global preset pool.

Without arguments: returns all PresetPool entries with their counts
(Dimmer, Position, Gobo, Color, Beam, Focus, Control, Shapers, Video).

With preset_type: navigates into that pool and lists individual presets
with their slot number, name, and Special field.

CD tree path navigated:
  cd 17 → cd 1 → list             (pool overview)
  cd 17 → cd 1 → cd N → list      (individual preset type)

Pool index → type mapping (live-verified v3.9.60.65):
  0=ALL  1=DIMMER  2=POSITION  3=GOBO  4=COLOR
  5=BEAM  6=FOCUS  7=CONTROL  8=SHAPERS  9=VIDEO

Note: The "Special" column shows "Normal" (standard) or "Embedded" — it
does NOT indicate Universal vs Selective scope. Scope is an internal flag
only visible in the console GUI or show XML.

Args:
    preset_type: Optional type to drill into. Accepts name ("color", "position")
        or number ("4"). If omitted, returns pool overview.

Returns:
    str: JSON with pool overview or individual preset list.
list_undo_historyB
Display the undo (Oops) history.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
set_executor_levelB
Set a fader/executor to a specific output level.

Args:
    executor_id: Executor number (1-999)
    level: Fader level 0.0–100.0
    page: Page number for page-qualified addressing (optional)

Returns:
    str: JSON result with command sent
navigate_pageA
Navigate executor pages on the console.

$FADERPAGE, $BUTTONPAGE, and $CHANNELPAGE are read-only system variables —
SetVar has no effect on them. Only `Page N` (this tool) changes the active page.

Args:
    action: "goto" (absolute page), "next" (page +), or "previous" (page -)
    page_number: Target page number (required for "goto"; 1-999)
    steps: Number of pages to advance/go back (optional; for "next"/"previous")
    create_if_missing: If True, sends `Store Page N /noconfirm` before navigating
        to create the page if it does not yet exist. Only applies to action="goto".
        Without this, MA2 returns Error #9 if the page doesn't exist.

Returns:
    str: JSON result with command sent
select_featureA
Select the active feature bank on the grandMA2 console (SAFE_WRITE).

Sends `Feature [name]` which updates $FEATURE.
$FEATURE is read-only — SetVar has no effect on it.
Only `Feature [name]` changes the active feature context.

Feature names are fixture-dependent — only features present on the selected
fixture's channels are valid. Live-verified names (v3.9.60.65):
  Dimmer, Position, Gobo1, Gobo2, ColorRGB, Shutter, Focus, MSPEED
Names that may error if fixture lacks the channel: Color, Zoom, Iris, Frost

Args:
    feature_name: Feature bank to activate (e.g. "Dimmer", "ColorRGB", "MSPEED")

Returns:
    str: JSON with command_sent, raw_response, risk_tier
select_preset_typeA
Select the active preset type on the grandMA2 console (SAFE_WRITE).

Sends `PresetType [id or name]` which jumps the encoder context to the
first Feature available in that preset type for the selected fixtures.
Updates $PRESET, $FEATURE, and $ATTRIBUTE simultaneously.

CD tree location (live-verified, v3.9.60.65):
  cd 10.2        → lists all 9 PresetTypes
  cd 10.2.N      → lists Features under PresetType N
  cd 10.2.N.M    → lists Attributes under Feature M of PresetType N
  cd 10.2.N.M.K  → lists SubAttributes (deepest level)

Preset types + live-verified $FEATURE on first activation:
  1=Dimmer  ($FEATURE=DIMMER,   $ATTRIBUTE=DIM)
  2=Position ($FEATURE=POSITION, $ATTRIBUTE=PAN)
  3=Gobo    ($FEATURE=GOBO1,    $ATTRIBUTE=GOBO1)
  4=Color   ($FEATURE=COLORRGB, $ATTRIBUTE=COLORRGB1, fixture-dep)
  5=Beam    ($FEATURE=SHUTTER,  $ATTRIBUTE=SHUTTER,   fixture-dep)
  6=Focus   ($FEATURE=FOCUS,    $ATTRIBUTE=FOCUS)
  7=Control ($FEATURE=MSPEED,   $ATTRIBUTE=INTENSITYMSPEED)
  8=Shapers (fixture must have Shapers channels)
  9=Video   (fixture must have Video channels)

Args:
    preset_type: Preset type number (1-9) or name (e.g. "Color", "Control")

Returns:
    str: JSON with command_sent, raw_response, risk_tier
browse_preset_typeA
Browse the feature/attribute tree under a preset type (SAFE_READ).

Navigates the grandMA2 LiveSetup preset-type cd-tree and lists children
at the requested depth. The tree structure (live-verified v3.9.60.65):

  cd 10.2.N       → Features under PresetType N
  cd 10.2.N.M     → Attributes under Feature M
  cd 10.2.N.M.K   → SubAttributes under Attribute K  (leaf level)

Indexes at each level use sequential position (1 = first listed child),
NOT the internal library ID shown in the output.

Args:
    preset_type_id: Preset type to browse (1=Dimmer, 2=Position, 3=Gobo,
        4=Color, 5=Beam, 6=Focus, 7=Control, 8=Shapers, 9=Video)
    depth: How deep to traverse (1=features only, 2=+attributes,
        3=+subattributes). Defaults to 1.

Returns:
    str: JSON with the tree structure at the requested depth.
modify_selectionB
Add, remove, replace, or clear the current fixture selection.

Args:
    action: "add" (+ N), "remove" (- N), "replace" (selfix), or "clear"
    fixture_ids: Fixture IDs to add/remove/replace (required for all except "clear")
    end_id: End of a range (optional; builds thru N)

Returns:
    str: JSON result with command sent
adjust_value_relativeB
Nudge an attribute value by a relative delta on the current (or specified) selection.

Args:
    delta: Relative change (positive or negative, non-zero). E.g. +10 or -5.
    attribute_name: Attribute to target (e.g. "Pan", "Tilt", "Dimmer"). Optional.
    fixture_ids: Select these fixtures before nudging. Optional.
    end_id: End of fixture range. Optional.

Returns:
    str: JSON result with commands sent
control_timecodeA
Start, stop, or jump to a position in a timecode show.

Args:
    action: "start" (go), "stop" (off), or "goto"
    timecode_id: Timecode show ID (1-256)
    timecode_position: HH:MM:SS:FF position string (required for "goto")

Returns:
    str: JSON result with command sent
control_timerA
Start, stop, or reset a console timer.

Args:
    action: "start" (go), "stop" (off), or "reset" (goto)
    timer_id: Timer ID (1-256)

Returns:
    str: JSON result with command sent
undo_last_actionA
Undo the last N actions on the console (sends 'oops' N times).

Args:
    count: Number of actions to undo (1-20, default 1)

Returns:
    str: JSON result with all raw responses
toggle_console_modeA
Toggle a console mode on/off (blind, highlight, solo, freeze).

These are toggle commands — each call flips the current state.

Args:
    mode: "blind", "highlight", "solo", or "freeze"

Returns:
    str: JSON result with command sent
update_cue_dataA
Update a cue with current programmer values (DESTRUCTIVE).

Args:
    confirm_destructive: Must be True to execute
    cue_id: Cue number to update (optional; updates active cue if omitted)
    sequence_id: Sequence ID for scoping (optional)
    merge: Merge programmer into existing cue values
    overwrite: Overwrite cue with programmer values
    cueonly: Prevent tracking forward (True) or allow (False)

Returns:
    str: JSON result with command sent
set_cue_timingA
Set fade and/or delay time on a specific cue (DESTRUCTIVE).

Args:
    cue_id: Cue number to update
    confirm_destructive: Must be True to execute
    sequence_id: Sequence ID for scoping (optional)
    fade_time: Fade time in seconds (0.0–3600.0, optional)
    delay_time: Delay time in seconds (0.0–3600.0, optional)

Returns:
    str: JSON result with commands sent
select_fixtures_by_groupA
Select all fixtures in a group (replaces or appends to current selection).

Args:
    group_id: Group ID to select (1-999)
    append: If True, adds group to current selection instead of replacing

Returns:
    str: JSON result with command sent
control_executorA
Control an executor: start, stop, flash, swop, solo, top, stomp, or set speed.

set_speed is DESTRUCTIVE (modifies stored data).

Args:
    action: "on", "off", "flash", "swop", "solo", "top", "stomp", or "set_speed"
    executor_id: Executor ID (1-999)
    page: Page number for page-qualified addressing (optional)
    speed_value: BPM value for set_speed (0.0–999.0; required for set_speed)
    confirm_destructive: Must be True when action="set_speed"

Returns:
    str: JSON result with command sent
load_cueA
Pre-load the next or previous cue without executing it (SAFE_WRITE).

LoadNext / LoadPrev arm the cue for Go without firing it.

Args:
    direction: "next" or "prev"
    executor_id: Executor ID to load on (optional)
    sequence_id: Sequence ID to load on (optional)

Returns:
    str: JSON result with command sent
cut_paste_objectA
Cut an object to clipboard, or paste clipboard content at a target (DESTRUCTIVE).

Cut + Paste is a two-step move: Cut prepares the source, Paste places it.
Does not work with cue objects — use copy_or_move_object for cues.

Args:
    action: "cut" or "paste"
    object_type: Object type ("group", "preset", "sequence", "macro", etc.)
    object_id: Source object ID (required for cut; ignored for bare paste)
    target_id: Destination ID (for paste)
    end: End ID for range cut (thru syntax)
    confirm_destructive: Must be True (cut removes the source; paste overwrites)

Returns:
    str: JSON result with command sent
clone_objectA
Clone (duplicate with data) one or more objects to new IDs (DESTRUCTIVE).

Clone copies all stored data from the source to the target — unlike Copy
it also migrates all associated cue/preset references.

Args:
    object_type: Object type ("fixture", "group", "sequence", etc.)
    object_id: Source object ID
    target_id: Destination object ID
    end: End ID for source range (thru syntax)
    target_end: End ID for target range
    noconfirm: Suppress confirmation dialog
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent
fix_locate_fixtureA
Fix (park) or Locate selected/specified fixtures (SAFE_WRITE).

Fix pins fixture output to current level, overriding playback.
Locate fires fixtures to their default state (full, open, centre).

Args:
    action: "fix" or "locate"
    fixture_ids: List of fixture IDs to fix (optional — uses selection if omitted)
    end: End ID for range when a single start ID is given

Returns:
    str: JSON result with command sent
manipulate_selectionA
Invert or Align the current fixture selection / programmer values (SAFE_WRITE).

Invert: swap selected and unselected fixtures.
Align: distribute programmer values evenly from first to last fixture.

Args:
    action: "invert" or "align"

Returns:
    str: JSON result with command sent
block_unblock_cueA
Block or Unblock a cue (DESTRUCTIVE — modifies cue data in the show file).

Block makes a cue store all active values and stop tracking from prior cues.
Unblock removes the block flag, allowing values to track through again.

Args:
    action: "block" or "unblock"
    cue_id: Cue number to block/unblock
    sequence_id: Sequence ID to scope the command (optional)
    end: End cue ID for range (thru syntax)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent
get_executor_statusA
Query the status of one or all executors (SAFE_READ).

Args:
    executor_id: Executor ID to inspect (optional; lists all if omitted)
    page: Page number for page-qualified addressing (optional)

Returns:
    str: JSON result with raw console response
store_timecode_eventB
Store a timecode trigger event that fires a cue at a specific time (DESTRUCTIVE).

Args:
    timecode_id: Timecode show ID (1-256)
    cue_id: Cue to trigger
    sequence_id: Sequence containing the cue
    confirm_destructive: Must be True to execute
    timecode_position: HH:MM:SS:FF position string (optional)

Returns:
    str: JSON result with command sent
set_sequence_propertyA
Set a property on a sequence object via the console tree (DESTRUCTIVE).

Navigates to the sequence node, assigns the property, then returns to root.

Args:
    sequence_id: Sequence ID (1-999)
    property_name: Property name (e.g. "loop", "tracking", "label")
    value: Property value (e.g. "on", "off", "My Sequence")
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with commands sent
delete_userA
Delete a console user account by slot number (DESTRUCTIVE).

The built-in Administrator in slot 1 cannot be deleted.
Requires confirm_destructive=True to proceed.

Args:
    slot: User slot number to delete (2–N). Slot 1 is protected.
    confirm_destructive: Must be True to execute (safety gate).

Returns:
    JSON with command_sent, raw_response, or block info.
browse_effect_libraryB
Browse the grandMA2 effect library (SAFE_READ).

Lists all available effect templates that can be applied to fixtures.

Returns:
    JSON with command_sent and raw_response from the console.
browse_macro_libraryA
Browse the grandMA2 macro library (SAFE_READ).

Lists all available macro templates that can be imported into the show.

Returns:
    JSON with command_sent and raw_response from the console.
browse_plugin_libraryA
Browse the grandMA2 plugin library (SAFE_READ).

Lists all available plugin templates installed on the console.

Returns:
    JSON with command_sent and raw_response from the console.
list_fader_modulesB
List connected fader modules (SAFE_READ).

Returns information about all fader wing modules currently connected
to the grandMA2 console.

Returns:
    JSON with command_sent and raw_response from the console.
list_update_historyB
List programming update history (SAFE_READ).

Shows the recent update log of programmer changes made in the show.

Returns:
    JSON with command_sent and raw_response from the console.
delete_showA
Delete a show file from disk (DESTRUCTIVE).

Permanently removes the named show file. This cannot be undone.
Requires confirm_destructive=True to proceed.

Args:
    name: Show file name to delete (without extension).
    confirm_destructive: Must be True to execute (safety gate).

Returns:
    JSON with command_sent, raw_response, or block info.
assign_temp_faderA
Set the temp fader level on the currently selected executor (SAFE_WRITE).

TempFader crossfades the cue on when pulled up and crossfades the cue off
when pulled down, relative to the given value. The value range is 0–100.

Args:
    value: Fader level 0–100 (default 50). 0 = full off, 100 = full on.

Returns:
    JSON with command_sent and raw_response from the console.
search_codebaseA

Search source code, grandMA2 docs, and MCP SDK source using the RAG index.

Three indexed knowledge sources (repo_refs):
- "worktree"     — this server's Python source, tests, and docs
- "ma2-help-docs" — ~1,043 grandMA2 help pages from help.malighting.com
- "mcp-sdk"      — installed MCP SDK source (~110 files, types, server, tools)

Works without any API key (text-search fallback). With GITHUB_MODELS_TOKEN
set, results are ranked by semantic similarity.

Args:
    query:  Natural language or keyword query (e.g. "navigate console",
            "store preset", "how to patch fixtures", "mcp tool context")
    top_k:  Number of results to return (default 8, max 20)
    kind:   Optional filter — one of: "source", "test", "doc", "config"

Returns:
    JSON array of matching chunks with path, kind, lines, score, and text.
    Returns an error JSON if the RAG index has not been built yet.

Examples:
    - Find command builders:   query="store preset", kind="source"
    - Find grandMA2 docs:      query="how to patch fixtures", kind="doc"
    - Find MCP SDK internals:  query="mcp tool decorator context"
    - Search everything:       query="effects engine"
    - Find test examples:      query="navigate_console", kind="test"
list_fixture_typesA
List all fixture types in the show (from LiveSetup/FixtureTypes).

Navigates to cd 10 (LiveSetup) -> cd 3 (FixtureTypes) -> list -> cd /

Returns:
    str: JSON with raw_response, entries (fixture type names, manufacturers,
         DMX footprint), risk_tier.
list_layersA
List all fixture layers in the show (from LiveSetup/Layers).

Navigates to cd 10 (LiveSetup) -> cd 4 (Layers) -> list -> cd /

Returns:
    str: JSON with raw_response, entries (layer names, fixture ranges),
         risk_tier.
list_universesA
List DMX universes and their configuration (from LiveSetup/Universes).

Navigates to cd 10 (LiveSetup) -> cd 5 (Universes) -> list -> cd /

Args:
    max_universes: Limit output to first N universes (default 16, max 256).

Returns:
    str: JSON with raw_response, risk_tier.
list_libraryB
Browse the console's built-in libraries.

Args:
    library_type: "fixture" (ListLibrary), "effect" (ListEffectLibrary),
                  or "macro" (ListMacroLibrary).

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
manage_matricksA
Control MAtricks selection patterns via direct command keywords (SAFE_WRITE).

Uses grandMA2 MAtricks command keywords that act directly on the current
fixture selection — no navigation required.

Actions and their parameters:
  - "interleave": Set virtual grid width. Params: value (width), column, increment (+/-), turn_off.
  - "blocks": Set block size. Params: value (size), x, y (x.y notation), increment (+ N/- N), turn_off.
  - "groups": Set align group size. Params: value (size), x, y (x.y notation), increment (+ N/- N), turn_off.
  - "wings": Set wing/mirror parts. Params: value (parts), increment (+/-), turn_off.
  - "filter": Set sub-selection filter. Params: value (filter_num), name (filter name), increment (+/-), turn_off.
  - "reset": Clear all MAtricks settings. No params.
  - "recall": Recall a MAtricks pool object or toggle mode. Params: value (matricks_id), mode (on/off/toggle).
  - "all": Reset Single X sub-selection. No params.
  - "allrows": Reset Single Y sub-selection. No params.
  - "next": Step forward through Single X sub-selection. No params.
  - "previous": Step backward through Single X sub-selection. No params.
  - "nextrow": Step forward through Single Y (row) sub-selection. No params.

Args:
    action: The MAtricks action to perform.
    value: Primary numeric value (width/size/parts/filter_num/matricks_id).
    x: X-axis value for blocks/groups x.y notation.
    y: Y-axis value for blocks/groups x.y notation.
    column: Column for interleave column.width notation.
    increment: Step value: "+", "-", "+ N", or "- N".
    name: Filter name (for action="filter").
    mode: "on", "off", or "toggle" (for action="recall").
    turn_off: Send the "Off" variant of the command.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
store_matricks_presetA
Set MAtricks state, store to pool, and label — all in one call (DESTRUCTIVE).

Workflow:
  1. Optionally resets all MAtricks settings (reset_first=True, default)
  2. Applies specified MAtricks settings (interleave, blocks, groups, wings, filter)
  3. Stores current MAtricks state to the specified pool slot (/overwrite)
  4. Labels the pool object with the given name

At least one MAtricks setting must be provided.

Args:
    pool_slot: Pool slot number to store into (e.g. 2).
    name: Label for the stored MAtricks object (e.g. "Wings-2-I4").
    interleave: Virtual grid width (MAtricksInterleave).
    blocks: Block size X (MAtricksBlocks). Use with blocks_y for x.y.
    blocks_y: Block size Y (requires blocks for x.y notation).
    groups: Align group size X (MAtricksGroups). Use with groups_y for x.y.
    groups_y: Align group size Y (requires groups for x.y notation).
    wings: Wing/mirror parts (MAtricksWings).
    filter_num: Filter number (MAtricksFilter).
    filter_name: Filter name (MAtricksFilter, e.g. "OddID").
    reset_first: Reset all MAtricks before applying (default True).
    confirm_destructive: Must be True to execute (DESTRUCTIVE operation).

Returns:
    str: JSON with commands_sent list, pool_slot, name, risk_tier.
create_matricks_libraryA
Create a full MAtricks combinatorial library (DESTRUCTIVE).

Generates every combination of Wings × Groups × Blocks × Interleave
(values 0 to max_value) as XML with embedded appearance colors and
imports into the MAtricks pool. Colors are instant — no telnet loop needed.

25-color scheme: Wings=hue (Red/YellowGreen/Cyan/Blue/Magenta),
Groups=brightness (100/80/60/45/30).

With max_value=4: 5^4 = 625 pool items, named W0-G0-B0-I0 through W4-G4-B4-I4.

Args:
    max_value: Upper bound for each property (default 4, gives 5^4=625 items).
    start_slot: First pool slot to import into (default 2, slot 1 is Reset).
    confirm_destructive: Must be True to execute (overwrites MAtricks pool entries).

Returns:
    str: JSON with pool_items_created, color_scheme, first_slot, last_slot.
discover_filter_attributesA
Discover actual filter attributes from the current show's fixture library (SAFE_READ).

Browses PresetTypes 1-7 (Dimmer through Control) at depth 2 to collect
attribute names from all patched fixture types. Returns a dict matching the
shape of FILTER_ATTRIBUTES in constants.py but with show-specific values.

Use this before create_filter_library if your show uses fixtures other than
Mac 700 Profile Extended + Generic Dimmer (the defaults in FILTER_ATTRIBUTES).

Returns:
    str: JSON dict mapping category names to attribute name lists.
create_filter_libraryA
Create a comprehensive Filter library with color-coded pool items (DESTRUCTIVE).

Generates filters for each PresetType (Dimmer, Position, Gobo, Color, Beam,
Focus, Control), useful multi-type combos, and "No X" exclusion filters.
Each filter is color-coded by category and imported as individual XML files.

Optionally generates Value/ValueTimes/Effects on/off variants for each base
filter (7 combos per filter, excluding all-off). V/VT/E toggles are embedded
in the XML as value="false", value_timing="false", effect="false" attributes.

Slot layout (default start_slot=3):
  - Slots 3-9: Single PresetType filters (7 items)
  - Slots 10-16: Combo filters (7 items, if include_combos)
  - Slots 17-23: "No X" exclusion filters (7 items, if include_exclusions)
  - Slots 24+: V/VT/E variants (N_base × 7, if include_vte)

Args:
    start_slot: First pool slot (default 3, preserving system filters 1-2).
    include_combos: Include multi-type combo filters (default True).
    include_exclusions: Include "No X" exclusion filters (default True).
    include_vte: Include Value/ValueTimes/Effects variants (default False).
        When True, generates 7 V/VT/E combos for each base filter.
    fixture_attributes: Show-specific attribute dict (same shape as FILTER_ATTRIBUTES).
        If None, uses hardcoded defaults (Mac 700 + Generic Dimmer).
        Call discover_filter_attributes() first to get accurate values for your show.
    confirm_destructive: Must be True to execute (overwrites filter pool entries).

Returns:
    str: JSON with filters_created, slots, color_scheme summary.
save_showA
Save the current show file to disk.

Args:
    action: "save" (overwrite current) or "saveas" (save under a new name).
        Giving show_name implies "saveas".
    show_name: Show name (required for action="saveas")

Returns:
    str: JSON result with command sent. Saving over an existing file may
        open an overwrite pop-up — reported as pending_popup.
store_cue_with_timingA
Store a cue with inline fade and outtime parameters (DESTRUCTIVE).

When sequence_id is omitted, MA2 stores into the sequence on the currently
selected executor. Pass sequence_id explicitly to target a specific sequence
regardless of executor selection state (same behavior as store_current_cue).

Args:
    cue_id: Cue number to store
    confirm_destructive: Must be True to execute
    fade_time: Fade-in time in seconds (optional)
    out_time: Fade-out time in seconds (optional)
    merge: Merge into existing cue
    overwrite: Overwrite existing cue
    cue_name: Optional cue label
    sequence_id: Sequence to store into (omit to use selected executor)

Returns:
    str: JSON result with command sent
select_executorA
Select an executor on the console.

IMPORTANT: MA2 telnet 'select executor N' is single-selection only — there
is no list syntax. You cannot select multiple executors simultaneously via
this command. Pass only a single executor_id integer.

After sending the command, $SELECTEDEXEC is read back to confirm the
selection took effect. A 'warning' field is included in the response if
the confirmed value does not match the requested executor_id.

To clear the current selection, pass deselect=True. This sends a bare
'select' command with no argument. NOTE: bare 'select' behaviour is
unverified on grandMA2 telnet — it may clear selection, be silently
ignored, or produce an error. Inspect 'raw_response' to confirm.

Args:
    executor_id: Executor number (1-999). Single value only.
    page: Page number for page-qualified addressing (optional).
          e.g. page=2, executor_id=5 → 'select executor 2.5'.
          $SELECTEDEXEC returns the executor number only (not page-qualified).
    deselect: If True, send bare 'select' to clear the current selection
              instead of selecting executor_id. Defaults to False.

Returns:
    str: JSON with command_sent, raw_response, confirmed_selected_exec,
         and risk_tier. Includes 'warning' if confirmed value doesn't match.
remove_from_programmerB
Remove channels, fixtures, or a group from the programmer using Off.

Args:
    object_type: "channel", "fixture", or "group"
    object_id: Object ID to remove
    end_id: End of range for channel/fixture (optional; builds thru N)

Returns:
    str: JSON result with command sent
assign_cue_triggerA
Assign a playback trigger type to a cue (DESTRUCTIVE).

Args:
    cue_id: Cue number to assign the trigger to
    sequence_id: Sequence containing the cue
    trigger_type: "go", "follow", "time", or "bpm"
    confirm_destructive: Must be True to execute
    trigger_value: BPM or time value (required for "bpm" and "time")

Returns:
    str: JSON result with command sent
assign_executor_propertyA
Assign any of the 22 settable options to an executor (DESTRUCTIVE).

Always uses page-qualified addressing (page.executor_id) to avoid Error #66.

Valid options (case-sensitive):
  Layout:   width (1-5)
  Priority: priority (low|normal|high|htp|swap|super)
  Start:    autostart, autostop, autofix, autostomp, restart
  Protect:  ooo, swopprotect, killprotect
  Playback: softltp, wrap, crossfade (off|a|b|ab — requires width>=2), chaser
  Timing:   triggerisgo, cmddisable, effectspeed, autogo
  Speed:    speed (0-65535 BPM), speedmaster (speed_individual|speed1-16),
            ratemaster (rate_individual|rate1-16)

Args:
    executor_id: Executor ID (e.g. 203).
    option: Option name from the list above.
    value: Value to assign (e.g. 2, "on", "high", "speed1").
    confirm_destructive: Must be True to execute.
    page: Page number (default 1). Always included in the address.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
set_executor_priorityA
Set the playback priority of an executor (Tool 130).

Priority determines how this executor interacts with other active executors
and the programmer. Uses page-qualified addressing (page.executor_id) to
avoid Error #66 CANNOT ASSIGN.

Priority levels (highest → lowest):
  - "super"  — LTP above ALL playbacks + programmer. Only Freeze overrides.
  - "swap"   — LTP > HTP; negative override possible. Affects ALL attributes.
  - "htp"    — Highest intensity value wins. Changes ALL attribute priority.
  - "high"   — High LTP. Overrides Normal/Low but not HTP intensity.
  - "normal" — LTP default. Last triggered value wins.
  - "low"    — Lowest priority. Overridden by everything else.

Args:
    executor_id: The executor to modify (e.g. 201).
    priority: One of "super", "swap", "htp", "high", "normal", "low".
    page: Page number (default 1). Always included in the address.

Returns:
    str: JSON with command_sent, raw_response, risk_tier.
get_executor_stateA
Read all 32 fields of a single executor via 'List Executor page.id' (SAFE_READ).

Returns all KEY=VALUE fields including Width, Priority, AutoStart, AutoStop,
Crossfade, SpeedMaster, RateMaster, Filter, PlaybackMaster, etc.

Must use page-qualified addressing — bare executor IDs return wrong data.

Args:
    executor_id: Executor ID (e.g. 203).
    page: Page number (default 1).

Returns:
    str: JSON with fields dict, command_sent, raw_response.
discover_fixture_type_attributesA
Discover attribute names for a fixture type via EditSetup tree navigation (SAFE_READ).

Navigates cd EditSetup → FixtureTypes → type N → first mode → first subfixture → list,
returning ChannelType rows with attribute library names (e.g. PAN, TILT, COLORRGB1).

Use this to confirm which attributes a fixture type exposes before building presets.
Note: Info FixtureType N does NOT return attribute names — this navigation method is
the correct approach (live-verified 2026-03-31).

Args:
    fixture_type_id: Fixture type number (e.g. 4 for Mac Viper Profile 16-bit).

Returns:
    str: JSON with raw_response containing ChannelType rows.
scan_page_executor_layoutA
Scan a range of executors on a page and return their slot occupancy map (SAFE_READ).

Queries each executor in the range via 'List Executor page.id' (KEY=VALUE format),
extracts Name, Sequence, and Width. Builds an occupancy map showing which consecutive
slots are blocked by wide executors, and lists free slots.

Use this BEFORE setting width on an executor to confirm the adjacent slot is free.
A width=2 executor at slot N blocks slot N+1; the console will silently fail or wrap
if N+1 is already occupied.

Args:
    page: Page number to scan (default 1).
    executor_id_start: First executor ID to check (default 201).
    executor_id_end: Last executor ID to check (default 240).

Returns:
    str: JSON with:
      - executors: list of {id, name, sequence, width, slots_occupied}
      - blocked_slots: set of slot IDs consumed by multi-wide executors
      - free_slots: slot IDs in range with no assignment
if_filterB
Apply an If filter to the current selection or command context.

Args:
    filter_type: "active" (bare 'if'), "fixture" (specific fixture), or "attribute"
    fixture_id: Fixture ID (required for "fixture" and "attribute")
    attribute_name: Attribute name (required for "attribute"; e.g. "Pan")

Returns:
    str: JSON result with command sent
save_recall_viewA
Store, recall, or label a screen view (store is DESTRUCTIVE).

Args:
    action: "store" (save current screen), "recall" (load view), or "label" (name it)
    view_id: View slot ID (1-10)
    screen_id: Screen number (1-4, default 1)
    view_name: Label for the view (required for action="label")
    confirm_destructive: Must be True for action="store"

Returns:
    str: JSON result with command sent
list_console_usersA
List all user accounts in the current show file (SAFE_READ).

Returns the raw `list user` output from the console, showing all
user slots with their names, rights levels, and profile assignments.

Returns:
    str: JSON result with raw console response
create_console_userA
Create or overwrite a user account in the show file (DESTRUCTIVE — Admin only).

Requires both gma2:user:manage OAuth scope AND confirm_destructive=True.

grandMA2 rights levels:
    0 = None     (view/change views only, no programmer)
    1 = Playback (run show, no store)
    2 = Presets  (update existing presets only)
    3 = Program  (full show programming)
    4 = Setup    (patch, fixture import, console setup)
    5 = Admin    (full access + user/session/show management)

Args:
    slot: User slot number (2-N; slot 1 = Administrator, always exists)
    name: Username (alphanumeric + underscores, no spaces)
    password: Console login password (empty string = no password required)
    rights_level: MA2 rights level 0-5
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent
assign_world_to_user_profileA
Assign a World (fixture visibility mask) to a User Profile (DESTRUCTIVE — Admin only).

Restricts all Users assigned to this profile to only access fixtures and attributes
visible in the specified World. Use world_slot=0 to remove the restriction (None).

Args:
    user_profile_slot: UserProfile slot number to modify
    world_slot: World slot number (0 = no restriction / remove World assignment)
    confirm_destructive: Must be True to execute

Returns:
    str: JSON result with command sent
inspect_sessionsA
Inspect active per-operator Telnet session pool (SAFE_READ).

Returns a snapshot of the session manager's current state: how many
sessions are open, which console users they are authenticated as, and
how long each has been idle.  Useful for diagnosing connection issues
in multi-operator deployments.

Returns:
    JSON with session_count and a sessions list, each entry containing:
    identity, username, connected, idle_seconds, age_seconds.

Prompts

Interactive templates invoked by user choice

NameDescription
preflight_destructive_change Run pre-flight checks before any destructive console operation. Use this prompt before calling any DESTRUCTIVE tool to ensure the operation is safe to proceed. Args: operation: The destructive operation to perform (e.g. "delete_object", "store_current_cue"). target: The object or path being modified (e.g. "Group 5", "Sequence 1 Cue 3"). reason: Why this change is needed (optional but recommended for audit trail).
inspect_console Guided console state inspection — Inspect workflow. Produces a structured console overview without any mutations. Args: focus: What to inspect — "full" (default), "playback", "fixtures", "show", or "rights".
plan_cue_store Plan a cue store operation with safety and rights checks — Plan workflow. Use this prompt to generate a structured cue store plan before executing. The plan includes pre-flight checks, proposed commands, and a verification step. Args: sequence_id: Sequence number (e.g. "1", "99"). cue_number: Target cue number (e.g. "1", "3.5"). fixture_selection: Fixture group or ID range to use (e.g. "Group 1", "Fixture 1 Thru 10"). preset_or_values: Preset to apply or manual values (e.g. "Preset 4.5", "Full").
diagnose_playback_failure Diagnose a playback failure on a specific executor — Inspect + Plan workflows. Use this prompt when a cue or executor is not behaving as expected. Args: executor_id: The executor identifier (e.g. "1", "201", "1.1.201"). symptom: What is observed (e.g. "cue not advancing", "no output", "wrong fixtures responding").
load_show_safely Safe show loading checklist — prevents accidental Telnet disconnection. Use this prompt before any new_show or load_show operation. Args: show_name: The show file to load (e.g. "my_show_2026").
bootstrap_rights_users Bootstrap the standard six-tier MA2 rights user accounts — guided provisioning workflow. Use this prompt when setting up a new show file with the standard operator rights ladder (Admin, LightOperator, Programmer, PlaybackOperator, Guest, Emergency).
volunteer_sunday_preflight Sunday morning preflight checklist for volunteer operators — SAFE_READ guided verification that the correct show is loaded, presets are populated, and executors are assigned.
generate_busking_template Generate a complete grandMA2 busking template from the current patch — groups, presets, effects, speed masters, and executor layout.
pre_show_health_check Full show health audit before going live — checks showfile, presets, executors, cue integrity, park ledger, and DMX. Returns GREEN/AMBER/RED per category.
adapt_show_to_venue Adapt an existing show file to a new venue's fixture rig — guided cross-venue adaptation with patch comparison, group remapping, and preset verification.

Resources

Contextual data attached and managed by the client

NameDescription
resource_console_activity Recent console-changing tool calls made through this server (live). Read from the local telemetry log — no console I/O. Subscribe to get a notifications/resources/updated message after every change.
resource_rights_matrix MA2 OAuth scope → MA2Right mapping matrix (read-only reference). Returns the full JSON rights matrix from doc/ma2-rights-matrix.json. Use this resource to look up which OAuth scope is required for any MA2 operation before attempting to call a tool.
resource_vocab_summary grandMA2 keyword vocabulary summary — all 141 keywords with RiskTier and category. Use this resource to look up the safety tier of any MA2 keyword before including it in a command string. Tier determines whether confirm_destructive is required and which OAuthScope must be active.
resource_tool_taxonomy ML-generated tool taxonomy — all registered tools clustered into categories. Each entry includes tool name, category, and docstring summary. Use this resource to understand the tool landscape before calling suggest_tool_for_task, or to verify a tool exists before invoking it.
resource_responsibility_map Module responsibility map — every file's primary role and architectural smells. Use this resource when making architectural decisions or when adding new modules, to ensure the new code is placed in the correct layer.
resource_tool_surface_tiers Tool profiles (GMA_TOOL_PROFILE=core|standard|full) — which tools each one exposes, generated from src/tool_profiles.py so it can't drift.
resource_busking_patterns Best-practice busking patterns for live performance lighting (read-only). Covers: fader-per-effect model, song macro page protocol, live recovery steps, and color lock technique. Use before designing a busking show.
resource_effect_design Effect-to-executor assignment patterns and rate/speed semantics (read-only). Covers: assign_effect_to_executor usage, rate vs speed distinction, MAtricks layering for busking, and batch release safety.
resource_color_design Constrained color palette design for busking shows (read-only). Covers: HSB palette strategy, preset numbering, monochromatic constraint, and color lock via group master. Use when designing song color palettes.
resource_volunteer_guide Volunteer operator guide — plain-language grandMA2 operation for non-programmers. Explains the three-tier access model, Sunday morning preflight procedure, and what to do when things go wrong. Designed for church technical directors training volunteers and any production environment with tiered staff skill levels.
resource_sb132_compliance SB 132 compliance guide — California Film & Television Tax Credit safety documentation requirements mapped to MA2 Agent telemetry fields. For gaffers, safety officers, production managers, and insurance brokers on productions receiving the California Film & Television Tax Credit (effective July 2025).
resource_rdm_workflow RDM (Remote Device Management) workflow reference — discovery, device info, and autopatch best practices for grandMA2 via telnet.
resource_lua_scripting grandMA2 Lua 5.2 scripting reference — gma.* namespace, plugin lifecycle, and common patterns for MCP-driven plugin development.

TDQS

B3.1/5.0

Scored across 237 tools

Disambiguation1/5

The 237-tool surface contains many overlapping clusters: multiple console-state/snapshot readers, several executor status/detail/state tools, many list/browse/query tools for pools, and multiple assign/select/store variants. An agent cannot reliably distinguish, for example, get_console_state vs get_showfile_info vs incident_snapshot, or query_object_list vs list_pool_names vs list_console_destination.

Naming Consistency3/5

All names use snake_case, so casing is consistent. However conventions are mixed: some are verb_noun (get_console_state), some noun-first (playback_action, system_admin, plugin_management), some action_or_noun (label_or_appearance), and read operations use list/get/browse/query/scan/inspect interchangeably. It remains readable but not a single predictable pattern.

Tool Count1/5

237 tools is far beyond a well-scoped set; the rubric treats 50+ as an extreme mismatch. The server bundles core console control, agent orchestration, skill registry, telemetry, RAG search, clustering, and compliance reporting into one surface.

Completeness2/5

Despite huge breadth, there are significant core gaps: no create_fixture_group, no store_new_preset, no list_fixtures, no disconnect_console, no navigate_console, and no execute_sequence, even though several tools explicitly reference them. Cue storage exists via store_cue_with_timing, but group/preset creation and basic fixture listing are dead ends that will cause agent failures.

Maintenance

ActivitySlowing
ResponsivenessNo recent community issues