Skip to main content
Glama

inject_key_input

Destructive

Press or release keyboard/gamepad keys in a running PIE session so an agent can drive headless gameplay or move UI focus.

Instructions

Press or release a keyboard/gamepad key at a running PIE session's PlayerController, so an agent can drive the game headless -- jump, interact, open a menu. Press and release are SEPARATE calls: a tap is two of them, a hold is press now and release later. Requires an active PIE session; use inject_analog_input for sticks and triggers (with its hold_seconds for sustained movement) and inject_mouse_button for clicks. WARNING: injected only means the event reached the controller: whether the game DID anything is a state read, and in co-op read the right world.

Returns: { injected: bool, key: string, event: string, pie_client_index: int, route: string, controller_injected: bool, slate_injected: bool, slate_handled: bool, slate_note? } -- NOTE: slate_handled is Slate's own verdict on whether anything consumed the key: false usually means nothing had focus, which is the useful signal (not a failure of the call).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesRequired key name as Unreal spells it, e.g. "SpaceBar", "W", "Gamepad_FaceButton_Bottom". An unknown name is a clean error, never a silent no-op.
eventNoOptional "Pressed" (default), "Released" or "Repeat". Remember the matching Released, or the game keeps thinking the key is down.
routeNoOptional "controller" (default), "slate" or "both". NOTE: THIS IS THE DIFFERENCE BETWEEN DRIVING THE GAME AND DRIVING THE UI: the controller route goes through PlayerController::InputKey, which is the gameplay input layer -- it moves the character and fires Enhanced Input actions but NEVER moves UI focus. The slate route goes through FSlateApplication::ProcessKeyDownEvent, which is the only one that moves FOCUS, so it is the only way to test a menu's gamepad navigation headless. They are not interchangeable; "both" sends to each.
amount_depressedNoOptional float (default 1.0). Only meaningful on the controller route.
pie_client_indexNoOptional int (default 0). Which PIE client window to target -- 0 is the server/host window in a ListenServer session, 1 the first client.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag a mutating, non-idempotent, non-read-only operation, but the description adds substantial context beyond them: the caveat that 'injected' only means the event reached the controller and that whether the game acted is a separate state read, the co-op world caveat, and the interpretation of slate_handled as Slate's own verdict rather than a call failure. This is exactly the kind of behavioral disclosure that helps an agent avoid misreading results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and invocation model before the warnings, and every sentence carries operational weight (press/release split, PIE prerequisite, sibling routing, result caveat). It is dense and runs long, but it is not padded; the only cost is a slightly heavy read.

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

Completeness5/5

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

There is no output schema, yet the description enumerates the return fields and explains the one ambiguous field (slate_handled) and the injected caveat, so an agent knows both how to call it and how to interpret the response in headless co-op scenarios.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the schema already documents route, event, amount_depressed and pie_client_index in detail. The description still adds meaning by clarifying that press and release are separate calls (interpreting the event parameter) and by warning about the injected-then-state-read gap, which the schema does not.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (press/release), resource (keyboard/gamepad key) and target (running PIE session's PlayerController), with the intent spelled out ('drive the game headless'). It names the sibling alternatives inject_analog_input and inject_mouse_button, so an agent can distinguish it without opening either schema.

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

Usage Guidelines5/5

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

Explicit prerequisites (requires an active PIE session), explicit routing to alternatives (analog input for sticks/triggers, mouse button for clicks), and explicit invocation semantics: a tap is two calls, a hold is press now and release later. Nothing about when to use it versus siblings is left to inference.

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

Deploy Server

Other Tools