Open Context Protocol is live! 🚀 Read the launch post

listMedia

Read a list of Media resources associated with a specific Message resource

Details

  • Method: GET
  • Path: /2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media.json
  • Operation ID: ListMedia

Parameters

{
  "AccountSid": {
    "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resources.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "MessageSid": {
    "description": "The SID of the Message resource that is associated with the Media resources.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "DateCreated": {
    "description": "Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "DateCreated<": {
    "description": "Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "DateCreated>": {
    "description": "Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "PageSize": {
    "description": "How many resources to return in each list page. The default is 50, and the maximum is 1000.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int64"
  },
  "Page": {
    "description": "The page index. This value is simply for client state.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "PageToken": {
    "description": "The page token. This is provided by the API.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "title": "ListMediaResponse",
  "type": "object",
  "properties": {
    "media_list": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "account_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AC[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource."
          },
          "content_type": {
            "type": "string",
            "nullable": true,
            "description": "The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`."
          },
          "date_created": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in GMT when this Media resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "date_updated": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in GMT when this Media resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "parent_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^(SM|MM)[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the Message resource that is associated with this Media resource."
          },
          "sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^ME[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The unique string that identifies this Media resource."
          },
          "uri": {
            "type": "string",
            "nullable": true,
            "description": "The URI of this Media resource, relative to `https://api.twilio.com`."
          }
        }
      }
    },
    "end": {
      "type": "integer"
    },
    "first_page_uri": {
      "format": "uri",
      "type": "string"
    },
    "next_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "page": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "previous_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "start": {
      "type": "integer"
    },
    "uri": {
      "format": "uri",
      "type": "string"
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('twilio')

# Call this tool
result = await agent.call_tool('listMedia', {
    # Add required parameters here
})