tools.pause_music module

Pause the active Lyria music stream in a Discord voice channel.

async tools.pause_music.run(guild_id, ctx=None)[source]

Pause the active Lyria RealTime music stream for a guild.

Implements the pause_music tool. It does not generate audio itself; instead it resolves the Discord client and the Lyria service hanging off the platform adapter and asks Lyria to suspend the in-progress generation so it can later be resumed with resume_music without tearing down the voice connection.

Validates that a Discord-capable context was supplied (ctx.adapter), fetches the live discord.Client via tools._discord_helpers.get_discord_client (returning that helper’s error string if the client is unavailable), coerces guild_id to an int, and then delegates to ctx.adapter.lyria_service.pause, whose return string is passed straight back to the model. It is registered and dispatched dynamically by tool_loader.py as the module-level run handler; no in-repo callers invoke it directly outside of tests.

Parameters:
  • guild_id (str) – Discord server (guild) ID as a string; rejected if it cannot be parsed as an integer.

  • ctx (ToolContext | None) – The tool execution context. Must expose a non-None adapter with a lyria_service; otherwise an error string is returned.

Returns:

The Lyria service’s status message on success, or an Error: prefixed string when the adapter is missing, the Discord client is unavailable, or guild_id is invalid.

Return type:

str