Skip to main content
Glama
TwitterAPIs

twitterapis

twitter_media_upload

Upload base64-encoded image data to X and receive a media_id for attaching to tweets, enabling direct media sharing.

Instructions

Upload an image to X and get a media_id to attach to a tweet via twitter_create_tweet's media_ids. Provide media_data as base64-encoded image bytes. Acts as your registered account session (register first with twitter_customer_session or twitter_user_login, or pass auth_token/ct0 for this call). Returns ok and the media_id. Only base64 image data is supported over this tool's JSON transport.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ct0NoOptional. The account's ct0 cookie, paired with auth_token. Sent as the x-ct0 header.
proxy_urlNoOptional. Residential proxy URL to egress this call through. Recommended for writes: X soft-blocks writes from datacenter IPs as automated. Sent as the x-proxy-url header.
auth_tokenNoOptional. The account's auth_token cookie, to act AS that account for this call (must be paired with ct0). Sent as the x-auth-token header; never placed in the URL.
media_dataYesBase64-encoded image bytes to upload. Sent in the JSON request body.
user_agentNoOptional. User-Agent string to send for this session. Sent as the x-user-agent header.
Behavior4/5

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

With annotations already marking the tool as non-read-only and non-destructive, the description adds valuable context: it acts as the registered account session, supports only base64 image data over JSON transport, and returns ok and the media_id. This goes beyond the structured annotations without contradicting them.

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 four sentences with no filler. It front-loads the core action and return value, then provides essential auth and format constraints. Every sentence contributes distinct, useful information.

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

Completeness4/5

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

Given the tool has 5 parameters, no output schema, and rich descriptions in the schema, the description covers the essential operational context: purpose, prerequisites, supported input format, and return shape. It could mention success/failure details or size limits, but it is sufficiently complete for an agent to invoke it correctly when paired with the schema.

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 reinforces the meaning of media_data and the auth_token/ct0 pairing, but does not add substantial new parameter semantics beyond what the schema already documents. The return-value mention is useful but not parameter-specific.

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?

The description opens with a specific verb and resource: 'Upload an image to X and get a media_id to attach to a tweet via twitter_create_tweet's media_ids.' This clearly states the tool's function and distinguishes it from read-only Twitter tools and the media_status sibling by emphasizing the upload-and-return-media_id flow.

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

Usage Guidelines4/5

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

The description gives clear usage context: it is for uploading images meant to be attached to tweets, it names the dependent tool (twitter_create_tweet), and it explains the required session setup ('register first with twitter_customer_session or twitter_user_login, or pass auth_token/ct0 for this call'). It does not explicitly list exclusions or alternative upload tools, but such alternatives are not evident among siblings.

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/TwitterAPIs/twitterapis-mcp'

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