send_image
Send a post with an image on Bluesky Social by providing text, base64-encoded image data, alt text, and optional metadata like reply details or language codes.
Instructions
Send a post with a single image.
Args:
ctx: MCP context
text: Text content of the post
image_data: Base64-encoded image data
image_alt: Alternative text description for the image
profile_identify: Optional handle or DID for the post author
reply_to: Optional reply information dict with keys uri and cid
langs: Optional list of language codes
facets: Optional list of facets (mentions, links, etc.)
Returns:
Status of the post creation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| facets | No | ||
| image_alt | Yes | ||
| image_data | Yes | ||
| langs | No | ||
| profile_identify | No | ||
| reply_to | No | ||
| text | Yes |
Implementation Reference
- server.py:806-864 (handler)The handler function for the 'send_image' MCP tool. It handles input parameters, decodes the base64 image data, and uses the Bluesky client to post the image with accompanying text and optional parameters. The @mcp.tool() decorator registers it as a tool.@mcp.tool() def send_image( ctx: Context, text: str, image_data: str, image_alt: str, profile_identify: Optional[str] = None, reply_to: Optional[Dict[str, Any]] = None, langs: Optional[List[str]] = None, facets: Optional[List[Dict[str, Any]]] = None, ) -> Dict: """Send a post with a single image. Args: ctx: MCP context text: Text content of the post image_data: Base64-encoded image data image_alt: Alternative text description for the image profile_identify: Optional handle or DID for the post author reply_to: Optional reply information dict with keys uri and cid langs: Optional list of language codes facets: Optional list of facets (mentions, links, etc.) Returns: Status of the post creation """ try: bluesky_client = get_authenticated_client(ctx) # Decode base64 image try: image_bytes = base64.b64decode(image_data) except Exception as e: return { "status": "error", "message": f"Failed to decode image data: {str(e)}", } # Send the post with image post_response = bluesky_client.send_image( text=text, image=image_bytes, image_alt=image_alt, profile_identify=profile_identify, reply_to=reply_to, langs=langs, facets=facets, ) return { "status": "success", "message": "Post with image created successfully", "post_uri": post_response.uri, "post_cid": post_response.cid, } except Exception as e: error_msg = f"Failed to create post with image: {str(e)}" return {"status": "error", "message": error_msg}
- server.py:806-806 (registration)The @mcp.tool() decorator registers the send_image function as an MCP tool named 'send_image'.@mcp.tool()