Skip to main content
Glama

list_media

Retrieve a paginated list of your media assets with IDs, types, status, tags, and protection details for managing digital content.

Instructions

List media assets registered to your account. Returns a paginated list with media IDs, types, status, tags, and protection details. Use cursor-based pagination for large libraries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination cursor from a previous response
limitNoResults per page (1-100, default: 20)

Implementation Reference

  • Main implementation of list_media tool - contains the register function that defines the tool schema (cursor, limit parameters) and the handler logic that makes an API call to /api/v1/media and returns paginated media assets list
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "list_media",
        "List media assets registered to your account. Returns a paginated list " +
          "with media IDs, types, status, tags, and protection details. " +
          "Use cursor-based pagination for large libraries.",
        {
          cursor: z
            .string()
            .optional()
            .describe("Pagination cursor from a previous response"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Results per page (1-100, default: 20)"),
        },
        async (params) => {
          try {
            const result = await api.get("/api/v1/media", {
              cursor: params.cursor,
              limit: params.limit?.toString(),
            });
            return {
              content: [
                { type: "text" as const, text: JSON.stringify(result, null, 2) },
              ],
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true as const,
            };
          }
        },
      );
    }
  • Schema definition for list_media tool parameters using Zod - defines optional cursor for pagination and limit parameter (1-100, default 20)
    {
      cursor: z
        .string()
        .optional()
        .describe("Pagination cursor from a previous response"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Results per page (1-100, default: 20)"),
    },
  • src/index.ts:16-16 (registration)
    Import statement for list_media registration function
    import { register as listMedia } from "./tools/list-media.js";
  • src/index.ts:60-60 (registration)
    Registration call for list_media tool in the main application setup
    listMedia(server, api);

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/sidearmDRM/mcp-server'

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