Skip to main content
Glama

send_images

Create Bluesky posts with up to 4 images, including text, alt descriptions, and optional features like replies or language tags.

Instructions

Send a post with multiple images (up to 4).

Args:
    ctx: MCP context
    text: Text content of the post
    images_data: List of base64-encoded image data (max 4)
    image_alts: Optional list of alt text for each 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
images_dataYes
image_altsNo
profile_identifyNo
reply_toNo
langsNo
facetsNo

Implementation Reference

  • The MCP tool handler for "send_images". This function is decorated with @mcp.tool() which registers it as an MCP tool. It validates input, decodes base64-encoded image data, and uses the authenticated Bluesky client to send a post with up to 4 images.
    @mcp.tool()
    def send_images(
        ctx: Context,
        text: str,
        images_data: List[str],
        image_alts: Optional[List[str]] = None,
        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 multiple images (up to 4).
    
        Args:
            ctx: MCP context
            text: Text content of the post
            images_data: List of base64-encoded image data (max 4)
            image_alts: Optional list of alt text for each 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)
    
            # Verify we have 1-4 images
            if not images_data:
                return {
                    "status": "error",
                    "message": "At least one image is required",
                }
    
            if len(images_data) > 4:
                return {
                    "status": "error",
                    "message": "Maximum of 4 images allowed",
                }
    
            # Decode all images
            images_bytes = []
            for img_data in images_data:
                try:
                    image_bytes = base64.b64decode(img_data)
                    images_bytes.append(image_bytes)
                except Exception as e:
                    return {
                        "status": "error",
                        "message": f"Failed to decode image data: {str(e)}",
                    }
    
            # Send the post with images
            post_response = bluesky_client.send_images(
                text=text,
                images=images_bytes,
                image_alts=image_alts,
                profile_identify=profile_identify,
                reply_to=reply_to,
                langs=langs,
                facets=facets,
            )
    
            return {
                "status": "success",
                "message": "Post with images created successfully",
                "post_uri": post_response.uri,
                "post_cid": post_response.cid,
            }
        except Exception as e:
            error_msg = f"Failed to create post with images: {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