BlenderLens

v0.2.0
io.github.pzalutski-pixel/blenderlens Checked 3 days ago Published 1 month ago

MCP server that lets AI agents build, check, preview and export game assets in Blender

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_status Get Status

Report the attached Blender without starting one. Returns: the session (busy: what it runs), add-on, Blender, render_dir, recovery copies. WHEN TO CALL: first; after not_connected, connection_lost, busy.

open_session Open Session

Attach to the live Blender window or start a background one. Returns: the session. WHEN TO CALL: to pick a mode or file; else the first call attaches by BLENDERLENS_MODE.

ParameterTypeDescription
discardbooleanAllow losing unsaved or busy work
filestring.blend to open
modestringauto (default): live if the add-on replies

close_session Close Session

Disconnect: a background Blender exits, a live one stays open. Returns: the mode closed. WHEN TO CALL: when the work is saved.

ParameterTypeDescription
discardbooleanAllow losing unsaved or busy work

get_scene Get Scene

Read the scene. Returns: file state, units, and each object's type, parent, location, dimensions, counts, materials, modifiers. WHEN TO CALL: before building; after not_found.

get_object Get Object

Read one object in full. Returns: transform, bounds, properties, counts before and after modifiers, modifier settings by Blender's names, slots. WHEN TO CALL: before set_modifier.

ParameterTypeDescription
object *stringName

get_mesh Get Mesh

List a mesh's faces. Returns: each face's index, center, normal, side, area, material slot. WHEN TO CALL: for face indices; again after faces change.

ParameterTypeDescription
object *stringName
evaluatedbooleanAfter modifiers
include_verticesbooleanList vertices too
limitintegerDefault 200
materialinteger | stringIts faces only: slot or name
spacestringDefault world

list_materials List Materials

List materials. Returns: each one's values (linear, as glTF) and users. WHEN TO CALL: before set_material, to reuse one.

check_asset Check Asset

Check meshes as exported: topology, normals, scale, origin, UVs, textures, morphs, overlaps; and a project's rules or rules_file (the guide lists the keys). Returns: passed; per object stats, issues {code, severity, count, faces}. WHEN TO CALL: before export_glb.

ParameterTypeDescription
budgetintegerTotal triangle limit
evaluatedbooleanAfter modifiers (true)
objectsarrayWith children (default: all export_glb writes)
rulesobjectThe project's rules
rules_filestringRules as a .json file

measure_objects Measure Objects

Measure between objects' surfaces as exported, in world space, or cast a ray. Returns: per pair distance, closest points, touching, overlapping, overlap_faces, inside; ray object, location, normal, face. WHEN TO CALL: to fit parts, find gaps.

ParameterTypeDescription
directionRay, world
objectsarray2 to 16; a ray may hit only these
originarrayRay start

create_object Create Object

Add a primitive (tube, lathe and text too) or an empty, sized in the mesh so scale stays 1. Returns: its name (.001 on a clash), transform, counts. WHEN TO CALL: to start a part.

ParameterTypeDescription
kind *stringempty has no mesh
bevel_resolutionintegertube: 4+2n sides (2)
collectionstringCreated if missing
depthnumberCylinder, cone height (2)
extrudenumbertext depth (size/10)
fillbooleanCaps (true; circle: false)
locationarrayMetres
minor_radiusnumberTorus tube (0.25)
namestringDefault from kind
parentstringlocation relative to it
pointsarraytube path, mesh space
profilearraylathe: [radius, z] about Z
radiusnumberDefault 1; tube 0.05
radius_topnumberCone top (0)
ringsintegeruv_sphere 16, torus 12
rotationarrayDegrees
scaleDefault 1
segmentsintegerDefault 32, torus 48
sizecube edges (2); plane, grid [x, y]; monkey, empty, text: a number
smoothbooleantube: curved (true) or straight
subdivisionsintegerico_sphere 2, grid 10
textstringIts words

create_mesh Create Mesh

Build a mesh object from vertices and faces in its own space. Returns: as create_object. WHEN TO CALL: for a shape no primitive gives.

ParameterTypeDescription
name *stringObject and mesh
vertices *arrayMetres
collectionstringCreated if missing
edgesarrayLoose edges
facesarrayVertex indices around each
locationarrayMetres
parentstringlocation relative to it
recalc_normalsbooleanOutward (default true)
rotationarrayDegrees
scaleDefault 1

