Skip to main content
Glama

save_to_library

Idempotent

Save a video to your library: bookmark for ASR, upload a summary, or both. Updates existing entry on re-save.

Instructions

Save a video to the authenticated user's Library. Three modes via kind: 'asr' bookmarks the video and flips has_asr (use after a successful transcribe_video → fetch_transcript flow); 'summary' uploads a summary blob; 'both' does both at once. Idempotent: saving the same video twice updates the existing entry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYesYouTube video ID (11 chars).
kindYes'asr' (bookmark + flip has_asr), 'summary' (upload summary text), or 'both'.
titleNoVideo title (for display in the user's Library list).
authorNoChannel / author name.
thumbnailNoThumbnail URL.
video_urlNoFull YouTube URL.
languageNoVideo language code (ISO 639-1).
textNoSummary text. REQUIRED when kind='summary' or kind='both'. Plain text or markdown — use the `format` param to declare which.
localeNoSummary locale (e.g. 'en', 'zh'). Used with kind='summary' or kind='both'.
formatNoSummary format: 'markdown' (default) or 'text'. Use 'markdown' if your text contains **bold**, bullets, headings, or code fences so the web UI renders it; use 'text' for plain prose.
modelNoOptional model identifier, e.g. 'claude-opus-4'.

Implementation Reference

  • Input schema and tool definition for save_to_library. Defines the name, description, annotations (LIB_WRITE), and inputSchema with all parameters: video_id (required), kind (required, enum: asr/summary/both), title, author, thumbnail, video_url, language, text, locale, format (markdown/text), model.
    {
      name: "save_to_library",
      description:
        "Save a video to the authenticated user's Library. Three modes via `kind`: 'asr' bookmarks the video and flips has_asr (use after a successful transcribe_video → fetch_transcript flow); 'summary' uploads a summary blob; 'both' does both at once. Idempotent: saving the same video twice updates the existing entry.",
      annotations: { title: "Save to Library", ...ANN.LIB_WRITE },
      inputSchema: {
        type: "object",
        properties: {
          video_id: {
            type: "string",
            description: "YouTube video ID (11 chars).",
            minLength: 5,
          },
          kind: {
            type: "string",
            description:
              "'asr' (bookmark + flip has_asr), 'summary' (upload summary text), or 'both'.",
            enum: ["asr", "summary", "both"],
          },
          title: {
            type: "string",
            description: "Video title (for display in the user's Library list).",
          },
          author: {
            type: "string",
            description: "Channel / author name.",
          },
          thumbnail: {
            type: "string",
            description: "Thumbnail URL.",
          },
          video_url: {
            type: "string",
            description: "Full YouTube URL.",
          },
          language: {
            type: "string",
            description: "Video language code (ISO 639-1).",
          },
          text: {
            type: "string",
            description:
              "Summary text. REQUIRED when kind='summary' or kind='both'. Plain text or markdown — use the `format` param to declare which.",
          },
          locale: {
            type: "string",
            description:
              "Summary locale (e.g. 'en', 'zh'). Used with kind='summary' or kind='both'.",
          },
          format: {
            type: "string",
            description:
              "Summary format: 'markdown' (default) or 'text'. Use 'markdown' if your text contains **bold**, bullets, headings, or code fences so the web UI renders it; use 'text' for plain prose.",
            enum: ["markdown", "text"],
          },
          model: {
            type: "string",
            description: "Optional model identifier, e.g. 'claude-opus-4'.",
          },
        },
        required: ["video_id", "kind"],
      },
    },
  • src/index.js:293-355 (registration)
    Tool registration as part of the TOOLS array. The tool is registered by being included in the TOOLS array (line 73) which is returned by the ListToolsRequestSchema handler (line 448). All tool calls are forwarded via the generic CallToolRequestSchema handler (line 450) that invokes callUpstream with the tool name and arguments.
    {
      name: "save_to_library",
      description:
        "Save a video to the authenticated user's Library. Three modes via `kind`: 'asr' bookmarks the video and flips has_asr (use after a successful transcribe_video → fetch_transcript flow); 'summary' uploads a summary blob; 'both' does both at once. Idempotent: saving the same video twice updates the existing entry.",
      annotations: { title: "Save to Library", ...ANN.LIB_WRITE },
      inputSchema: {
        type: "object",
        properties: {
          video_id: {
            type: "string",
            description: "YouTube video ID (11 chars).",
            minLength: 5,
          },
          kind: {
            type: "string",
            description:
              "'asr' (bookmark + flip has_asr), 'summary' (upload summary text), or 'both'.",
            enum: ["asr", "summary", "both"],
          },
          title: {
            type: "string",
            description: "Video title (for display in the user's Library list).",
          },
          author: {
            type: "string",
            description: "Channel / author name.",
          },
          thumbnail: {
            type: "string",
            description: "Thumbnail URL.",
          },
          video_url: {
            type: "string",
            description: "Full YouTube URL.",
          },
          language: {
            type: "string",
            description: "Video language code (ISO 639-1).",
          },
          text: {
            type: "string",
            description:
              "Summary text. REQUIRED when kind='summary' or kind='both'. Plain text or markdown — use the `format` param to declare which.",
          },
          locale: {
            type: "string",
            description:
              "Summary locale (e.g. 'en', 'zh'). Used with kind='summary' or kind='both'.",
          },
          format: {
            type: "string",
            description:
              "Summary format: 'markdown' (default) or 'text'. Use 'markdown' if your text contains **bold**, bullets, headings, or code fences so the web UI renders it; use 'text' for plain prose.",
            enum: ["markdown", "text"],
          },
          model: {
            type: "string",
            description: "Optional model identifier, e.g. 'claude-opus-4'.",
          },
        },
        required: ["video_id", "kind"],
      },
    },
  • The callUpstream function proxies tool calls to the upstream SubDownload API (https://api.subdownload.com/mcp). This is the execution path for all tools including save_to_library. It sends a JSON-RPC request with Bearer token auth and returns the result.
    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 },
        }),
      });
      const text = await res.text();
      let body;
      try {
        body = JSON.parse(text);
      } catch {
        throw new Error(
          `Upstream returned non-JSON response (HTTP ${res.status}): ${text.slice(0, 200)}`
        );
      }
      if (body.error) {
        throw new Error(body.error.message || JSON.stringify(body.error));
      }
      return body.result;
    }
  • src/index.js:63-71 (registration)
    LIB_WRITE annotation constant used by save_to_library. Defines readOnlyHint=false, destructiveHint=false, idempotentHint=true, openWorldHint=false.
      // Library write — overwrites latest summary on same (video, locale),
      // intended "latest-only" UX, not destructive
      LIB_WRITE: {
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false,
      },
    };
Behavior5/5

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

Beyond annotations (idempotentHint=true, readOnlyHint=false), the description adds meaningful behavioral details: idempotent updates existing entry, effect of each mode (bookmarks, flips has_asr, uploads summary), and that 'text' is required for summary modes.

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?

Three concise sentences that front-load the main action, then elaborate modes and idempotency. Every sentence adds necessary information without redundancy.

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?

The description covers modes, idempotency, and prerequisites for 'asr'. It lacks information about the response/return value (no output schema), but otherwise is adequate for a save operation.

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

Parameters4/5

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

Schema already provides 100% coverage with descriptions. The description adds value by explaining the `kind` values and their usage, and clarifying that `text` is required for 'summary'/'both' and giving guidance on `format`.

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 clearly states 'Save a video to the authenticated user's Library' with specific verb and resource. It distinguishes three modes via `kind`, making the purpose distinct from sibling tools like fetch_transcript or list_library.

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?

The description explains when to use each mode, e.g., 'asr' after a transcribe_video -> fetch_transcript flow, and mentions idempotent behavior. It does not explicitly exclude alternatives or state when not to use, but provides clear context.

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