Skip to main content
Glama
phuihock
by phuihock

image_classification

Classify images using AI to identify content and objects through computer vision analysis.

Instructions

Classify an image using DeepInfra OpenAI-compatible API with multimodal model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'image_classification' tool. It takes an image URL, uses a configurable vision model (default: openai/gpt-4o-mini via DeepInfra) to analyze and classify the image contents, prompting for JSON output with categories and confidence scores.
    async def image_classification(image_url: str) -> str:
        """Classify an image using DeepInfra OpenAI-compatible API with multimodal model."""
        model = DEFAULT_MODELS["image_classification"]
        try:
            response = await client.chat.completions.create(
                model=model,
                messages=[
                    {
                        "role": "user",
                        "content": [
                            {
                                "type": "text",
                                "text": "Analyze this image and classify what it shows. Provide the main categories and objects visible in the image with confidence scores. Format as JSON."
                            },
                            {
                                "type": "image_url",
                                "image_url": {"url": image_url}
                            }
                        ]
                    }
                ],
                max_tokens=500,
            )
            if response.choices:
                return response.choices[0].message.content
            else:
                return "Unable to classify image"
        except Exception as e:
            return f"Error classifying image: {type(e).__name__}: {str(e)}"
  • The @app.tool() decorator registers the image_classification function as an MCP tool, conditional on ENABLED_TOOLS configuration (lines 184).
    @app.tool()
  • Configuration of the default model for image_classification tool in DEFAULT_MODELS dictionary.
    "image_classification": os.getenv("MODEL_IMAGE_CLASSIFICATION", "openai/gpt-4o-mini"),
  • Function signature defining input (image_url: str) and output (str) schema for the tool, used by FastMCP for validation.
    async def image_classification(image_url: str) -> str:
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the API provider (DeepInfra) and model type (multimodal), but fails to describe critical behaviors such as rate limits, authentication needs, error handling, or what the classification output entails. For a tool with no annotations, this is insufficient.

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 a single, efficient sentence that directly states the tool's function and implementation. It avoids unnecessary words and is front-loaded with the core purpose. However, it could be slightly more structured by separating purpose from technical details.

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

Completeness3/5

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

Given the tool's complexity (image classification with an external API), no annotations, and an output schema (which reduces the need to describe return values), the description is minimally adequate. It covers the basic purpose and API context but lacks details on usage, parameters, and behavioral traits, making it incomplete for effective agent use.

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

Parameters3/5

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

The input schema has 1 parameter with 0% description coverage, meaning the schema provides no semantic details. The description doesn't add any parameter-specific information beyond implying an image is needed. It doesn't explain what 'image_url' should contain (e.g., format, size limits) or how it's used, leaving a significant gap.

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 tool's purpose: 'Classify an image' specifies the verb and resource, and 'using DeepInfra OpenAI-compatible API with multimodal model' adds implementation context. However, it doesn't explicitly distinguish this tool from sibling tools like 'zero_shot_image_classification' or 'object_detection', which prevents a score of 5.

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. It doesn't mention when to choose this over 'zero_shot_image_classification' or 'object_detection', nor does it specify prerequisites or exclusions. This lack of usage context leaves the agent without direction.

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/phuihock/mcp-deeinfra'

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