Skip to main content
Glama

Finalize Upload

finalize_upload

Finalize a direct upload once you have PUT the bytes to the uploadUrl from create_upload. Confirms the bytes landed and starts ingest: image/asset become ready immediately (status "complete"); audio/video enter processing (status "processing"). Returns { id, status, processingPhase }. 400 if no bytes were uploaded (PUT first) or the item is not yours. Then call wait_job(kind="media", id=mediaItemId), or use a media.completed webhook.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mediaItemId": "<mediaItemId>",
      "body": "<body>"
    },
    "name": "finalize_upload"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyYesPOST /media/:id/finalize body — optional declared audioRole.
commandIdNoRetry identity. A call repeated with the same commandId returns the first result instead of acting twice.
mediaItemIdYesmediaItemId (path).

Output Schema

NameRequiredDescriptionDefault
idNo
statusNo
processingPhaseNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • addedInput schema / $defs
      Added value: +{
      +  "__schema0": {
      +    "description": "Declared audio role: 'vo' (narration), 'music' (bed that ducks under speech), 'sfx' (one-shot hit), 'ambience' (a bed that HOLDS under VO — never ducks).",
      +    "enum": [
      +      "vo",
      +      "music",
      +      "sfx",
      +      "ambience"
      +    ],
      +    "type": "string"
      +  },
      +  "__schema1": {
      +    "maxLength": 128,
      +    "minLength": 1,
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / body / properties / audioRole / $ref
      Added value: +"#/$defs/__schema0"
    • removedInput schema / properties / body / properties / audioRole / description
      Removed value: -"Declared audio role: 'vo' (narration), 'music' (bed that ducks under speech), 'sfx' (one-shot hit), 'ambience' (a bed that HOLDS under VO — never ducks)."
    • removedInput schema / properties / body / properties / audioRole / enum
      Removed value: -[
      -  "vo",
      -  "music",
      -  "sfx",
      -  "ambience"
      -]
    • removedInput schema / properties / body / properties / audioRole / type
      Removed value: -"string"
    • addedInput schema / properties / commandId / $ref
      Added value: +"#/$defs/__schema1"
    • removedInput schema / properties / commandId / maxLength
      Removed value: -128
    • removedInput schema / properties / commandId / minLength
      Removed value: -1
    • removedInput schema / properties / commandId / type
      Removed value: -"string"
  2. Changed1 schema field changed
    • addedInput schema / properties / commandId
      Added value: +{
      +  "description": "Retry identity. A call repeated with the same commandId returns the first result instead of acting twice.",
      +  "maxLength": 128,
      +  "minLength": 1,
      +  "type": "string"
      +}
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Adds context annotations cannot carry: image/asset complete immediately vs audio/video entering 'processing', the returned fields, the 400 conditions, and ownership checks. The idempotency-via-commandId note clarifies the opt-in retry semantics rather than contradicting idempotentHint=false.

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?

Front-loads the action and precondition in the first sentence, then layers outcomes, return shape, errors, and next steps in a logical order with no redundant restatement of the name or title.

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

Completeness5/5

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

Even though an output schema exists, the description briefly states the return shape and, more importantly, tells the agent exactly what to do next and what errors to expect — everything needed to invoke this correctly in the upload lifecycle.

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 baseline is 3. The description references mediaItemId only implicitly through the wait_job example and does not mention audioRole or commandId, so it adds little beyond the schema.

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?

States a specific verb and resource ('Finalize a direct upload') and explicitly anchors it to the two-step flow with create_upload, so it is clearly distinguishable from siblings like create_upload, import_media, and prepare_media.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit preconditions (after PUTting bytes to the uploadUrl from create_upload), explains the failure mode when that has not happened (400), and names the follow-up paths: wait_job(kind="media", id=mediaItemId) or a media.completed webhook.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.