Skip to main content
Glama

get-vehicle-images

Get vehicle images by make and model, with optional filters for year, trim, color, angle, photo type, and more. Retrieve photos of interior, exterior, or engine from specified views.

Instructions

Get vehicle images by make, model, and optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
makeYesVehicle make (required)
modelYesVehicle model (required)
yearNoVehicle year (optional)
trimNoVehicle trim (optional)
colorNoVehicle color (optional)
transparentNoTransparent background (optional)
angleNoAngle: front, side, back (optional)
photoTypeNointerior, exterior, engine (optional)
sizeNoSmall, Medium, Large, Wallpaper, All (optional)
licenseNoPublic, Share, ShareCommercially, Modify, ModifyCommercially (optional)
formatNojson or xml (optional, default: json)

Implementation Reference

  • The async handler function that executes the 'get-vehicle-images' tool logic: processes input params, makes API request to CarsXE 'images' endpoint, and returns formatted vehicle image results.
      async (params) => {
        // Convert all params to string for the API
        const stringParams: Record<string, string> = {};
        for (const [key, value] of Object.entries(params)) {
          if (typeof value === "boolean") {
            stringParams[key] = value ? "true" : "false";
          } else if (value !== undefined) {
            stringParams[key] = String(value);
          }
        }
        const apiKey = getApiKey();
        if (!apiKey) {
          return {
            content: [
              {
                type: "text",
                text: "❌ API key not provided. Please ensure X-API-Key header is set.",
              },
            ],
          };
        }
    
        const data = await carsxeApiRequest<CarsXEImagesResponse>(
          "images",
          stringParams,
          apiKey,
        );
        if (!data) {
          return {
            content: [
              {
                type: "text",
                text: "❌ Failed to retrieve images. Please check your parameters and try again.",
              },
            ],
          };
        }
        return {
          content: [
            {
              type: "text",
              text: formatImagesResponse(data),
            },
          ],
        };
      },
    );
  • Zod schema defining input parameters: make (required), model (required), year, trim, color, transparent, angle, photoType, size, license, format (all optional).
    {
      make: z.string().describe("Vehicle make (required)"),
      model: z.string().describe("Vehicle model (required)"),
      year: z.string().optional().describe("Vehicle year (optional)"),
      trim: z.string().optional().describe("Vehicle trim (optional)"),
      color: z.string().optional().describe("Vehicle color (optional)"),
      transparent: z
        .boolean()
        .optional()
        .describe("Transparent background (optional)"),
      angle: z
        .string()
        .optional()
        .describe("Angle: front, side, back (optional)"),
      photoType: z
        .string()
        .optional()
        .describe("interior, exterior, engine (optional)"),
      size: z
        .string()
        .optional()
        .describe("Small, Medium, Large, Wallpaper, All (optional)"),
      license: z
        .string()
        .optional()
        .describe(
          "Public, Share, ShareCommercially, Modify, ModifyCommercially (optional)",
        ),
      format: z
        .string()
        .optional()
        .describe("json or xml (optional, default: json)"),
    },
  • The function that registers the tool with the MCP server using server.tool('get-vehicle-images', ...) with schema and handler.
    export function registerGetVehicleImagesTool(
      server: McpServer,
      getApiKey: () => string | null,
    ) {
      server.tool(
        "get-vehicle-images",
        "Get vehicle images by make, model, and optional filters",
        {
          make: z.string().describe("Vehicle make (required)"),
          model: z.string().describe("Vehicle model (required)"),
          year: z.string().optional().describe("Vehicle year (optional)"),
          trim: z.string().optional().describe("Vehicle trim (optional)"),
          color: z.string().optional().describe("Vehicle color (optional)"),
          transparent: z
            .boolean()
            .optional()
            .describe("Transparent background (optional)"),
          angle: z
            .string()
            .optional()
            .describe("Angle: front, side, back (optional)"),
          photoType: z
            .string()
            .optional()
            .describe("interior, exterior, engine (optional)"),
          size: z
            .string()
            .optional()
            .describe("Small, Medium, Large, Wallpaper, All (optional)"),
          license: z
            .string()
            .optional()
            .describe(
              "Public, Share, ShareCommercially, Modify, ModifyCommercially (optional)",
            ),
          format: z
            .string()
            .optional()
            .describe("json or xml (optional, default: json)"),
        },
        async (params) => {
          // Convert all params to string for the API
          const stringParams: Record<string, string> = {};
          for (const [key, value] of Object.entries(params)) {
            if (typeof value === "boolean") {
              stringParams[key] = value ? "true" : "false";
            } else if (value !== undefined) {
              stringParams[key] = String(value);
            }
          }
          const apiKey = getApiKey();
          if (!apiKey) {
            return {
              content: [
                {
                  type: "text",
                  text: "❌ API key not provided. Please ensure X-API-Key header is set.",
                },
              ],
            };
          }
    
          const data = await carsxeApiRequest<CarsXEImagesResponse>(
            "images",
            stringParams,
            apiKey,
          );
          if (!data) {
            return {
              content: [
                {
                  type: "text",
                  text: "❌ Failed to retrieve images. Please check your parameters and try again.",
                },
              ],
            };
          }
          return {
            content: [
              {
                type: "text",
                text: formatImagesResponse(data),
              },
            ],
          };
        },
      );
    }
  • src/MyMCP.ts:38-46 (registration)
    Registration call in the MyMCP class (CloudFlare Workers MCP agent).
        registerGetVehicleImagesTool(this.server, getApiKey);
        registerGetVehicleRecallsTool(this.server, getApiKey);
        registerVinOcrTool(this.server, getApiKey);
        registerGetYearMakeModelTool(this.server, getApiKey);
        registerDecodeObdCodeTool(this.server, getApiKey);
        registerRecognizePlateImageTool(this.server, getApiKey);
        registerGetLienTheftTool(this.server, getApiKey);
      }
    }
  • src/index.gcp.ts:54-61 (registration)
    Registration call in the GCP/HTTP server entry point.
      registerGetVehicleImagesTool(server, getApiKey);
      registerGetVehicleRecallsTool(server, getApiKey);
      registerVinOcrTool(server, getApiKey);
      registerGetYearMakeModelTool(server, getApiKey);
      registerDecodeObdCodeTool(server, getApiKey);
      registerRecognizePlateImageTool(server, getApiKey);
      registerGetLienTheftTool(server, getApiKey);
    }
  • Helper function that formats the CarsXE images API response into a human-readable markdown string showing image links, thumbnails, dimensions, etc.
    export function formatImagesResponse(data: CarsXEImagesResponse): string {
      if (!data.success) {
        return `❌ Failed to retrieve images. ${data.error || ""}`;
      }
      if (!data.images?.length) {
        return "No images found for the specified vehicle.";
      }
      const lines = [
        "### 🖼️ Vehicle Images",
        data.query
          ? `**Query:** ${Object.entries(data.query)
              .map(([k, v]) => `\`${k}\`: ${v}`)
              .join(", ")}`
          : "",
        "",
        ...data.images
          .slice(0, 5)
          .map((img, i) =>
            [
              `**Image ${i + 1}:**`,
              `- [Full Image Link](${img.link})`,
              img.thumbnailLink ? `- [Thumbnail](${img.thumbnailLink})` : null,
              img.contextLink ? `- [Source Page](${img.contextLink})` : null,
              img.mime ? `- **Type:** ${img.mime}` : null,
              img.width && img.height
                ? `- **Dimensions:** ${img.width}×${img.height}`
                : null,
              img.byteSize ? `- **Size:** ${img.byteSize} bytes` : null,
              img.accentColor ? `- **Accent Color:** #${img.accentColor}` : null,
              img.datePublished
                ? `- **Published:** ${img.datePublished.split("T")[0]}`
                : null,
            ]
              .filter(Boolean)
              .join("\n"),
          ),
        data.images.length > 5
          ? `...and ${data.images.length - 5} more images.`
          : "",
      ];
      return lines.filter(Boolean).join("\n\n");
    }
  • Generic API request helper that constructs the URL and calls the CarsXE API with the provided endpoint and parameters.
    export async function carsxeApiRequest<T>(
      endpoint: string,
      params: Record<string, string>,
      apiKey: string
    ): Promise<T | null> {
      const CARSXE_API_BASE = "https://api.carsxe.com";
      const queryParams = new URLSearchParams({
        key: apiKey,
        source: "mcp",
        ...params,
      });
      const url = `${CARSXE_API_BASE}/${endpoint}?${queryParams.toString()}`;
      try {
        const response = await fetch(url);
        if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
        return (await response.json()) as T;
      } catch (error) {
        console.error(`Error making CarsXE request to ${endpoint}:`, error);
        return null;
      }
    }
  • TypeScript interface for the CarsXE images API response (CarsXEImagesResponse).
    export interface CarsXEImagesResponse {
      success: boolean;
      error?: string;
      images?: Array<{
        mime: string;
        link: string;
        contextLink?: string;
        height?: number;
        width?: number;
        byteSize?: number;
        thumbnailLink?: string;
        thumbnailHeight?: number;
        thumbnailWidth?: number;
        hostPageDomainFriendlyName?: string;
        accentColor?: string;
        datePublished?: string;
      }>;
      query?: Record<string, any>;
    }
Behavior2/5

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

With no annotations, the description must cover behavioral traits, but it only says 'Get vehicle images' without disclosing return format, authentication, rate limits, or error behavior.

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

Conciseness5/5

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

Single sentence, 9 words, no redundancy. Front-loaded with key information.

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?

For an 11-parameter tool with no output schema, the description is too sparse. It does not explain how images are delivered, what filtering combinations work, or any limitations.

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?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no extra meaning beyond summarizing their purpose.

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

Purpose5/5

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

The description clearly states the action (Get) and resource (vehicle images) with filtering criteria (by make, model, optional filters), distinguishing it from sibling tools that handle decoding or valuation.

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?

No guidance on when to use this tool versus alternatives, prerequisites, or limitations. The description implies retrieval but does not specify context for use.

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/carsxe/carsxe-mcp-server'

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