Skip to main content
Glama
devhub

DevHub CMS MCP

Official
by devhub

upload_image

Add images to the DevHub CMS media gallery by uploading base64-encoded files in webp, jpeg, or png formats with specified filenames.

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 upload_image tool handler: uploads a base64-encoded image to the DevHub CMS media gallery using the API, returns image ID and 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']}
    """
  • Registration of the upload_image tool via the @mcp.tool() decorator on the FastMCP server instance.
    @mcp.tool()
  • Input schema defined by function parameters (base64_image_content: str, filename: str) and docstring describing usage and supported formats.
    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
        """
  • Helper function get_client() used by upload_image to obtain OAuth client and base URL for DevHub API calls.
    def get_client():
        """Get DevHub API client and base_url."""
        client = OAuth1Session(
            os.environ['DEVHUB_API_KEY'],
            client_secret=os.environ['DEVHUB_API_SECRET'])
        base_url = '{}/api/v2/'.format(os.environ['DEVHUB_BASE_URL'])
        return client, base_url
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the upload action and supported formats but lacks critical behavioral details: whether this requires authentication, what permissions are needed, whether it overwrites existing files with same names, what happens on success/failure, rate limits, or what the return value contains. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured with clear sections: purpose statement, format support, and parameter explanations. Each sentence earns its place by adding value. The information is front-loaded with the core purpose first. Minor improvement could be made by integrating parameter details more seamlessly rather than using a separate 'Args:' section.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It covers the basic action and parameters but misses critical context: authentication requirements, error handling, return values, file size limits, or what happens in the DevHub media gallery after upload. For a tool that modifies system state, this leaves too many unknowns for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantic context beyond the schema. While schema description coverage is 0% (titles only), the description explains that 'base64_image_content' should contain 'Base 64 encoded content of the image file' and 'filename' should be 'Filename including the extension' - providing crucial usage guidance not present in the bare schema. For 2 parameters, this adequately compensates for the low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Upload') and resource ('image to the DevHub media gallery'), making the purpose immediately understandable. It distinguishes from sibling tools like create_blog_post or get_locations by focusing specifically on media uploads rather than content creation or data retrieval. However, it doesn't explicitly differentiate from potential similar upload tools (though none exist in the sibling list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While it mentions supported image formats (webp, jpeg, png), it doesn't explain when you'd choose this over other media handling methods or what prerequisites exist (like authentication requirements or file size limits). There's no mention of when-not-to-use scenarios or comparisons with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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