upload_image
Upload and store images in the DevHub media gallery using base64-encoded content. Supports webp, jpeg, and png formats. Include a filename with the image for easy management.
Instructions
Upload an image to the DevHub media gallery
Supports webp, jpeg and png images
Args:
base64_image_content: Base 64 encoded content of the image file
filename: Filename including the extension
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base64_image_content | Yes | ||
| filename | Yes |
Implementation Reference
- src/devhub_cms_mcp/server.py:181-207 (handler)The @mcp.tool() decorated function implementing the upload_image tool. It handles base64-encoded image uploads to the DevHub CMS API, returning the image ID and absolute path.@mcp.tool() def upload_image(base64_image_content: str, filename: str) -> str: """Upload an image to the DevHub media gallery Supports webp, jpeg and png images Args: base64_image_content: Base 64 encoded content of the image file filename: Filename including the extension """ client, base_url = get_client() payload = { 'type': 'image', 'upload': { 'file': base64_image_content, 'filename': filename, } } r = client.post( '{}images/'.format(base_url), json=payload, ) image = r.json() return f""" Image ID: {image['id']} Image Path (for use in HTML src attributes): {image['absolute_path']} """