Skip to main content
Glama

list_my_shorts

List your recent YouTube Shorts by scanning recent uploads and filtering to videos 60 seconds or less.

Instructions

List your recent Shorts — scans the most recent uploads and filters to videos ≤60s. Useful when the Data API doesn't expose a direct Shorts filter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_candidatesNoHow many of the most recent uploads to scan. Shorts are detected by duration ≤ 60s after fetching.

Implementation Reference

  • The async handler function for 'list_my_shorts'. It paginates through the user's uploads via client.listMyUploads(), filters videos with duration ≤60s (the SHORTS_THRESHOLD_SECONDS constant), collects matching items, and returns a formatted text response listing each Short's ID, title, duration, and views.
      async (args) => {
        const collected: Array<{ video: Video; seconds: number }> = [];
        let pageToken: string | undefined;
        let scanned = 0;
        while (scanned < args.max_candidates) {
          const batch = Math.min(50, args.max_candidates - scanned);
          const res = await client.listMyUploads(batch, pageToken);
          for (const v of res.items) {
            const s = parseIsoDurationSeconds(v.contentDetails?.duration);
            if (s !== null && s <= SHORTS_THRESHOLD_SECONDS) {
              collected.push({ video: v, seconds: s });
            }
          }
          scanned += res.items.length;
          if (!res.nextPageToken || res.items.length === 0) break;
          pageToken = res.nextPageToken;
        }
        if (collected.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No Shorts found in the most recent ${scanned} upload(s).`,
              },
            ],
          };
        }
        const lines = [
          `Found ${collected.length} Short(s) in the most recent ${scanned} upload(s):`,
          ...collected.map(({ video, seconds }) => {
            const title = video.snippet?.title ?? "(untitled)";
            const views = video.statistics?.viewCount ?? "0";
            return `  ${video.id} — ${title} [${seconds}s, ${views} views]`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • The input schema for 'list_my_shorts', defined as listMyShortsSchema. It accepts a single optional parameter 'max_candidates' (integer 1-200, default 50) controlling how many recent uploads to scan for Shorts.
    const listMyShortsSchema = {
      max_candidates: z
        .number()
        .int()
        .min(1)
        .max(200)
        .default(50)
        .describe(
          "How many of the most recent uploads to scan. Shorts are detected by duration ≤ 60s after fetching.",
        ),
    };
  • The tool registration via server.tool('list_my_shorts', ...) inside registerShortsTools(). The description explains that it scans recent uploads and filters to videos ≤60s, since the Data API doesn't expose a direct Shorts filter.
    server.tool(
      "list_my_shorts",
      "List your recent Shorts — scans the most recent uploads and filters to videos ≤60s. Useful when the Data API doesn't expose a direct Shorts filter.",
      listMyShortsSchema,
      async (args) => {
        const collected: Array<{ video: Video; seconds: number }> = [];
        let pageToken: string | undefined;
        let scanned = 0;
        while (scanned < args.max_candidates) {
          const batch = Math.min(50, args.max_candidates - scanned);
          const res = await client.listMyUploads(batch, pageToken);
          for (const v of res.items) {
            const s = parseIsoDurationSeconds(v.contentDetails?.duration);
            if (s !== null && s <= SHORTS_THRESHOLD_SECONDS) {
              collected.push({ video: v, seconds: s });
            }
          }
          scanned += res.items.length;
          if (!res.nextPageToken || res.items.length === 0) break;
          pageToken = res.nextPageToken;
        }
        if (collected.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `No Shorts found in the most recent ${scanned} upload(s).`,
              },
            ],
          };
        }
        const lines = [
          `Found ${collected.length} Short(s) in the most recent ${scanned} upload(s):`,
          ...collected.map(({ video, seconds }) => {
            const title = video.snippet?.title ?? "(untitled)";
            const views = video.statistics?.viewCount ?? "0";
            return `  ${video.id} — ${title} [${seconds}s, ${views} views]`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Helper function parseIsoDurationSeconds() that parses ISO 8601 duration strings (e.g., PT1M30S) into total seconds. Used to determine if a video is a Short (≤60 seconds).
    function parseIsoDurationSeconds(duration: string | undefined): number | null {
      if (!duration) return null;
      const m = duration.match(/^P(?:(\d+)D)?T?(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?$/);
      if (!m) return null;
      const days = Number(m[1] ?? 0);
      const hours = Number(m[2] ?? 0);
      const minutes = Number(m[3] ?? 0);
      const seconds = Number(m[4] ?? 0);
      return days * 86400 + hours * 3600 + minutes * 60 + seconds;
    }
  • Constant SHORTS_THRESHOLD_SECONDS = 60, which defines the maximum duration in seconds for a video to be considered a Short.
    const SHORTS_THRESHOLD_SECONDS = 60;
Behavior3/5

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

The description explains the scanning and filtering behavior, but does not disclose return format, performance implications, 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?

The description is a single concise sentence with no wasted words, efficiently conveying the tool's function.

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 lacks information about the return value (fields, structure), pagination, or ordering, which is important given no output schema.

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?

The parameter is fully described in the schema; the description adds context about why it scans recent uploads, but adds minimal extra meaning.

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 the tool lists recent Shorts by scanning uploads and filtering by duration ≤60s, distinguishing it from siblings like list_my_videos.

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 mentions it is useful when the Data API lacks a direct Shorts filter, but does not specify when not to use it or suggest alternatives.

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/miller-joe/youtube-mcp'

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