Skip to main content
Glama

send_image

Create and publish a Bluesky post with an image, including text content and alternative text for accessibility.

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
NameRequiredDescriptionDefault
textYes
image_dataYes
image_altYes
profile_identifyNo
reply_toNo
langsNo
facetsNo

Implementation Reference

  • The main handler function for the 'send_image' tool. Decorated with @mcp.tool(), it decodes base64-encoded image data, constructs a Bluesky post with the image and optional parameters, sends it via the authenticated Bluesky client, and returns the post URI/CID on success or an error message.
    @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}

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/gwbischof/bluesky-social-mcp'

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