Skip to main content
Glama

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
NameRequiredDescriptionDefault
base64_image_contentYes
filenameYes

Implementation Reference

  • 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']} """

Other Tools

Related 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/devhub/devhub-cms-mcp'

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