set_event_property
Assign a value to a scalar property (like volume or pitch) on a specified FMOD event by providing the event path, property name, and value.
Instructions
Set a scalar property on an event (volume, pitch, etc.).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| event_path | Yes | ||
| property_name | Yes | ||
| value | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- fmod_mcp/tools/events.py:124-137 (handler)Core handler that builds a JavaScript snippet to look up the event, set a property by name, and return the result via StudioClient.eval().
async def set_event_property( client: StudioClient, event_path: str, property_name: str, value: Any, ) -> dict[str, Any]: """Set a property on an event (volume, pitch, min/max distance, etc.).""" js = f""" var evt = studio.project.lookup({json.dumps(event_path)}); if (!evt) throw new Error("Event not found: " + {json.dumps(event_path)}); evt[{json.dumps(property_name)}] = {json.dumps(value)}; return {{ ok: true, path: evt.getPath(), property: {json.dumps(property_name)}, value: evt[{json.dumps(property_name)}] }}; """ return await client.eval(js) - fmod_mcp/server.py:110-117 (registration)Registers the tool with FastMCP via @mcp.tool() decorator and delegates to events.set_event_property.
@mcp.tool() async def set_event_property( event_path: str, property_name: str, value: Any, ) -> dict[str, Any]: """Set a scalar property on an event (volume, pitch, etc.).""" return await events.set_event_property(_studio(), event_path, property_name, value) - tests/test_tools.py:148-155 (helper)Test verifying that set_event_property correctly serializes the property name and value into the JavaScript sent to FMOD Studio.
async def test_set_event_property_serializes_value( client: StudioClient, mock_studio: MockStudio ): mock_studio.responder = responder_sequence([("OK", {"ok": True})]) await events.set_event_property(client, "event:/a", "volume", -3.0) js = _last_sent_js(mock_studio) assert '"volume"' in js assert "-3.0" in js