Skip to main content
Glama

search_youtube

Read-only

Search YouTube for videos, channels, or playlists on any topic. Returns up to 50 results with metadata for topic-based discovery.

Instructions

Search YouTube globally for videos, channels, or playlists on any topic. Returns up to 50 results with metadata. Use this for topic-based discovery when the user has not specified a channel — for searching within a known channel use search_channel_videos instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesSearch query (same syntax as YouTube's search bar, e.g. 'rust async tutorial', 'lex fridman dario amodei').
typeNoSearch type: 'video', 'channel', or 'playlist'. Default: 'video'.
limitNoMax results (1-50, default 20).

Implementation Reference

  • Input schema for search_youtube tool: expects 'q' (string, required), optional 'type' (video/channel/playlist), optional 'limit' (1-50).
    inputSchema: {
      type: "object",
      properties: {
        q: {
          type: "string",
          description:
            "Search query (same syntax as YouTube's search bar, e.g. 'rust async tutorial', 'lex fridman dario amodei').",
          minLength: 1,
        },
        type: {
          type: "string",
          description:
            "Search type: 'video', 'channel', or 'playlist'. Default: 'video'.",
          enum: ["video", "channel", "playlist"],
        },
        limit: {
          type: "number",
          description: "Max results (1-50, default 20).",
          minimum: 1,
          maximum: 50,
        },
      },
      required: ["q"],
    },
  • src/index.js:74-76 (registration)
    Registration of the search_youtube tool in the TOOLS array with name, description, and annotations.
    {
      name: "search_youtube",
      description:
  • The callUpstream function handles all tool calls including search_youtube by forwarding to the upstream MCP server at SubDownload with Bearer token auth.
    async function callUpstream(name, args) {
      if (!API_KEY) {
        throw new Error(
          "SUBDOWNLOAD_API_KEY env var is not set. Get one at https://subdownload.com/account, then run with -e SUBDOWNLOAD_API_KEY=<your-key>."
        );
      }
      const res = await fetch(UPSTREAM_URL, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json, text/event-stream",
          Authorization: `Bearer ${API_KEY}`,
        },
        body: JSON.stringify({
          jsonrpc: "2.0",
          id: Date.now(),
          method: "tools/call",
          params: { name, arguments: args },
        }),
      });
  • ANN.YT_READ annotation hints used by search_youtube indicating read-only, non-idempotent, open-world (public data changes over time).
    YT_READ: {
      readOnlyHint: true,
      destructiveHint: false,
      idempotentHint: false,
      openWorldHint: true,
    },
    // ASR job creation — coalesces on (video, lang) within cache TTL
    ASR_START: {
      readOnlyHint: false,
      destructiveHint: false,
      idempotentHint: true,
      openWorldHint: true,
    },
    // ASR poll — hits our backend only, status changes over time
    ASR_POLL: {
      readOnlyHint: true,
      destructiveHint: false,
      idempotentHint: false,
Behavior4/5

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

Adds key behavioral detail (returns up to 50 results with metadata) beyond annotations which already indicate read-only and non-destructive nature. No contradictions.

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 focused sentences: first states purpose and constraints, second gives usage guidance. No wasted words.

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

Completeness5/5

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

Given the annotations (readOnlyHint true, etc.) and thorough schema, the description is complete. It covers result limits, metadata, and differentiates from sibling.

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 covers all 3 parameters with descriptions; the tool description does not add significant new 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.

Purpose5/5

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

Clearly states 'Search YouTube globally' with specific resource types (videos, channels, playlists). Distinguishes from sibling search_channel_videos by noting global vs within-channel context.

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

Usage Guidelines5/5

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

Explicitly advises when to use (topic-based discovery without channel) and when to use alternative (search_channel_videos for within a known channel).

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/SubDownload/subdownload-mcp'

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