Skip to main content
Glama

list_events

List FMOD events, filtered by path prefix such as 'event:/bumpers/', to retrieve events from specific folders.

Instructions

List events, optionally filtered by path prefix (e.g. 'event:/bumpers/').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
prefixNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of list_events: builds JavaScript that finds all Event instances, filters by prefix, and returns path/guid/name.
    async def list_events(client: StudioClient, prefix: str | None = None) -> list[dict[str, str]]:
        """List events, optionally filtered by path prefix (e.g. ``event:/bumpers/``)."""
        prefix_json = json.dumps(prefix) if prefix else "null"
        js = f"""
            var prefix = {prefix_json};
            return studio.project.model.Event.findInstances()
                .filter(function(e) {{ return e.isValid; }})
                .map(function(e) {{ return {{ path: e.getPath(), guid: e.id, name: e.name }}; }})
                .filter(function(e) {{ return prefix == null || e.path.indexOf(prefix) === 0; }});
        """
        return await client.eval(js)
  • MCP tool registration of 'list_events' via @mcp.tool() decorator, delegating to discovery.list_events.
    @mcp.tool()
    async def list_events(prefix: str | None = None) -> list[dict[str, str]]:
        """List events, optionally filtered by path prefix (e.g. 'event:/bumpers/')."""
        return await discovery.list_events(_studio(), prefix)
  • Input schema: optional 'prefix' parameter (str | None) for filtering events by path prefix.
    async def list_events(prefix: str | None = None) -> list[dict[str, str]]:
        """List events, optionally filtered by path prefix (e.g. 'event:/bumpers/')."""
  • StudioClient.eval() — the low-level helper that sends JavaScript to FMOD Studio and parses the response, used by list_events.
    async def eval(self, js: str, timeout: float = 30.0) -> Any:
        """Evaluate a JavaScript snippet in Studio and return the parsed value.
    
        The caller is responsible for making sure ``js`` uses ``return`` to
        surface its value (the snippet is wrapped in an IIFE).
        """
        req_id = uuid.uuid4().hex
        # Substitute the request id into the template BEFORE injecting user JS,
        # so a snippet that happens to contain "__ID__" or "__JS__" cannot
        # corrupt the surrounding wrapper.
        wrapped = _WRAPPER_TEMPLATE.replace("__ID__", req_id).replace("__JS__", js)
        # Studio's terminal evaluates per-line: strip `//` comments and collapse
        # internal newlines so the whole command arrives as one line.
        wrapped = _flatten_js(wrapped)
        async with self._lock:
            # connect() inside the lock so concurrent callers don't open
            # multiple sockets or fight over the same StreamReader.
            await self.connect()
            self._log_command(req_id, js)
            assert self._writer is not None
            self._writer.write(wrapped.encode("utf-8"))
            await self._writer.drain()
            return await self._await_response(req_id, timeout)
    
    async def _await_response(self, req_id: str, timeout: float) -> Any:
        assert self._reader is not None
        loop = asyncio.get_event_loop()
        deadline = loop.time() + timeout
        while True:
            found = self._consume_response(req_id)
            if found is not None:
                kind, payload = found
                if kind == "OK":
                    return payload
                message = payload.get("message", "FMOD Studio error") if isinstance(payload, dict) else str(payload)
                stack = payload.get("stack", "") if isinstance(payload, dict) else ""
                raise StudioError(f"{message}\n{stack}".rstrip())
            remaining = deadline - loop.time()
            if remaining <= 0:
                raise TimeoutError(
                    f"FMOD Studio did not respond to request {req_id} within {timeout}s"
                )
            try:
                chunk = await asyncio.wait_for(self._reader.read(4096), timeout=remaining)
            except asyncio.TimeoutError as exc:
                raise TimeoutError(
                    f"FMOD Studio did not respond to request {req_id} within {timeout}s"
                ) from exc
            if not chunk:
                raise ConnectionError("FMOD Studio closed the TCP connection")
            self._buffer += chunk.decode("utf-8", errors="replace")
    
    def _consume_response(self, req_id: str) -> tuple[str, Any] | None:
        for kind, sentinel in (("OK", _SENTINEL_OK), ("ERR", _SENTINEL_ERR)):
            tag = f"{sentinel}:{req_id}:"
            idx = self._buffer.find(tag)
            if idx == -1:
                continue
            end = self._buffer.find("\n", idx + len(tag))
            if end == -1:
                return None
            payload_str = self._buffer[idx + len(tag) : end]
            self._buffer = self._buffer[end + 1 :]
            try:
                return kind, json.loads(payload_str)
            except json.JSONDecodeError as exc:
                raise StudioError(f"Malformed JSON from Studio: {payload_str!r}") from exc
        return None
    
    def _log_command(self, req_id: str, js: str) -> None:
        try:
            with self._log_path.open("a", encoding="utf-8") as fh:
                fh.write(f"# {req_id}\n{js.rstrip()}\n\n")
        except OSError as exc:
            logger.warning("Could not write to command log %s: %s", self._log_path, exc)
  • Test fixture listing 'list_events' in EXPECTED_TOOLS to verify it's registered.
    EXPECTED_TOOLS = {
        # discovery
        "ping",
        "list_banks",
        "list_events",
        "list_buses",
        "get_event",
        # audio + events
        "import_audio",
        "create_event",
        "add_single_sound",
        "set_event_property",
        "assign_to_bank",
        "assign_to_bus",
        # effects
        "list_effect_types",
        "add_effect",
        "list_effects",
        "get_effect",
        "set_effect_param",
        "remove_effect",
        "bypass_effect",
        # project
        "save_project",
        "build_banks",
        # escape
        "run_js",
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It only states that it lists events and can filter, but does not disclose any behavioral traits such as read-only nature, side effects, or permissions. The existence of an output schema mitigates some need for return value explanation.

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?

A single sentence that includes the core functionality, optional filter, and an example. No unnecessary words, and information is front-loaded.

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?

For a simple list tool with one optional parameter and an output schema, the description covers the essential information. It could be slightly improved by mentioning that it returns all events when no prefix is given, but it is otherwise complete.

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

Parameters5/5

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

Schema coverage is 0%, but the description adds meaning by explaining the prefix parameter's purpose and providing an example. This fully compensates for the schema's lack of description.

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?

The description clearly states the verb 'List' and the resource 'events', and mentions optional filtering by path prefix. This distinguishes it from siblings like create_event, get_event, and set_event_property.

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

Usage Guidelines4/5

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

The description implies usage for listing events with optional filtering, but does not explicitly state when not to use it or compare it to alternatives like get_event for single events. However, the context is clear enough.

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