edit_mesh Edit Mesh

Run one operation on the faces picked (faces, facing) or all. bevel: the picked faces' rim edges (all edges if all faces), or with angle the edges sharper than it. amount, offset, pivot: mesh space. Returns: result_faces (extrude: the cap; inset: inner faces), counts. WHEN TO CALL: to shape a primitive.

ParameterTypeDescription
object *stringName
operation *stringWhat to do
amountnumberextrude distance, inset border, bevel width, merge distance, solidify thickness (inward)
anglenumberDegrees: sharper edges stay sharp (shade_smooth), bevel, seam (30); dissolve_planar (5)
cutsintegersubdivide (1)
depthnumberinset: in (-) or out
directionextrude this way; bisect plane normal (world)
facesarrayIndices from get_mesh
facingWorld direction
factorscale by
fillbooleanbisect: cap the cut (true)
individualbooleaninset each face alone
keepstringbisect: side kept (below)
offsetarraytranslate by
pivotarrayscale, rotate about; bisect plane point (default center)
rotationarrayrotate by, degrees
segmentsintegerbevel (1)
tolerancenumberDegrees off facing (30)

add_modifier Add Modifier

Add a modifier to an object's stack. Returns: its settings, the stack, counts. WHEN TO CALL: for detail that stays editable.

ParameterTypeDescription
object *stringName
type *stringbevel, array, boolean, subdivision, mirror, solidify...
namestringDefault from type
settingsobjectBlender's names (width, count, levels, operation...); objects by name

set_modifier Set Modifier

Change a modifier's settings, place or visibility. Returns: as add_modifier. WHEN TO CALL: to tune one.

ParameterTypeDescription
modifier *stringName
object *stringName
indexintegerStack position, 0 first
settingsobjectBy Blender's property names
showbooleanIn viewport and render

apply_modifier Apply Modifier

Bake a modifier into the mesh; refused for a shared mesh or in edit mode. Returns: the stack, counts. WHEN TO CALL: when edit_mesh must see its result.

ParameterTypeDescription
modifier *stringName
object *stringName

remove_modifier Remove Modifier

Remove a modifier unapplied. Returns: the stack left, counts. WHEN TO CALL: to undo add_modifier.

ParameterTypeDescription
modifier *stringName
object *stringName

set_material Set Material

Create or update a material, optionally on an object or its picked faces; all its users change; '' clears an image or vertex_color. Returns: its values, slot, faces. WHEN TO CALL: after shaping.

ParameterTypeDescription
material *stringCreated if missing
alphanumberBelow 1 blends
alpha_cutoffnumberclip below (0.5)
alpha_modestringWith an image or vertex_color, their alpha
backface_cullingbooleanHide back faces (true for new)
base_color[r, g, b(, a)] linear, or '#RRGGBB' sRGB
base_color_imagestringImage file
emission_colorAlone sets strength 1
emission_imagestringImage file
emission_strengthnumberAbove 1 glows
facesarrayIndices from get_mesh
facingWorld direction
metallicnumber0 to 1
normal_imagestringImage file
objectstringMesh to put it on
roughnessnumber0 to 1
tolerancenumberDegrees off facing (30)
vertex_colorstringColor attribute as base colour

set_vertex_color Set Vertex Color

