Skip to content

code

code

MCP tools for code execution inside Houdini.

Exposes 4 tools for running Python code, HScript commands, evaluating expressions, and reading Houdini environment variables.

Functions:

Name Description
evaluate_expression

Evaluate an expression in Houdini and return its result.

execute_hscript

Execute an HScript command in Houdini.

execute_python

Execute arbitrary Python code inside Houdini. LAST RESORT only.

get_env_variable

Get a Houdini environment variable value.

get_file_references

Every file path the scene references, with the parameter holding it and whether it exists.

reload_plugin

Re-import the plugin's Houdini-side code without restarting Houdini.

set_update_mode

Set Houdini's cook update mode, or read it when called with no mode.

Functions:

evaluate_expression async

evaluate_expression(
    ctx: Context, expression: str, language: str = "hscript"
) -> dict

Evaluate an expression in Houdini and return its result.

Parameters:

Name Type Description Default
expression
str

Expression string to evaluate.

required
language
str

Expression language, "hscript" or "python".

'hscript'

execute_hscript async

execute_hscript(ctx: Context, command: str) -> dict

Execute an HScript command in Houdini.

Parameters:

Name Type Description Default
command
str

HScript command string to execute.

required

execute_python async

execute_python(
    ctx: Context,
    code: str,
    justification: str,
    return_expression: str | None = None,
) -> dict

Execute arbitrary Python code inside Houdini. LAST RESORT only.

DO NOT use this to: - Create nodes or networks → use build_network or create_node - Set parameters → use set_parameter or set_parameters - Create wrangles or write Python SOPs → use create_wrangle - Connect nodes → use connect_nodes or connect_nodes_batch - Read geometry → use get_geometry_info, get_points, sample_geometry

ONLY use this when no dedicated tool exists for the operation — i.e. hou.* API calls or Python-level state that no other tool exposes. The justification parameter is mandatory: name the dedicated tools you considered and why none covers this operation.

Parameters:

Name Type Description Default
code
str

Python source code to execute.

required
justification
str

Which dedicated tools you considered and why none covers this operation.

required
return_expression
str | None

Python expression to evaluate after execution.

None

get_env_variable async

get_env_variable(ctx: Context, var_name: str) -> dict

Get a Houdini environment variable value.

Parameters:

Name Type Description Default
var_name
str

Name of the environment variable.

required

get_file_references async

get_file_references(ctx: Context, include_missing_only: bool = False) -> dict

Every file path the scene references, with the parameter holding it and whether it exists.

Parameters:

Name Type Description Default
ctx
Context

MCP context.

required
include_missing_only
bool

Only report paths that are missing on disk.

False

reload_plugin async

reload_plugin(ctx: Context) -> dict

Re-import the plugin's Houdini-side code without restarting Houdini.

For developing this server: after editing its handlers, this picks the edit up in the running session. The MCP server's own tool definitions are not reloaded; the client has to reconnect for those.

set_update_mode async

set_update_mode(ctx: Context, mode: str | None = None) -> dict

Set Houdini's cook update mode, or read it when called with no mode.

"manual" before a long build stops every parameter change from re-cooking; set "auto" back afterwards.

Parameters:

Name Type Description Default
ctx
Context

MCP context.

required
mode
str | None

"auto", "on_mouse_up" or "manual". Omit to read.

None