Skip to content
ClaudeUnreal
GitHub

Input Management

This content is not available in your language yet.

13 tools — 0 typed MCP · 13 via cu CLI.

  • Enhanced Input — 13 tools

Create an Enhanced Input action with key binding in a single call.

@mcp.tool()
@showcase(
"Create an Enhanced Input action with key binding in a single call.",
featured=True,
)
def create_input_mapping(
ctx: Context,
action_name: str,
key: str,
context_name: str = "DefaultMappingContext",
value_type: str = "Boolean"
) -> ToolResult:
"""[Input] Create an Enhanced Input mapping for the project.
Creates a UInputAction asset and a UInputMappingContext asset,
then binds the specified key to the action in that context.
Anti-patterns:
- Do not call this if the **Enhanced Input** plugin is disabled — the
subsystem lookup fails with "Enhanced Input subsystem not found".
- Do not pass legacy ``InputAxis``/``ActionMappings`` style names — this
tool is for Enhanced Input only.
- ``value_type`` must be one of ``"Boolean"``, ``"Axis1D"``, ``"Axis2D"``,
``"Axis3D"``. Pass ``"Boolean"`` for buttons, ``"Axis1D"`` for triggers,
``"Axis2D"`` for sticks/mouse delta.
- Must be called BEFORE ``add_blueprint_input_action_node`` — the
UInputAction asset must exist first.
Args:
action_name: Name of the input action (e.g. "Jump", "Fire")
key: Key to bind (e.g. "SpaceBar", "LeftMouseButton", "W")
context_name: Name of the mapping context (default: "DefaultMappingContext")
value_type: Type of input value: "Boolean", "Axis1D", "Axis2D", "Axis3D"
Returns:
Response with action and context asset paths
"""
from claude_unreal_server import get_unreal_connection
try:
unreal = get_unreal_connection()
if not unreal:
return err("Failed to connect to Unreal Engine")
params = {
"action_name": action_name,
"key": key,
"context_name": context_name,
"value_type": value_type
}
logger.info(f"Creating Enhanced Input mapping '{action_name}' with key '{key}' in context '{context_name}'")
response = unreal.send_command("create_input_mapping", params)
if not response:
return err("Failed to create input mapping: no response from Unreal Engine")
if response.get("status") == "error":
return err(f"Failed to create input mapping '{action_name}' → '{key}'", error=response.get("error", "Unknown error"))
result = response.get("result", response)
return ok(f"Created input mapping '{action_name}' → '{key}'", **result)
except Exception as e:
error_msg = f"Error creating input mapping: {e}"
logger.error(error_msg)
return err("Failed to create input mapping", error=str(e))