Paint the faces picked (faces, facing) or all into a color attribute. Returns: faces painted, materials wired, and not_wired (setups not BlenderLens's). WHEN TO CALL: for colour without textures; exports as COLOR_0.

ParameterTypeDescription
color *As base_color
object *stringName
attributestringDefault Col, made white
facesarrayIndices from get_mesh
facingWorld direction
tolerancenumberDegrees off facing (30)
use_in_materialbooleanWire into its materials (true)

unwrap_uv Unwrap UVs

Unwrap a mesh into a UV map; projections are packed. Returns: islands, area used, overlapping and out-of-bounds faces, texel density (px/m at 1024). WHEN TO CALL: before texturing or baking; unwrap needs seams (edit_mesh mark_seams).

ParameterTypeDescription
object *stringName
marginnumberBetween islands, to 0.1; lightmap to 0.01 (0.01)
methodstringDefault smart
uv_mapstringMade if missing (default active)

join_objects Join Objects

Join meshes into the first, keeping each piece's materials and faces. Returns: the object, slots and their faces. WHEN TO CALL: to make one part of pieces.

ParameterTypeDescription
objects *arrayThe first stays

set_transform Set Transform

Set an object's location, rotation, scale or dimensions; null keeps a component. Returns: the transform; after drop, landed_on and moved_by. WHEN TO CALL: to place parts.

ParameterTypeDescription
object *stringName
dimensionsarrayMetres, reached by scale
dropboolean | stringThen move along Z to rest on what is below, or on this object
locationarrayMetres, parent space
rotationarrayDegrees
scaleFactors

apply_transform Apply Transform

Bake rotation and scale into the mesh, or move its origin, mesh and children staying put; refused for a shared mesh or in edit mode. Returns: the transform. WHEN TO CALL: after scaling, before bevel or solidify.

ParameterTypeDescription
object *stringName
locationbooleanDefault false
originNew origin, or a world point
rotationbooleanDefault true; false with origin
scalebooleanDefault true; false with origin

set_parent Set Parent

Parent an object, or clear its parent. Returns: the transform. WHEN TO CALL: to assemble parts into one node tree.

ParameterTypeDescription
object *stringName
keep_transformbooleanKeep world position (true)
parentstring | nullnull clears

set_collection Set Collection

Move objects into a collection. Returns: their collections. WHEN TO CALL: to group parts.

ParameterTypeDescription
collection *stringCreated if missing
objects *arrayNames
keep_otherbooleanStay in others too
parentstringParent of a new one

set_object Set Object Properties

Rename or hide an object, or set its display or custom properties (exported as glTF extras). Returns: its state. WHEN TO CALL: to name, hide or tag parts.

ParameterTypeDescription
object *stringName
displaystringViewport
empty_displaystringAn empty's shape: ARROWS, CUBE, SPHERE...
hidebooleanViewport; export skips it
hide_renderbooleanRenders
propertiesobjectJSON values, 8 levels deep; null removes
renamestringNew name
rename_databooleanUnshared mesh too (default true)

duplicate_object Duplicate Object

Copy an object with modifiers, materials and children. Returns: the copies. WHEN TO CALL: for repeated parts.

ParameterTypeDescription
object *stringName
linkedbooleanShare the mesh
namestringFor the copy
offsetarrayMetres
with_childrenbooleanDefault true

delete_object Delete Objects

Delete objects and unused mesh data. Returns: the names deleted. WHEN TO CALL: to remove parts.

ParameterTypeDescription
objects *arrayNames
with_childrenbooleanElse they stay in place

export_glb Export glTF Binary

Write a .glb, Y-up (-Y front becomes +Z), for a target engine; what it cannot load is refused, as is edit mode. Returns: the file read back, with warnings for the target. WHEN TO CALL: to deliver.

ParameterTypeDescription
path *stringEnds in .glb
animationsbooleanDefault true
apply_modifiersbooleanDefault true
at_originbooleanRoots written at 0,0,0
camerasbooleanDefault false
clean_namesbooleanDrop .001 where unique (true for godot)
collectionstringIts objects
dracobooleanCompress meshes
extrasbooleanCustom properties (default true)
image_formatstringDefault auto
lightsbooleanDefault false
objectsarrayWith children (default all)
tangentsbooleanFor normal maps
targetstringDefault generic; threejs drops -colonly proxies
texcoordsbooleanUVs (default true)
vertex_colorsstringDefault material: those a material reads
visible_onlybooleanDefault true

import_file Import File

Import a .glb, .gltf, .obj, .fbx, .stl or .ply, or append from a .blend what is named. Returns: what it added. WHEN TO CALL: for a reference, or to check an export.

ParameterTypeDescription
path *stringFile
collectionstringFor what it adds
collectionsarray.blend
materialsarray.blend
objectsarray.blend: with children

save_file Save File

Save the open file. Returns: path, size. WHEN TO CALL: at milestones; before closing a background session.

ParameterTypeDescription
copybooleanA checkpoint; the open file keeps its path
pathstring.blend; default the last save

open_file Open File

Open a .blend in place of the open file. Returns: the scene. WHEN TO CALL: to resume work.

ParameterTypeDescription
path *string.blend
discardbooleanAllow losing unsaved changes

create_file Create File

Start a new, unsaved file in place of the open one. Returns: the scene. WHEN TO CALL: for a new model.

ParameterTypeDescription
discardbooleanAllow losing unsaved changes
emptybooleanDefault true; else Blender's default scene

render_preview Render Preview

Render a PNG of objects (and children) or all visible geometry, framed, others hidden, the scene unchanged. Returns: its path (open it, or inline). WHEN TO CALL: after each build step.

ParameterTypeDescription
azimuthnumberDegrees, front 0, right 90
contextarrayShown, not framed
elevationnumberDegrees up
enginestringDefault auto: cycles (CPU); eevee needs GPU
hide_from_cameraarrayUnseen, still casting shadows
inlinebooleanReturn the image too
lightingstringDefault studio
marginnumberFraming slack (1.1)
markersarrayReturn their pixels
objectsarrayDefault all visible
ortho_scalenumberMetres on long side
pathstring*.png, only over a PNG (default render_dir)
projectionstringDefault perspective
resolutionPixels (768)
samplesintegerDefault 32
stylestringclay, random use workbench
timeoutnumberSeconds (120)
transparentbooleanBackground
viewstringDefault three_quarter
viewsarraySeveral, in one PNG

animate_object Animate Object

Key an object's transform and shape keys into a named clip on an NLA track, exported as one glTF animation; a call replaces the object's keys in it. Returns: channels, frames, seconds, Godot warnings. WHEN TO CALL: for doors, rotors, morphs.

ParameterTypeDescription
clip *stringAnimation name, shared across objects
keys *array{frame, location, rotation (degrees), scale, shape_key: {name: value}}; null skips an axis
object *stringName
interpolationstringDefault linear
loopbooleanRepeat; default as Godot reads the name

create_collision Create Collision

Add a collision proxy over a mesh, wire-drawn and parented; named for Godot, three.js exports leave it out. Returns: its name, counts, closed, volume_ratio. WHEN TO CALL: for physics props.

ParameterTypeDescription
object *stringName
namingstringgodot (default): -colonly, convex -convcolonly; plain: _collision
rationumberdecimated: faces kept (0.25)
shapestringDefault convex

bake_texture Bake Texture

Bake a mesh's materials into a PNG through a UV map with Cycles (CPU), wired into them; render settings and selection are put back. Returns: path, size, seconds, image_driven channels. WHEN TO CALL: for procedural materials, AO.

ParameterTypeDescription
object *stringName
path *string*.png, only over a PNG
from_objectsarrayHigh-poly sources
samplesintegerDefault 32
sizeintegerPixels a side (1024)
timeoutnumberSeconds (120)
typestringDefault diffuse; ao multiplies base colour
use_in_materialbooleanDefault true
uv_mapstringDefault active

export_file Export File

Write FBX, OBJ, STL, PLY or USD (by extension), objects chosen as export_glb does; the file is read back in a scratch scene. Returns: path, bytes, read_back counts. WHEN TO CALL: for tools that take no glTF.

ParameterTypeDescription
path *string.fbx .obj .stl .ply .usd(a|c|z)
collectionstringIts objects
objectsarrayWith children (default all)
visible_onlybooleanDefault true

run_python Run Python

Run Python in Blender (bpy, bmesh, mathutils); names persist; set result to return it. Returns: stdout, stderr, result. WHEN TO CALL: only for what no tool covers.

ParameterTypeDescription
code *stringPython source
timeoutnumberSeconds (120)

run_script Run Script

Run a .py file in Blender as run_python does, with args; its folder, and parents up to a blenderlens.toml, are importable afresh each run. Returns: result, stdout, stderr, objects added, removed, changed. WHEN TO CALL: to build a model from its script.

ParameterTypeDescription
path *string.py file
argsobjectThe script's args
discardbooleanAllow losing unsaved changes
freshbooleanStart from an empty file
timeoutnumberSeconds (120)

undo_change Undo Change

Step back through undo steps, one per call that changed something; Python references go stale. Returns: steps undone, counts, unsaved_changes. WHEN TO CALL: to take back calls that went wrong.

ParameterTypeDescription
forcebooleanUndo steps whatever made them
listbooleanName the steps; undo none
stepsintegerDefault 1