player_set_volume
Set the playback volume of an mpv media player session to any level from 0 (silent) to 130 (maximum), with 100 as the default normal volume.
Instructions
Set playback volume (0–130). 100 is default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| volume | Yes | Volume level 0–130 |
Implementation Reference
- index.js:577-581 (handler)The handler case for 'player_set_volume' tool. It ensures mpv is running, sets the volume property (clamped to 0-130), and returns a success message.
case "player_set_volume": { await ensureMpv(); await setProperty("volume", Math.max(0, Math.min(130, args.volume))); return ok(`Volume set to ${args.volume}`); } - index.js:383-393 (schema)Tool definition and input schema for 'player_set_volume', including name, description, and input schema with a required 'volume' number (0-130).
{ name: "player_set_volume", description: "Set playback volume (0–130). 100 is default.", inputSchema: { type: "object", properties: { volume: { type: "number", description: "Volume level 0–130" }, }, required: ["volume"], }, }, - index.js:724-724 (registration)Registration of all tools via ListToolsRequestSchema handler, which includes 'player_set_volume' in the TOOLS array.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); - index.js:726-729 (registration)CallToolRequestSchema handler that dispatches tool calls (including 'player_set_volume') to the handleTool function.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; return handleTool(name, args || {}); }); - index.js:230-232 (helper)Helper function setProperty used by the handler to set the volume via mpv IPC.
async function setProperty(prop, value) { return ipcCommand({ command: ["set_property", prop, value], request_id: reqId++ }); }