import_audio
Import a local .wav or .ogg file into your FMOD project's audio bin. Specify the file path to add audio assets directly from your local system.
Instructions
Import a local .wav/.ogg into the project's audio bin.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- fmod_mcp/tools/audio.py:10-26 (handler)Core handler: imports an audio file into FMOD's audio bin by executing JavaScript (studio.project.importAudioFile) via the StudioClient, returning the asset's guid, name, and length.
async def import_audio(client: StudioClient, file_path: str) -> dict[str, Any]: """Import a local audio file into the project's audio bin. ``studio.project.importAudioFile`` imports to the root of the bin; callers can move the asset afterwards if they want it organized into subfolders. Returns the new ``AudioFile`` asset's guid and length (seconds). """ js = f""" var asset = studio.project.importAudioFile({json.dumps(file_path)}); if (!asset) throw new Error("FMOD refused to import: " + {json.dumps(file_path)}); return {{ guid: asset.id, name: asset.name || null, length: (typeof asset.length !== 'undefined') ? asset.length : null }}; """ return await client.eval(js) - fmod_mcp/server.py:68-71 (registration)Registration: the @mcp.tool() decorator registers 'import_audio' on the FastMCP server, exposing it as an MCP tool.
@mcp.tool() async def import_audio(file_path: str) -> dict[str, Any]: """Import a local .wav/.ogg into the project's audio bin.""" return await audio.import_audio(_studio(), file_path) - tests/test_server_registration.py:14-14 (registration)Test confirming 'import_audio' is in the set of expected registered tool names.
"import_audio", - tests/test_tools.py:80-87 (helper)Unit test verifying import_audio sends the absolute file path in the JavaScript call.
async def test_import_audio_sends_absolute_path( client: StudioClient, mock_studio: MockStudio ): mock_studio.responder = responder_sequence([("OK", {"guid": "x", "name": "a.wav", "length": 1.5})]) await audio.import_audio(client, "/tmp/a.wav") js = _last_sent_js(mock_studio) assert "studio.project.importAudioFile" in js assert '"/tmp/a.wav"' in js