Skip to main content
Glama

play_similar

Find and play related videos from the same channel to continue watching similar content. Automatically queues or replaces playback based on your selection.

Instructions

Play videos similar to what is currently playing. Fetches the current video's channel and searches for related content, then queues or plays the results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of similar videos to find (default 10)
play_nowNoReplace current playback (true) or add to queue (false)

Implementation Reference

  • The handler function that executes the 'play_similar' tool logic. It checks if a video is playing, searches for related content based on the current title, and then either plays the similar videos immediately or adds them to the queue.
    async ({ limit, play_now }) => {
      const depErr = checkDeps();
      if (depErr) return errorResult(depErr);
    
      if (!mpv.isPlaying()) return errorResult('No video is currently playing.');
    
      let currentTitle: string;
      try {
        currentTitle = (await mpv.getProperty('media-title')) as string;
        if (!currentTitle) return errorResult('Cannot determine current video title.');
      } catch {
        return errorResult('Cannot get current video info. Is a video playing?');
      }
    
      try {
        const result = await fetchFeed(
          `https://www.youtube.com/results?search_query=${encodeURIComponent(currentTitle)}`,
          limit + 5 // fetch extra to filter out the current video
        );
        const videos = (result.entries || [])
          .filter((e) => e.title !== currentTitle)
          .slice(0, limit);
    
        if (videos.length === 0) return textResult('No similar videos found.');
    
        if (play_now) {
          const urls = videos.map((e) => e.url as string).filter(Boolean);
          const playlistFile = mpv.writeTempPlaylist(urls);
          await mpv.launch({ playlistFile, socketTimeoutMs: 15_000 });
    
          let title = 'Similar videos';
          try { title = (await mpv.getProperty('media-title')) as string || title; } catch { /* loading */ }
    
          return textResult({ status: 'playing_similar', basedOn: currentTitle, title, total: urls.length });
        } else {
          let queued = 0;
          for (const e of videos) {
            const vUrl = e.url as string;
            if (vUrl) { await mpv.appendUrl(vUrl); queued++; }
          }
          return textResult({ status: 'queued_similar', basedOn: currentTitle, queued });
        }
      } catch (err) {
        return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`);
      }
    }
  • src/index.ts:581-587 (registration)
    Tool registration for 'play_similar', including description and input validation schema definition.
    server.tool(
      'play_similar',
      'Play videos similar to what is currently playing. Fetches the current video\'s channel and searches for related content, then queues or plays the results.',
      {
        limit: z.number().min(1).max(20).default(10).describe('Number of similar videos to find (default 10)'),
        play_now: z.boolean().default(false).describe('Replace current playback (true) or add to queue (false)'),
      },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the underlying mechanism ('Fetches the current video's channel and searches for related content') and the queuing behavior ('queues or plays'), but lacks details on error states, whether it clears the existing queue, or authentication requirements.

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?

Two sentences with zero waste. The first sentence front-loads the primary action, while the second efficiently explains the implementation mechanism. Every word earns its place.

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?

Given the 100% schema coverage and lack of output schema, the description adequately explains the core functionality and algorithm. However, it could be improved by explicitly stating the prerequisite (active playback required) or error conditions when nothing is playing.

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%, providing baseline documentation for both parameters. The description mentions 'queues or plays' which loosely maps to the play_now parameter, but does not add syntax details, validation rules, or semantic context beyond what the schema already provides.

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 uses specific verbs ('Play', 'Fetches', 'searches') and clearly identifies the resource (videos similar to current playback). It distinguishes from siblings like play_video, search_youtube, or queue_video by emphasizing the 'similar to what is currently playing' context and automatic fetching mechanism.

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

Usage Guidelines3/5

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

The description implies the prerequisite that a video must be currently playing ('similar to what is currently playing'), but does not explicitly state when to use this versus manual search alternatives like search_youtube, nor does it mention what happens if no video is playing.

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/ronantakizawa/social-video-mcp'

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