Update Media Caption


Changes the caption of a media item in the media library. The caption is the short text usually displayed below the media on the site.

Property Value
Ability slug mosmcp/media-update-caption
Wire tool name mosmcp__media-update-caption
Category Media (mosmcp-media)
Plan Free

 

Required access

Requirement Value
Capability edit_post (checked against the specific post)
Minimum default role Contributor
Annotations readOnly: false · destructive: false · idempotent: false · openWorld: true

 

Input schema

Field Type Required Default Description
id integer (min 1) Yes — The ID of the media item to update.
caption string Yes — The new caption. May be an empty string to clear it.

 

Output schema

Field Type Required
id integer Yes
title string Yes
caption string Yes
edit_url string

 

Example

Sample prompt
Change the caption on image 318 to 'Our summer collection'.

Example request (json)

{
  "jsonrpc": "2.0",
  "id": 99,
  "method": "tools/call",
  "params": {
    "name": "mosmcp__media-update-caption",
    "arguments": {
      "input": {
        "id": 318,
        "caption": "Our summer collection"
      }
    }
  }
}

Example response (json)

{
  "jsonrpc": "2.0",
  "id": 99,
  "result": {
    "isError": false,
    "structuredContent": {
      "id": 318,
      "title": "summer-banner",
      "caption": "Our summer collection",
      "edit_url": "https://example.com/wp-admin/post.php?post=318&action=edit"
    }
  }
}

 

Edge cases / errors

  • id does not exist or is not an attachment → not-found error (media_not_found).
  • Caller cannot edit that attachment (e.g. a Contributor targeting someone else's upload) → permission denied.
  • The caption is sanitized as plain text: HTML tags and line breaks are removed. An empty string clears it.
  • WordPress fails to save the change → its error is returned as-is.

 


<< Previous Next >>
Update Image Alt Text Update Media Description

For more information about the Secure MCP Server for WordPress plugin, explore the following resources:

Product Overview | Pricing | Try for Free | Documentation

If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.