Skip to main content
Glama

player_seek

Seek to a specific position in the current media using relative or absolute seconds, or percentage.

Instructions

Seek within the current media.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesSeconds to seek (positive = forward, negative = backward) when mode=relative. Absolute second when mode=absolute. 0-100 when mode=percent.
modeNoSeek moderelative

Implementation Reference

  • Handler for the player_seek tool. Ensures mpv is running, sends a seek command with the given value and mode (relative/absolute/percent), then returns the new playback position formatted as a time string.
    case "player_seek": {
      await ensureMpv();
      const mode = args.mode || "relative";
      await mpv("seek", [args.value, mode]);
      const pos = await getProperty("time-pos");
      return ok(`Seeked → ${formatTime(pos)}`);
    }
  • Input schema definition for the player_seek tool. It requires a number 'value' and accepts an optional 'mode' parameter with enum values 'relative', 'absolute', or 'percent' (defaulting to 'relative').
    {
      name: "player_seek",
      description: "Seek within the current media.",
      inputSchema: {
        type: "object",
        properties: {
          value: {
            type: "number",
            description:
              "Seconds to seek (positive = forward, negative = backward) when mode=relative. Absolute second when mode=absolute. 0-100 when mode=percent.",
          },
          mode: {
            type: "string",
            enum: ["relative", "absolute", "percent"],
            default: "relative",
            description: "Seek mode",
          },
        },
        required: ["value"],
      },
  • index.js:321-498 (registration)
    The TOOLS array registers all available tools, including player_seek (line 362-381). This array is served via ListToolsRequestSchema handler.
    const TOOLS = [
      {
        name: "player_play",
        description:
          "Open and play a media file or URL. If mpv is not running, it will be launched automatically.",
        inputSchema: {
          type: "object",
          properties: {
            path: {
              type: "string",
              description: "Absolute file path or URL (http/https/rtmp etc.)",
            },
            append: {
              type: "boolean",
              description: "Append to current playlist instead of replacing it",
              default: false,
            },
          },
          required: ["path"],
        },
      },
      {
        name: "player_pause",
        description: "Toggle pause / resume playback.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "player_stop",
        description: "Stop playback and clear the current file.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "player_next",
        description: "Skip to the next item in the playlist.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "player_prev",
        description: "Go back to the previous item in the playlist.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "player_seek",
        description: "Seek within the current media.",
        inputSchema: {
          type: "object",
          properties: {
            value: {
              type: "number",
              description:
                "Seconds to seek (positive = forward, negative = backward) when mode=relative. Absolute second when mode=absolute. 0-100 when mode=percent.",
            },
            mode: {
              type: "string",
              enum: ["relative", "absolute", "percent"],
              default: "relative",
              description: "Seek mode",
            },
          },
          required: ["value"],
        },
      },
      {
        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"],
        },
      },
      {
        name: "player_set_speed",
        description: "Set playback speed multiplier. 1.0 = normal speed.",
        inputSchema: {
          type: "object",
          properties: {
            speed: {
              type: "number",
              description: "Speed multiplier e.g. 0.5, 1.0, 1.5, 2.0",
            },
          },
          required: ["speed"],
        },
      },
      {
        name: "player_status",
        description:
          "Get current playback status: file name, position, duration, volume, speed, pause state.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "player_shuffle",
        description: "Randomly shuffle the current playlist and start playing from the first track.",
        inputSchema: { type: "object", properties: {} },
      },
      {
        name: "playlist_load",
        description: "Load a saved playlist by name and start playing it.",
        inputSchema: {
          type: "object",
          properties: {
            name: { type: "string", description: "Playlist name (without .m3u)" },
          },
          required: ["name"],
        },
      },
      {
        name: "playlist_create",
        description: "Create a new playlist with a list of file paths.",
        inputSchema: {
          type: "object",
          properties: {
            name: { type: "string", description: "Playlist name" },
            files: {
              type: "array",
              items: { type: "string" },
              description: "Array of absolute file paths or URLs",
            },
          },
          required: ["name", "files"],
        },
      },
      {
        name: "playlist_add",
        description: "Add files to an existing playlist.",
        inputSchema: {
          type: "object",
          properties: {
            name: { type: "string", description: "Playlist name" },
            files: {
              type: "array",
              items: { type: "string" },
              description: "Files to append",
            },
          },
          required: ["name", "files"],
        },
      },
      {
        name: "playlist_remove",
        description: "Remove a file from a saved playlist by index (0-based).",
        inputSchema: {
          type: "object",
          properties: {
            name: { type: "string", description: "Playlist name" },
            index: { type: "number", description: "0-based index to remove" },
          },
          required: ["name", "index"],
        },
      },
      {
        name: "playlist_list",
        description: "List all saved playlists or show contents of a specific playlist.",
        inputSchema: {
          type: "object",
          properties: {
            name: {
              type: "string",
              description: "Playlist name to inspect (omit to list all playlists)",
            },
          },
        },
      },
      {
        name: "playlist_delete",
        description: "Delete a saved playlist file.",
        inputSchema: {
          type: "object",
          properties: {
            name: { type: "string", description: "Playlist name to delete" },
          },
          required: ["name"],
        },
      },
    ];
  • Helper function used by player_seek handler to format the seconds value returned by mpv into a human-readable time string (e.g., '5:30' or '1:05:30').
    function formatTime(secs) {
      if (secs == null) return "N/A";
      const h = Math.floor(secs / 3600);
      const m = Math.floor((secs % 3600) / 60);
      const s = Math.floor(secs % 60);
      return h > 0
        ? `${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`
        : `${m}:${String(s).padStart(2, "0")}`;
    }
Behavior2/5

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

No annotations exist, so the description must convey behavioral traits. It only states 'Seek within the current media,' omitting details such as behavior when seeking beyond track length, whether the media pauses, or if it requires an active media session.

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?

The description is a single clear sentence that is front-loaded and efficiently conveys the core purpose. Every word earns its place.

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

Completeness2/5

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

The description is too minimal for a tool with 2 parameters and no output schema. It lacks information on return values, error conditions, prerequisites (e.g., media must be loaded and playing), and edge cases like invalid seek values.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters well-described in the schema. The description adds no additional meaning beyond the schema, so baseline score of 3 is appropriate.

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

Purpose4/5

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

The description 'Seek within the current media' clearly identifies the tool's action and resource. It distinguishes from siblings like player_next/prev (track skipping) and player_play/pause (playback control). However, it does not highlight the supported seek modes (relative, absolute, percent).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool vs alternatives like player_next/prev or player_play/pause. No context about prerequisites (e.g., media must be playing) or when seeking is appropriate.

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/guodaxia9527/mcp-mpv-player'

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