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
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor from a previous response | |
| limit | No | Results per page (1-100, default: 20) |
Implementation Reference
- src/tools/list-media.ts:5-48 (handler)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, }; } }, ); } - src/tools/list-media.ts:11-23 (schema)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);