# Context System The `unreal_get_ue_context` tool solves a fundamental problem with AI-assisted Unreal development: language models have training cutoffs and often hallucinate deprecated or incorrect UE APIs. The context system injects accurate, version-pinned Unreal documentation directly into the AI's context window on demand. The current documentation target is **UE 5.8**, hotfix **5.8.4**. The installed plugin may contain an older context bundle. Check its version and compare signatures with the matching engine headers before applying generated code. A website documentation update does not update a local plugin bundle. See [Unreal versions and upgrades](/docs/unreal-engine-version). ## The Problem AI models trained before the installed engine release — or trained on a mix of UE versions — frequently: - Suggest APIs that were deprecated or removed in 5.x - Use incorrect function signatures (wrong parameter order, wrong types) - Confuse UE4 patterns with UE5 equivalents (e.g., `GetWorld()->SpawnActor` vs Enhanced Subsystems) - Generate `UPROPERTY` and `UFUNCTION` specifiers that do not exist in your engine version These errors are subtle. The code often looks plausible and compiles after minor edits, but produces incorrect runtime behavior. ## The Solution `unreal_get_ue_context` is a read-only tool that fetches curated, version-pinned documentation snippets from the installed plugin bundle. When the AI calls this tool before writing code, it receives accurate API signatures, correct specifier lists, and working code examples — grounded in the version identified by that bundle. ## Categories The tool accepts a `category` string that selects a documentation domain. Available categories: | Category | Contents | |----------|----------| | `actor` | AActor lifecycle, spawning, tags, components, tick, destroy | | `animation` | UAnimInstance, state machines, montages, notifies, linked layers | | `assets` | Asset registry, FAssetData, UObjectLibrary, async loading | | `blueprint` | Blueprint-callable C++ patterns, UFUNCTION specifiers, BlueprintImplementableEvent | | `character` | ACharacter, UCharacterMovementComponent, movement modes, jump | | `enhanced_input` | UInputAction, UInputMappingContext, UEnhancedInputComponent, triggers, modifiers | | `material` | UMaterialInstanceDynamic, parameter collections, MID in C++ | | `parallel_workflows` | Task graph, AsyncTask, ParallelFor, game thread marshaling | | `replication` | UPROPERTY replication, RPCs, OnRep, NetMulticast, authority checks | | `slate` | SWidget, SCompoundWidget, SLATE_ATTRIBUTE, FSlateApplication | ## How to Use Call `unreal_get_ue_context` at the start of any task that involves writing Unreal C++. Pass the category most relevant to the work. ```json { "operation": "query", "params": { "category": "enhanced_input" } } ``` ```json { "operation": "query", "params": { "category": "character" } } ``` The tool returns a structured documentation block that is injected into the AI's context window. The AI reads it before generating code, checking the returned version and signatures rather than relying on training data. ## Example Response Illustrative output for the `enhanced_input` category (inspect your installed bundle for its actual version and signatures): ``` Unreal Enhanced Input — Key APIs UInputAction (UIA) Class: UInputAction : UDataAsset Header: EnhancedInput/Public/InputAction.h ValueType: EInputActionValueType { Boolean, Axis1D, Axis2D, Axis3D } UInputMappingContext (IMC) Class: UInputMappingContext : UDataAsset Header: EnhancedInput/Public/InputMappingContext.h AddMapping: FEnhancedActionKeyMapping& AddMapping(UInputAction*, FKey) Binding in C++ (APlayerController subclass): void AMyController::SetupInputComponent() { Super::SetupInputComponent(); UEnhancedInputComponent* EIC = CastChecked(InputComponent); EIC->BindAction(IA_Jump, ETriggerEvent::Triggered, this, &AMyController::OnJump); // Add IMC if (UEnhancedInputLocalPlayerSubsystem* Sub = ULocalPlayer::GetSubsystem( GetLocalPlayer())) { Sub->AddMappingContext(IMC_Default, 0); } } UPROPERTY specifiers for input assets: UPROPERTY(EditDefaultsOnly, Category="Input") TObjectPtr IA_Jump; UPROPERTY(EditDefaultsOnly, Category="Input") TObjectPtr IMC_Default; ``` ## When to Use It Use `unreal_get_ue_context` whenever the task involves: - Writing new C++ classes that extend UE engine classes - Using UE subsystems (Enhanced Input, GAS, Online Subsystem, etc.) - Adding `UPROPERTY` or `UFUNCTION` specifiers you're not certain about - Implementing replication — authority checks, RPCs, OnRep functions - Working with the animation system (montages, linked layers, notify states) - Using Slate for custom editor UI widgets You do not need it for: - Pure Blueprint graph operations (use `unreal_blueprints` tool calls instead) - Reading or searching existing assets - Moving or spawning actors with known class paths ## Context vs. Searching Engine Source `unreal_get_ue_context` is faster and more reliable than reading engine source files directly: | Approach | Speed | Accuracy | Token cost | |----------|-------|----------|------------| | `unreal_get_ue_context` | Instant | Curated, version-pinned | Low — returns only relevant snippets | | Reading engine source files | Slow | Exact but requires navigation | High — full header files | | Relying on training data | Instant | Unreliable, may be outdated | Zero | For most coding tasks, `unreal_get_ue_context` gives you the right answer in one call. Only reach for engine source files when you need implementation details that go beyond API signatures — for example, understanding the internal state machine of `UCharacterMovementComponent`. Use the `Engine/Source/` directory of your own installed or source-built editor. For the current target, verify against UE 5.8.4 rather than a different developer's checkout.