Skip to main content
Glama

playlist_list

Retrieve all saved playlists from mpv player or view the contents of a specific playlist by providing its name.

Instructions

List all saved playlists or show contents of a specific playlist.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoPlaylist name to inspect (omit to list all playlists)

Implementation Reference

  • Handler for playlist_list: if args.name is provided, reads and lists contents of that playlist; otherwise lists all saved playlist names from the PLAYLIST_DIR directory.
    case "playlist_list": {
      if (args.name) {
        const files = readPlaylist(args.name);
        const lines = files.map((f, i) => `  ${i}. ${f}`);
        return info(`📋 Playlist "${args.name}" (${files.length} items):\n${lines.join("\n")}`);
      }
      const playlists = listPlaylists();
      if (playlists.length === 0) return info("No playlists found. Use playlist_create to make one.");
      return info(`📁 Saved playlists (${PLAYLIST_DIR}):\n${playlists.map((p) => `  • ${p}`).join("\n")}`);
    }
  • Schema definition for playlist_list tool: optional 'name' string parameter, returns list of playlists or contents of a specific playlist.
    {
      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)",
          },
        },
      },
    },
  • index.js:724-729 (registration)
    Tool registration: TOOLS array is defined at line 321, registered via ListToolsRequestSchema on line 724, and dispatched via handleTool in CallToolRequestSchema on line 726-729.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
    
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      return handleTool(name, args || {});
    });
  • Helper function listPlaylists() reads the PLAYLIST_DIR and returns all .m3u file names without extension.
    function listPlaylists() {
      return fs
        .readdirSync(PLAYLIST_DIR)
        .filter((f) => f.endsWith(".m3u"))
        .map((f) => f.replace(".m3u", ""));
    }
  • Helper function readPlaylist(name) reads a playlist file by name and returns non-empty, non-comment lines.
    function readPlaylist(name) {
      const p = playlistPath(name);
      if (!fs.existsSync(p)) throw new Error(`Playlist "${name}" not found`);
      return fs
        .readFileSync(p, "utf8")
        .split("\n")
        .map((l) => l.trim())
        .filter((l) => l && !l.startsWith("#"));
    }
Behavior2/5

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

No annotations provided. Description only states basic function without disclosing behavioral traits such as read-only nature, side effects, or output format. For a tool with no annotations, more detail is needed.

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?

Single sentence, efficient, no waste. Every word earns its place.

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

Completeness3/5

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

Given no output schema and no annotations, the description is reasonably complete for a list tool, but lacks detail about return format (e.g., list of names vs objects). Adequate but could be improved.

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 one parameter. Description adds context by explaining the dual mode, but largely restates the schema. Adequate but not enhanced beyond schema.

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?

Description clearly states it lists all playlists or shows contents of a specific playlist. Differentiates from siblings like playlist_create, playlist_delete, etc. by using specific verb 'list' and resource 'playlists'.

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?

Provides clear usage: omit 'name' to list all, provide 'name' to show contents. No explicit when-not or alternatives, but context from sibling tools makes it unambiguous.

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