Skip to main content
Glama

update_media

Modify the URL of a registered media asset to point to a new location for the original file, such as after re-hosting.

Instructions

Update a registered media asset. Currently supports updating the original media URL (e.g., after re-hosting the original file).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
media_idYesUUID of the media asset to update
original_media_urlYesNew URL for the original (unprotected) media file

Implementation Reference

  • The async handler function that executes the update_media tool logic. It makes a PATCH API call to update a media asset's original_media_url and returns the result or error.
    async ({ media_id, original_media_url }) => {
      try {
        const result = await api.patch(
          `/api/v1/media/${encodeURIComponent(media_id)}`,
          { original_media_url },
        );
        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,
        };
      }
    },
  • Zod schema definition for the update_media tool parameters, validating media_id (UUID string) and original_media_url (valid URL string).
    {
      media_id: z.string().describe("UUID of the media asset to update"),
      original_media_url: z
        .string()
        .url()
        .describe("New URL for the original (unprotected) media file"),
    },
  • The register function that registers the update_media tool with the MCP server, including the tool name, description, schema, and handler.
    export function register(server: McpServer, api: ApiClient): void {
      server.tool(
        "update_media",
        "Update a registered media asset. Currently supports updating the original " +
          "media URL (e.g., after re-hosting the original file).",
        {
          media_id: z.string().describe("UUID of the media asset to update"),
          original_media_url: z
            .string()
            .url()
            .describe("New URL for the original (unprotected) media file"),
        },
        async ({ media_id, original_media_url }) => {
          try {
            const result = await api.patch(
              `/api/v1/media/${encodeURIComponent(media_id)}`,
              { original_media_url },
            );
            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/index.ts:18-18 (registration)
    Import statement for the update_media register function from tools/update-media.js
    import { register as updateMedia } from "./tools/update-media.js";
  • src/index.ts:62-62 (registration)
    Registration call that activates the update_media tool with the MCP server and API client
    updateMedia(server, api);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool updates a media asset, implying mutation, but lacks details on permissions needed, whether changes are reversible, rate limits, or error conditions. The example ('after re-hosting') adds minimal context but doesn't cover behavioral traits adequately for a mutation tool.

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 two sentences, front-loaded with the core purpose and followed by a specific example. Every sentence adds value without redundancy, making it efficient and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete for a simple update tool. It covers the purpose and a usage hint but lacks details on behavior, error handling, or return values. For a mutation tool with 2 parameters, it's adequate but has clear gaps in transparency and completeness.

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?

Schema description coverage is 100%, so the schema fully documents both parameters (media_id as UUID, original_media_url as URI). The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints. Baseline 3 is appropriate since the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('registered media asset'), specifying the current capability ('updating the original media URL'). It distinguishes from siblings like 'delete_media' or 'get_media' by focusing on modification rather than deletion or retrieval. However, it doesn't explicitly contrast with 'protect_media' or 'register_media', which are related operations.

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 implies usage context ('after re-hosting the original file'), suggesting this tool is for URL updates post-registration. It doesn't provide explicit when-not-to-use guidance or name alternatives (e.g., 'register_media' for initial creation), leaving some ambiguity about its scope versus other media-related tools.

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

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