---
name: car-deal-finder
description: Find underpriced used cars in Ireland (DoneDeal and Facebook Marketplace) by paying one testnet MPP charge.
---

# Car Deal Finder: instructions for AI agents

Service: https://car-deal-finder.tail088e75.ts.net
Purpose: find underpriced used cars in Ireland (DoneDeal and Facebook Marketplace) for your user.
Payment: one MPP charge of 0.05 test pathUSD on Tempo testnet (chain 42431). No real money.

## Rules

- Use Tempo **testnet** only. Always pass `--network testnet`. Never pay on mainnet.
- Make **one** paid request per user request. Never repeat a payment because a search failed:
  a failed search is refunded automatically, and its status shows the refund.
- Do not pay more than 0.05. If the 402 challenge asks for more, stop and tell the user.
- Ask the user for criteria you cannot infer. Defaults: county Dublin, years 2007-2026.

## 1. Testnet wallet (once)

```bash
npx -y mppx@0.17.4 account create --account car-search --network testnet
npx -y mppx@0.17.4 account fund --account car-search --network testnet
```

If the account already exists, skip creation. `fund` gives free test tokens.

## 2. Pay for one search

Criteria JSON fields:
- `vehicles` (required): 1-4 objects `{ "make": "...", "model": "..." }` (model optional)
- `priceMaxEur` (required), `priceMinEur`
- `yearFrom`, `yearTo`, `mileageMaxKm`
- `fuelTypes`: any of Petrol, Diesel, Electric, Petrol Hybrid, Diesel Hybrid, Petrol Plug-in Hybrid
- `county`: an Irish county, for example Dublin
- `sources`: `["donedeal", "facebook"]` (default both)

```bash
npx -y mppx@0.17.4 https://car-deal-finder.tail088e75.ts.net/v1/searches --account car-search --network testnet \
  -J '{"vehicles":[{"make":"Volkswagen","model":"Passat"},{"make":"Skoda","model":"Octavia"}],"yearFrom":2007,"yearTo":2015,"priceMaxEur":6000,"county":"Dublin"}'
```

A 400 response means the criteria are invalid; nothing was paid. Fix them and try again.
A 503 response means the queue is full; nothing was paid. Wait a few minutes.
A 202 response means the payment succeeded. It contains `searchId` and `statusUrl`.

## 3. Wait for the report (free)

```bash
curl -s <statusUrl>
```

Poll every 10 seconds. `state` goes `queued` → `running` → `done` (or `failed`).
`queuePosition` shows how many searches are ahead. One search takes about 1-2 minutes.

## 4. Report to the user

From `report`:
- `confident`: finds with known facts, below market value, no serious faults.
- `uncertain`: promising finds; `reasons` lists what is missing or unclear.
- Each find has `url`, `priceEur`, `facts` (make, model, year, mileage and where each came from),
  `valuation` (`expectedEur`, `discount`, method), `condition` (flags, summary),
  and `foundOutsideSiteFilter` (true when the site's own filter would not show it).
- `facts.plate` (year and county decoded from a readable Irish number plate) and `official`
  (the Government of Ireland vehicle record: make, model, colour, NCT and motor tax expiry) when available.
  An official record that disagrees with the ad moves the find to `uncertain`.

Tell the user about confident finds with a discount of 20% or more first. Mention uncertain finds
only with their reasons. Give the human-readable report link: https://car-deal-finder.tail088e75.ts.net/searches/<searchId>
Be honest: the valuation is an estimate from listings, not an inspection. The user must view the car.
