Skip to main content
Glama

decode-vehicle-plate

Decode a vehicle's license plate to retrieve its VIN and essential vehicle details.

Instructions

Decode a vehicle's license plate to get VIN and basic vehicle info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plateYesLicense plate number
stateYesState abbreviation (e.g., CA)
countryNoCountry code (default: US)US

Implementation Reference

  • The registerDecodeVehiclePlateTool function registers the 'decode-vehicle-plate' MCP tool. It defines the handler logic: validates API key, calls carsxeApiRequest with the endpoint 'v2/platedecoder' passing plate/state/country, checks success, and returns formatted output via formatPlateDecoderResponse.
    export function registerDecodeVehiclePlateTool(
      server: McpServer,
      getApiKey: () => string | null,
    ) {
      server.tool(
        "decode-vehicle-plate",
        "Decode a vehicle's license plate to get VIN and basic vehicle info",
        {
          plate: z.string().min(1).describe("License plate number"),
          state: z.string().min(2).max(2).describe("State abbreviation (e.g., CA)"),
          country: z
            .string()
            .min(2)
            .max(2)
            .default("US")
            .describe("Country code (default: US)"),
        },
        async ({ plate, state, country }) => {
          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<CarsXEPlateDecoderResponse>(
            "v2/platedecoder",
            { plate, state, country },
            apiKey,
          );
          if (!data || !data.success) {
            return {
              content: [
                {
                  type: "text",
                  text: "❌ Failed to decode license plate. Please check the plate and state.",
                },
              ],
            };
          }
          return {
            content: [
              {
                type: "text",
                text: formatPlateDecoderResponse(data),
              },
            ],
          };
        },
      );
    }
  • Input schema for the tool: 'plate' (required string), 'state' (required 2-char string), 'country' (optional 2-char string, defaults to 'US'). Validated using Zod.
    {
      plate: z.string().min(1).describe("License plate number"),
      state: z.string().min(2).max(2).describe("State abbreviation (e.g., CA)"),
      country: z
        .string()
        .min(2)
        .max(2)
        .default("US")
        .describe("Country code (default: US)"),
    },
  • TypeScript interface CarsXEPlateDecoderResponse defining the response shape including success, input, description, make, model, trim, vin, style, year, assembly, fuel_type, color, body_style, engine_size, drive_type, transmission.
    export interface CarsXEPlateDecoderResponse {
      success: boolean;
      input: {
        plate: string;
        state: string;
        country: string;
      };
      description: string;
      make: string;
      model: string;
      trim: string;
      vin: string;
      style: string;
      year: string;
      assembly: string;
      fuel_type: string;
      color: string;
      body_style: string;
      engine_size: string;
      drive_type: string;
      transmission: string;
    }
  • src/MyMCP.ts:33-45 (registration)
    Registration call in MyMCP (Cloudflare Workers MCP Agent). registerDecodeVehiclePlateTool is invoked with the server instance and API key getter on line 34.
      registerGetVehicleSpecsTool(this.server, getApiKey);
      registerDecodeVehiclePlateTool(this.server, getApiKey);
      registerInternationalVinDecoderTool(this.server, getApiKey);
      registerGetMarketValueTool(this.server, getApiKey);
      registerGetVehicleHistoryTool(this.server, getApiKey);
      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:48-61 (registration)
    Registration call in the GCP/standalone HTTP server version. registerDecodeVehiclePlateTool is invoked inside registerAllTools on line 50.
    function registerAllTools(server: McpServer, getApiKey: () => string | null): void {
      registerGetVehicleSpecsTool(server, getApiKey);
      registerDecodeVehiclePlateTool(server, getApiKey);
      registerInternationalVinDecoderTool(server, getApiKey);
      registerGetMarketValueTool(server, getApiKey);
      registerGetVehicleHistoryTool(server, getApiKey);
      registerGetVehicleImagesTool(server, getApiKey);
      registerGetVehicleRecallsTool(server, getApiKey);
      registerVinOcrTool(server, getApiKey);
      registerGetYearMakeModelTool(server, getApiKey);
      registerDecodeObdCodeTool(server, getApiKey);
      registerRecognizePlateImageTool(server, getApiKey);
      registerGetLienTheftTool(server, getApiKey);
    }
  • Helper formatter that takes a CarsXEPlateDecoderResponse and produces a human-readable string with vehicle details (year, make, model, VIN, style, etc.)
    export function formatPlateDecoderResponse(
      data: CarsXEPlateDecoderResponse,
    ): string {
      const {
        year,
        make,
        model,
        trim,
        vin,
        style,
        assembly,
        fuel_type,
        color,
        body_style,
        engine_size,
        drive_type,
        transmission,
        description,
      } = data;
      return [
        `🚗 ${year} ${make} ${model} ${trim}`,
        `VIN: ${vin}`,
        `Style: ${style}`,
        `Body: ${body_style}`,
        `Color: ${color}`,
        `Engine: ${engine_size}`,
        `Fuel: ${fuel_type}`,
        `Drive: ${drive_type}`,
        `Transmission: ${transmission}`,
        `Assembly: ${assembly}`,
        `Description: ${description}`,
      ]
        .filter(Boolean)
        .join("\n");
    }
  • Generic API request helper used by the handler to call the CarsXE API endpoint v2/platedecoder.
    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;
      }
    }
Behavior2/5

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

No annotations are present, so the description bears full responsibility for behavioral disclosure. It merely restates the purpose, offering no details on data sources, failure modes, rate limits, or any side effects beyond decoding.

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, concise sentence with no wasted words. However, it lacks any structural elements like headings or bullet points that could improve readability.

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?

Without an output schema, the description should clarify what 'basic vehicle info' includes, but it only mentions VIN. This leaves the agent uncertain about the return format and completeness, especially given the rich sibling tool set.

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 coverage is 100%, with each parameter having a description. The description adds no extra meaning beyond the schema, so baseline score 3 is appropriate.

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 ('Decode') and the resource ('vehicle's license plate'), with a specific outcome ('get VIN and basic vehicle info'). It distinguishes from siblings like recognize-plate-image and vin-ocr, which deal with images or OCR.

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 usage guidance is provided. The description does not specify when to use this tool versus alternatives, nor does it mention prerequisites or scenarios to avoid.

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