K3 studio WSk3studio
studio.kr3mu.dev Get started

MCP server

K3 Studio is an MCP server for the agent it runs. Claude Code gets the server's console, its errors, the database and the running game as tools.

How it connects

When the agent panel starts Claude Code, K3 Studio opens an HTTP endpoint on 127.0.0.1 with a random port and a random bearer token, and passes it with --mcp-config. There is nothing to set up, nothing listens beyond your machine, and your own MCP servers still load as usual.

{
  "mcpServers": {
    "k3studio": {
      "type": "http",
      "url": "http://127.0.0.1:<port>/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}
  • Game tools act on the first connected player through the k3studio dev resource. Press Esc to take control back.
  • db_execute changes data, so K3 Studio asks you first. db_query is read-only.

Tools

Server & editor

session_take

Takes the server and game for you when other agents may need them too: you hold them (K3 Studio starts the server and FiveM joins when they're down) or wait in line, and the answer says which. While another agent holds them, game and server tools are refused. Call it before testing in the game.

session_release

Hands the server and game to the next agent in line; with nobody waiting, a server an agent started stops. Call it when you're done testing. Ending your turn releases them too.

server_status

Whether K3 Studio's FXServer is running, its endpoint, and how many runtime errors are open.

server_console

The latest server and client console lines (FXServer output and the FiveM client log).

lines integer
How many lines, newest last (default 50, max 500).
server_command

Runs a command in the FXServer console, e.g. 'ensure inventory' or 'refresh'.

command string required
runtime_errors

SCRIPT ERRORs the server and client consoles reported since each resource last restarted, with file, line, count and stack.

diagnostics

Language server diagnostics (qbx-lua-ls: wrong-side natives, undefined globals, ...) for one file or all open files.

path string
Absolute path; omit for all files.
open_file

Opens a file in K3 Studio's editor, optionally at a 1-based line, so the user sees it.

path string required
line integer
playtests_run

Runs the playtests (Lua files in each resource's playtests/ folder, in the game or with '-- side: server' on the server) and returns PASS/FAIL per test with the failure's message and line. filter: only tests whose name contains it.

filter string
request_image

Asks the user for a picture you need (a logo, label artwork, a reference photo): a card in the chat lets them choose a file or paste one. It is saved as save_as (relative to the workspace, e.g. next to the prop: props/label.png) and arrives as the user's next message with the image and its path. Say in reason what you need and why.

reason string required
save_as string
anim_reference

How K3 Studio's animations (.k3anim) are written: base animations, keys turning bones on top of them (degrees about each bone's own axes), the bone names and tags, loop / once / upper body, and the workflow. Read it before making or changing an animation.

anim_find_base

Finds the game's own animations to start one from: query lists the animation dictionaries whose names hold every word (idle, sit, hug, hold, wave, lean, phone...); dict lists that dictionary's clips and their lengths. Use the result as base \"game:<dict>\" and base_clip.

query string
dict string
anim_edit

Changes an animation (path to a .k3anim: a new path makes one; or the open one) op by op: ops is a list of {op: set | key | reach | hold_add | hold_set | hold_fit | grip | grip_all | hold_remove | hand_pose | mirror | copy_key | clear_bone | delete_key | clear_keys}. set changes name, length, fps, base, base_clip, once, walk, still, for_prop, prop; key turns bones at a time (made when there's no key there); reach puts a hand at a point ([right, forward, up] metres from the ground between the feet) by turning its arm, the easiest way to pose arms; hold_add attaches a prop to a hand, hold_fit puts it between the palms, grip puts the palms on its sides. Saves and answers with the keys.

path string
ops array required
anim_inspect

Lists an animation (path, or the open one): name, length, fps, base and its clip, how it plays, and every key with the bones it turns.

path string
anim_look

Shows you an animation's 3D preview: the game's freemode ped posed at time (seconds), from view (front, back, left, right or top: the ped's own sides) or yaw / pitch (degrees), optionally zoom (2 = twice as close), focus (the camera aims at it: a bone, e.g. \"Right hand\" or \"SKEL_R_Finger11\", or \"prop\" for the first held prop; use it with zoom 3-6 for close-ups of fingers on a prop) and bone (selected, outlined). Look at the start, the middle and the end, from the front and the side.

path string
time number
view "front" | "back" | "left" | "right" | "top"
yaw number
pitch number
zoom number
focus string
bone string
anim_game_check

Measures the animation the game is playing (run anim_play first) at time: pauses it there, then for each held prop the distance from each holding palm to the prop's hand point and which way its front and top face, and each palm's distance to the chest, beside what the preview says, each line OK or OFF. A hold isn't done until this says everything matches; game_screenshot shows the paused moment, anim_stop ends it.

path string
time number
anim_snippet

Writes an animation (path, or the open one) as the text a script takes, from a template: format lua, json, rpemotes (dpemotes / rpemotes entries), scully_emotemenu, ox_inventory_item (an item using client.anim and client.prop) or play_function (a Lua function that plays it with its props attached), or any template the workspace has in .k3studio/templates/animation/<name>.txt (placeholders {{name}} {{dict}} {{clip}} {{label}} {{flags}} {{loop}} {{move}} {{length_ms}}, and per held prop between {{#props}} and {{/props}}: {{model}} {{bone}} {{x}} {{y}} {{z}} {{rx}} {{ry}} {{rz}} {{index}}, {{#first}}...{{/first}}, {{#rest}}...{{/rest}}). Answers with the text; with out it's also written there. Export the animation too (anim_export) so the clip exists.

path string
format string required
out string
anim_ray

Casts a ray in an animation's preview (path, or the open one) at time and lists what it meets, nearest first: either ped's body part (head, chest, a forearm, a hand...) or a held prop, with the distance and the point in ped A's terms ([right, forward, up] metres from the ground between its feet). from: a point, or from_joint (an anim_joints label, from_of b for ped B's); dir: a direction, or to / to_joint (to_of b) to aim at a point. Use it to measure gaps (palm to prop, prop to chest, ped to ped) and to find what's in the way, without the game.

path string
time number
from array
from_joint string
from_of string
dir array
to array
to_joint string
to_of string
anim_joints

Where the ped's main joints are at time (seconds) in an animation (path, or the open one): head, neck, chest, pelvis, shoulders, elbows, hands, knees and feet, in metres [right, forward, up] from the ground between its feet. With held props: each one's middle, front and up directions, size, the gap from each palm to its side, and its AttachEntityToEntity line; then the clashes: arms, hands or props more than 2 cm into a body, and two peds overlapping. Use it to check a pose by numbers and to pick points for anim_edit's reach op.

path string
time number
anim_export

Exports an animation (path, or the open one) to <resource>/stream/<name>.ycd and restarts the resource when the server runs.

path string
anim_play

Exports an animation (path, or the open one) and plays it in the game: on the player (loops unless once; walk plays the upper body only), or for a prop animation on that prop spawned 2 m in front. Answers with the game's reply; game_screenshot to see it, anim_stop to end it.

path string
anim_stop

Stops the animation anim_play started: the player's tasks are cleared, or the prop it played on is taken away.

weapon_reference

How K3 Studio's weapons (.k3weapon) are written: a copy of one of the game's weapons with its own name, numbers, sounds, effects and animations; the CWeaponInfo fields worth changing, and the workflow (export, rejoin, try). Read it before making or changing a weapon.

weapon_edit

Changes a weapon (path to a .k3weapon: a new path makes a copy of base, default WEAPON_PISTOL; or the open one) op by op: ops is a list of {op: set | base | set_field | reset_field | add_anim | remove_anim | add_to_ox_inventory}. add_anim makes the .k3anim replacing one of the base's clips (then anim_edit it). Saves and answers with the weapon.

path string
base string
ops array required
weapon_inspect

Lists a weapon (path, or the open one): name, label, base, model, numbers, every CWeaponInfo field worth changing with its value (set here or the base's) and the values the game's weapons use for sounds and effects, its animations and the base's clips it can replace.

path string
weapon_export

Exports a weapon (path, or the open one) into its resource: weapon metas, clip set, animations, sound and manifest lines, and restarts the resource. The game reads weapons when it joins: game_restart before weapon_try.

path string
weapon_try

Tries a weapon (path, or the open one) in the game: mode give (to the player), hold, aim or shoot (a ped in front of the player does it, away from them) or stop (that ped goes). Answers with the game's reply; game_screenshot to see it.

path string
mode "give" | "hold" | "aim" | "shoot" | "stop" required
addon_scan

Shows what a folder of model files would become as an add-on resource: kind vehicle (.yft, .ytd, metas), ped (.yft, .ydd, .ytd, .ymt) or clothing (.ydd and .ytd for the freemode peds: each item with its guessed slot and textures). Nothing is written.

kind "vehicle" | "ped" | "clothing" required
folder string required
female boolean
addon_pack

Makes an add-on resource from a folder of model files, as Create > Add-on vehicle / Add-on ped / Clothing do: models into stream/, metas found beside them into data/ with their data_file lines, the missing ones written (vehicles.meta, handling.meta, carvariations.meta for cars by class; peds.meta for peds), clothes renamed and numbered with their shop metas. name: the resource (default the folder's name); vehicles: display, maker, class, sound (a game car's engine); peds and clothing: female; clothing: slots {model file: slot} and female_items [model files]; dest: the folder to put it in (default the server's [cars] / [peds] / [clothes] category); ensure (default true) adds it to the cfg.

kind "vehicle" | "ped" | "clothing" required
folder string required
name string
display string
maker string
class string
sound string
female boolean
slots object
female_items array
dest string
ensure boolean
stream_report

What a resource streams (resource: its folder): each file's memory against FiveM's limits (a warning past 16 MiB, models may stop loading past 48), the total, files named like the game's own models or animations (they replace them everywhere), and textures over 1024 px worth shrinking with texture_edit. Run it before handing a stream resource over.

resource string required
stream_reference

How FiveM streams GTA V assets: the stream/ folder (names, replace vs add-on, the 16 / 48 MiB memory limits), every file type (.ydr .ydd .yft .ytd .ybn .ymap .ytyp .ycd .ynv .ymt ...), data_file kinds, add-on cars, peds and clothing naming, maps and MLO rules, why assets go invisible, untextured or crash, and tutorial links. Read it before making, renaming or packing any streamed file.

picture_reference

How picture_make draws: every op (fill, gradient, svg shapes, text with fonts and rotation, tileable noise, the creators' patterns, wear, image, blur, grain, adjust, tint, vignette) and tips for realistic pictures. Read it before drawing a picture.

picture_make

Draws a PNG (path relative to the workspace; drawn on if it exists, else new at width x height) op by op and shows it to you: ops is a list of {op: fill | gradient | svg | text | noise | pattern | wear | image | blur | grain | adjust | tint | vignette, ...} (picture_reference has their fields). Use it for every material picture, sign, poster, label or decal instead of writing image scripts in Python. No ops: just shows the picture.

path string required
width integer
height integer
new boolean
ops array
k3studio_screenshot

Shows you K3 Studio as the user sees it right now: region 'window' (default), 'editor' (the open file's editor) or 'viewport' (the 3D view of the open prop, shell, map or interior editor). editor and viewport are drawn for you without changing what the user sees. Use it to check what an edit looks like.

region "window" | "editor" | "viewport"
preview

Shows the user what you made: a web address or .html file opens in their browser; any other file opens in K3 Studio (markdown rendered, pictures, props and shells in 3D), at line if given.

target string required
line integer

Database

db_query

Runs a read-only SQL statement (SELECT, SHOW, DESCRIBE, EXPLAIN) on the server's database; returns tab-separated rows.

sql string required
db_execute

Runs a SQL statement that changes data or schema (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) on the server's database; K3 Studio asks the user first unless they approve automatically.

sql string required

Game

game_state

The player's position, heading, street, zone, vehicle, interior, health (GTA counts from 100: 200 is full), armour and whether they're dead. Check it before acting: a dead player can't move, and teleport, walk_to, press, spawn_vehicle and ped_model are refused until game_do heal revives them.

game_do

What the Game panel's buttons do: heal (revives a dead player, through the server's ambulance job when there is one), god / invisible / noclip (on), fix_vehicle, max_vehicle, enter_vehicle (the nearest within 15 m, walking to its door: the driver's seat when free; check with game_state), leave_vehicle, give_weapon (name, e.g. WEAPON_PISTOL), ped_model (name: a ped model only, health and armour kept), time (hour 0-23, freeze), weather (name: EXTRASUNNY CLEAR CLOUDS OVERCAST RAIN THUNDER FOGGY SNOW XMAS HALLOWEEN). Turn off what you turned on (god, invisible, noclip) when you're done.

action "heal" | "god" | "invisible" | "noclip" | "fix_vehicle" | "max_vehicle" | "enter_vehicle" | "leave_vehicle" | "give_weapon" | "ped_model" | "time" | "weather" required
on boolean
name string
hour integer
freeze boolean
game_players

Every connected player: id, name, ping and position.

game_teleport

Moves the player (and their vehicle) to x, y, z, optionally facing heading.

x number required
y number required
z number required
heading number
game_spawn_vehicle

Spawns a vehicle by model name (e.g. 'adder') and puts the player in it.

model string required
game_collision

Tells whether a prop in the game collides: 32 rays through the nearest object of model (within 30 m; a name or hash), else the one the player aims at, across its box from two sides, counting the ones that hit it. A shape test sees only collision: 0 hits means a player walks through it (an exported prop without collision, or one the game hasn't given it yet).

model string
game_aim

Points the weapon the player holds at x, y, z for ms (default 1500) like a player aiming, or with shoot fires at it for that long; returns at once with the weapon and its ammo (read game_state or game_eval after). Refused when the player holds no weapon.

x number required
y number required
z number required
ms integer
shoot boolean
game_walk_to

Sends the player to x, y, z like a person would: on foot along the navmesh (run: running) or driving when in a vehicle, so zones and markers on the way trigger (game_teleport skips them). Returns at once with the distance; check arrival with game_wait_for or game_state.

x number required
y number required
z number required
run boolean
game_press

Holds a game control down for ms (default 100, max 5000), as if the player pressed it: an id (38) or name (INPUT_PICKUP) from FiveM's controls list.

control string required
ms integer
game_entities

Objects, vehicles and peds within radius metres of the player (default 30), nearest first: handle, kind, model hash and name, distance, position, networked, the script that made it. Check it after spawning something and before the player goes near a prop that may crash the game.

radius number
game_delete

Deletes an entity near the player before it crashes the game: one by handle (from game_entities), or every one of a model (name or hash) within radius (default 30). Never the player, other players or their vehicle. Returns how many were found and deleted.

handle integer
model string
radius number
game_restart

Closes FiveM (a crashed or hung game too) and starts it again: it joins the server 20 s after closing, as FiveM can't take a new start sooner, then loads for a minute or so. Use it when the game crashed, froze or stopped answering.

game_screenshot

Shows you what FiveM's window shows right now (the picture comes with the answer, also saved as a PNG whose path is given). K3 Studio brings the game on screen first (in the Agents layout, beside the conversation; else the FiveM tab) and says what it switched.

game_wait_for

Re-evaluates a Lua condition in the game (side 'server': on the server) every 100 ms until it's truthy, up to timeout_ms (default 5000, max 30000). Returns its value or 'timed out'.

code string required
side "game" | "server"
timeout_ms integer
game_eval

Runs Lua to test something and returns its value and what it printed (errors with their stack): side 'game' runs in the player's client, 'server' on the server. An expression or statements. Wait() works: the call waits timeout_ms for the answer (default 5000, up to 60000; raise it for code that Waits). Code that runs 2 s without a Wait is stopped, because it would freeze the game: put Wait(0) in long loops.

code string required
side "game" | "server"
timeout_ms integer

Stream assets

creator_reference

How K3 Studio's props (.k3prop) and shells (.k3shell) are written: every shape, field and unit, how pictures wrap on round shapes (labels), and the workflow. Read it before making or changing one.

creator_look

Shows you a prop or shell in K3 Studio's 3D editor (opens path if given), framed, from yaw (degrees around, 0 looks north) and pitch (degrees up), optionally zoom (2 = twice as close). After each change look from every side (yaw 0, 90, 180, 270, above, below) and fix what's wrong before calling it done.

path string
yaw number
pitch number
zoom number
creator_edit

Changes a prop or shell (path, or the open one) step by step like Blender's operators: ops is a list of {op: add_part | set | duplicate | delete_part | add_modifier | remove_modifier | add_material | set_material | set_prop, ...}; a shell also takes add_room | set_room | duplicate_room | delete_room | add_opening | set_opening | delete_opening | set_surface | set_shell (rooms by index or name, z for storeys) and its parts are details inside; a part is its index or name; set and duplicate take fields (only those change). Modifiers: Subdivide Twist Bend Taper Noise Wave Inflate Spherize Array Mirror Smooth Flat Solidify Wireframe Shear Jitter Terrace Relax Displace (creator_reference has their fields). One undo step; saves; answers with every part's triangles and bounds.

path string
ops array required
creator_inspect

Lists a prop's parts (or a shell's rooms, doors, windows and details; path, or the open one) as K3 Studio builds them: each part's index, shape, material, triangle count and world bounds in metres, plus the whole prop's. Use it to line parts up exactly and to check a Mesh or Model came out (an unreadable .obj shows as a box).

path string
creator_export

Exports a prop or shell (path, or the open one) to the game: stream/<name>.ydr and .ytyp beside it, the .ytyp added to fxmanifest.lua, and the resource ensured when the server runs.

path string
creator_spawn

Exports a prop or shell like creator_export, then puts one in front of the player in the running game (a shell high above with the player inside) so you can game_screenshot it.

path string
creator_icon

Makes a prop's icon (an inventory picture) without a script or a picture editor: the .k3prop (path) drawn on its own, a square PNG of size pixels (default 256) with a transparent background, cropped to the prop and centred with margin (default 0.08 of the side), seen from yaw / pitch (default 35, 20). Written to out (relative to the workspace), or with item into ox_inventory's web/images/<item>.png, else beside the .k3prop; the picture comes back to check. With folder instead of path: every .k3prop under it, each named after its model, into out_dir or ox_inventory's images.

path string
folder string
out_dir string
out string
item string
size integer
yaw number
pitch number
margin number
map_reference

How K3 Studio's maps (.ymap) are edited: what a prop (entity) and a parked car (car generator) hold, units and headings, every map_edit op (patterns: row, grid, circle, scatter) and the workflow. Read it before building a map.

map_inspect

Lists a map (path, or the open one): every prop with its index, model, position, rotation, scale, lod distance, lod level and flags; every parked car with model, position, heading and length; where the items span and the saved extents.

path string
map_edit

Changes a map (path, or the open one; a new .ymap path makes an empty map) op by op: ops is a list of {op: add_prop | set | duplicate | delete | add_car | set_car | delete_car | row | grid | circle | scatter, ...}; props and cars by index (map_inspect); set and duplicate take fields (only those change). One undo step; saves (the resource restarts when the server runs); answers with the map as map_inspect does.

path string
ops array required
map_look

Shows you a map in K3 Studio's 3D editor (opens path if given), framed on the whole map or on prop index, from yaw (degrees around, 0 looks north) and pitch (degrees up), optionally zoom (2 = twice as close). Props show as blocks the size the game measured (1 m blocks until the game has measured them).

path string
index integer
yaw number
pitch number
zoom number
interior_reference

How archetype files (.ytyp) and interiors (MLOs) work: archetypes, rooms, portals, entities, entity sets, their fields and units, and every interior_edit op. Read it before making or changing an interior.

interior_inspect

Lists a .ytyp (path, or the open one): every archetype with its kind, lod distance and bounds; for the selected interior (archetype: index or name) every room with its box, portals with their rooms and corners, props with model, room, position and heading, and entity sets with their props.

path string
archetype
interior_edit

Changes a .ytyp (path: a new name makes an interior; or the open one) step by step: ops is a list of {op: select | add_archetype | add_interior | set_archetype | delete_archetype | add_room | set_room | delete_room | add_portal | set_portal | delete_portal | add_entity | set_entity | delete_entity | array | sort_into_rooms | add_set | rename_set | delete_set, ...} on the selected interior (archetype: index or name). add_portal between two touching rooms places a doorway on their shared wall; add_room with around fits a room to props. interior_reference has every op's fields. One undo step; saves; answers with the listing.

path string
archetype
ops array required
interior_from_building

Gives a building that already stands in the game world an enterable interior: the game names it (from aimed: the crosshair; nearest: the nearest map object; model: model plus pos and heading, or CodeWalker's rotation [x,y,z,w]) and measures it; the .ytyp's interior (path: a new name makes one; else the open .ytyp; archetype, else a new one) gets a room fitted inside it with a doorway on the wall facing the player (or wall), and a .ymap beside the .ytyp places it at the building's exact position and rotation; the manifest asks for the .ytyp. hide: a client script hides the original building; exterior: its model in the interior as the outside. interior_reference explains what GTA allows (a building's collision stays). Saves; answers with the listing.

path string
archetype
from "aimed" | "nearest" | "model"
model string
pos array
heading number
rotation array
radius number
inset number
floor number
height number
wall "north" | "east" | "south" | "west"
hide boolean
exterior boolean
interior_look

Shows you an interior (or a prop archetype's bounds) in K3 Studio's 3D interior editor (opens path if given; archetype: index or name), framed, from yaw (degrees around, 0 looks north) and pitch (degrees up, default 35), optionally zoom (2 = twice as close). Rooms are drawn from inside, so near walls fall away; portals are outlined.

path string
archetype
yaw number
pitch number
zoom number
livery_reference

How K3 Studio's livery painter works: layer kinds (fills, stripes, pictures, text, brush strokes, gradients, stripe / checker / carbon patterns), their fields and units, effects (outline, shadow, blur, grain, blend modes) and the workflow. Read it before painting a livery.

livery_inspect

Opens the livery painter on a texture of a .ytd (path, texture: name or index; or the one open) and lists its layers, bottom first: kind, position, size, rotation, colours, picture, effects.

path string
texture string,integer
livery_edit

Paints a livery (path to the .ytd and texture, or the open painter) layer by layer: ops is a list of {op: add | set | duplicate | delete | move | clear | base, ...}; a layer is its index (bottom first, -1 the top); add takes layer {kind, fields}, set and duplicate take fields (only those change). Kinds: Fill Rect Picture Text Brush Gradient Stripes Checker Carbon (livery_reference has their fields). One undo step; bakes into the texture and saves the .ytd; answers with the layers.

path string
texture string,integer
ops array required
livery_look

Shows you the painted livery: view 'texture' (default) is the flat painting; 'car' is the painter with the car model beside the .ytd wearing it, turned to yaw / pitch (degrees). Look after every livery_edit.

path string
texture string,integer
view "texture" | "car"
yaw number
pitch number
livery_export

Writes the painting at full size as a PNG (png, relative to the workspace; default <texture>.png next to the .ytd), e.g. as a template to share. livery_edit already saves it into the .ytd.

path string
texture string,integer
png string
texture_inspect

Lists a texture dictionary's textures (path to a .ytd, or the open one): index, name, size, format, mip levels, bytes.

path string
texture_edit

Changes a texture dictionary (path to a .ytd, made if missing, or the open one) op by op: ops is a list of {op: add | new | replace | rename | delete | resize | format | mips | flip | adjust | blur | noise | tint | normal_map, texture: index or name, ...}. add / replace take picture (a file, relative to the workspace); new takes name, width, height, color; format DXT1 | DXT5 | A8R8G8B8; adjust brightness, contrast, saturation (-1..1), hue (degrees); normal_map makes a new texture from one's brightness. One undo step; saves; answers with the textures.

path string
ops array required
texture_look

Shows you a texture of a .ytd (path, or the open one) as a picture: texture by index or name (default the selected one), level a mip level (0 the largest).

path string
texture string,integer
level integer
k3studio › README.md Fun factIdles at about 0% CPU: it only draws when something changes Markdown qbx-lua-ls

Click or press Esc to close