Skip to main content
Glama

run_js

Evaluate JavaScript code within FMOD Studio's scripting terminal to control audio import, event creation, and bank building. Use return to output results.

Instructions

Evaluate arbitrary JavaScript in the Studio scripting terminal.

Your snippet is wrapped in an IIFE, so use return to surface a value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • MCP tool registration for 'run_js' — the @mcp.tool() decorator registers it as an MCP tool. The handler delegates to escape.run_js().
    @mcp.tool()
    async def run_js(code: str) -> Any:
        """Evaluate arbitrary JavaScript in the Studio scripting terminal.
    
        Your snippet is wrapped in an IIFE, so use `return` to surface a value.
        """
        return await escape.run_js(_studio(), code)
  • Core handler implementation — async function that evaluates arbitrary JavaScript via client.eval(code).
    async def run_js(client: StudioClient, code: str) -> Any:
        """Evaluate a raw JavaScript snippet.
    
        The snippet must use ``return`` to surface its value — it is wrapped in an
        IIFE before being sent to Studio.
        """
        return await client.eval(code)
  • Test expectation confirming 'run_js' is registered as a tool.
        # escape
        "run_js",
    }
  • Unit test for run_js — verifies the code string is passed through to the client and the result is returned.
    async def test_run_js_passes_code_through(
        client: StudioClient, mock_studio: MockStudio
    ):
        mock_studio.responder = responder_sequence([("OK", 99)])
        result = await escape.run_js(client, "return 99;")
        assert result == 99
        assert "return 99;" in _last_sent_js(mock_studio)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Explains the IIFE wrapping and return requirement, adding key behavioral detail beyond the bare description. However, does not disclose potential side effects of arbitrary code execution.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two focused sentences with front-loaded purpose. No redundant words. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately covers the single parameter's usage and behavioral nuance (IIFE). For a simple tool with no output schema, this provides sufficient context. Missing error handling or security notes, but not critically needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Adds meaning to the 'code' parameter by explaining the IIFE wrapping and need to use return, which is not evident from the schema alone. Schema coverage is 0%, so description compensates well.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it evaluates JavaScript in the Studio scripting terminal, with specific verb and resource. Distinguishes from siblings which all deal with audio/sound operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for running JS code, but lacks explicit when-to-use or exclusion hints. No alternatives mentioned, though siblings are distinct.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jmperez127/fmod-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server