@motorbay/mcp 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tools.js CHANGED
@@ -1,5 +1,19 @@
1
1
  import { z } from "zod";
2
2
  const id = (what) => z.string().regex(/^\d{1,19}$/, "A Motorbay id is a string of digits").describe(what);
3
+ // What may go into the path for a plate or a VIN, as in the monday Worker,
4
+ // the apps and the SDKs (#76, #81): letters (Æ, Ø, Å too), digits, spaces
5
+ // and hyphens, 1 to 17 characters once trimmed. encodeURIComponent leaves
6
+ // `.` alone and fetch resolves a `..` segment, so `..` would otherwise send
7
+ // GET /v1/vehicles/ (Search vehicles, no filter).
8
+ // Trimmed first: space, tab, CR and LF at either end, the same set in every
9
+ // client (#87). zod's .trim() is String.prototype.trim, which takes more
10
+ // (U+FEFF, U+00A0, ...) than Python's strip and less in other places.
11
+ // .overwrite() is what .trim() is built on, so the tool's JSON schema stays
12
+ // a plain string with a pattern (a .transform() would change it).
13
+ const ENDS = /^[ \t\r\n]+|[ \t\r\n]+$/g;
14
+ const plateOrVin = (what) => z.string().overwrite((s) => s.replace(ENDS, ""))
15
+ .regex(/^[A-Za-z0-9ÆØÅæøå -]{1,17}$/, "A plate or a VIN is letters, digits, spaces and hyphens, 1 to 17 characters")
16
+ .describe(what);
3
17
  const vehicleId = id("The vehicle's Motorbay id (the `id` field from a vehicle lookup), e.g. \"1000123456\".");
4
18
  const page = z.number().int().min(1).optional().describe("Page number, from 1. Default 1.");
5
19
  const pageSize = z.number().int().min(1).max(50).optional().describe("Items per page, 1 to 50. Default 10.");
@@ -10,14 +24,14 @@ export const TOOLS = [
10
24
  title: "Vehicle by plate",
11
25
  path: "/v1/vehicles/plate/{plate}",
12
26
  description: `Look up a Danish vehicle by registration number (plate), e.g. "AB12345". Case, spaces and hyphens are ignored. Returns make, model, variant, VIN, kind, color, first registration date, registration status and the vehicle's id, which the other vehicle tools take. Plates are reused: this returns the vehicle currently registered with the plate; use search_vehicles with registrationNumber for every vehicle that has carried it. ${SOURCE}`,
13
- input: { plate: z.string().min(1).max(20).describe("Danish registration number, e.g. \"AB12345\" or \"ab 12 345\".") },
27
+ input: { plate: plateOrVin("Danish registration number, e.g. \"AB12345\" or \"ab 12 345\".") },
14
28
  },
15
29
  {
16
30
  name: "get_vehicle_by_vin",
17
31
  title: "Vehicle by VIN",
18
32
  path: "/v1/vehicles/vin/{vin}",
19
33
  description: `Look up a vehicle in the Danish register by VIN (chassis/frame number). Returns the same fields as get_vehicle_by_plate, including the id used by the other vehicle tools. ${SOURCE}`,
20
- input: { vin: z.string().min(1).max(40).describe("Vehicle identification number, e.g. \"WVWZZZAUZKW123456\".") },
34
+ input: { vin: plateOrVin("Vehicle identification number, e.g. \"WVWZZZAUZKW123456\".") },
21
35
  },
22
36
  {
23
37
  name: "get_vehicle",
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.1.3";
1
+ export const VERSION = "0.1.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motorbay/mcp",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "MCP server for the Motorbay API: Danish vehicle data from Motorstyrelsen's public weekly extract.",
5
5
  "license": "MIT",
6
6
  "type": "module",