Skip to main content
Glama

get_media

Retrieve comprehensive metadata for a registered media asset, including protection status, applied algorithms, tags, and storage details using its unique identifier.

Instructions

Get details of a specific registered media asset by ID. Returns metadata, protection status, applied algorithms, tags, and storage information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_idYesUUID of the media asset

Implementation Reference

  • The main handler function that executes the get_media tool. It takes media_id as input, makes a GET request to /api/v1/media/{media_id}, and returns the media details as formatted JSON or handles errors gracefully.
    async ({ media_id }) => {
      try {
        const result = await api.get(
          `/api/v1/media/${encodeURIComponent(media_id)}`,
        );
        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,
        };
      }
    },
  • The registration function that registers the get_media tool with the MCP server, including the tool name, description, schema definition, and handler function.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "get_media",
        "Get details of a specific registered media asset by ID. Returns metadata, " +
          "protection status, applied algorithms, tags, and storage information.",
        {
          media_id: z.string().describe("UUID of the media asset"),
        },
        async ({ media_id }) => {
          try {
            const result = await api.get(
              `/api/v1/media/${encodeURIComponent(media_id)}`,
            );
            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,
            };
          }
        },
      );
    }
  • The Zod schema definition for the get_media tool input parameters, defining media_id as a required string with UUID description.
    {
      media_id: z.string().describe("UUID of the media asset"),
    },
  • src/index.ts:17-17 (registration)
    Import statement for the get_media tool registration function from ./tools/get-media.js
    import { register as getMedia } from "./tools/get-media.js";
  • src/index.ts:61-61 (registration)
    Registration call that activates the get_media tool in the MCP server with the API client instance
    getMedia(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