# Open Deals agent guide

Open Deals is a car marketplace for buying and selling vehicles. Agents can search public listings, read listing details, check enabled public auctions and read saved items with permission from the account owner.

## Base URLs

- Production site: https://opendeals.run
- Production app: https://app.opendeals.run
- Development site: https://dev.opendeals.run
- Development app: https://app.dev.opendeals.run
- Relative links and examples use the origin serving this guide. Keep tokens on the environment where they were created.

## Start here

- [Guide](/AGENTS.md)
- [Site overview](/llms.txt)
- [Full action schemas](/llms-full.txt)
- [OpenAPI](/openapi.json)
- [API docs](/api/docs)
- [MCP](/api/mcp)
- [Agent connections](/agents)
- [Live registry](/api/agent/v1/actions)

Use the live registry at `/api/agent/v1/actions` for the action schemas and current availability. The static reference includes the optional auction action.

## Authorization

Public reads work anonymously. Browser cookies do not authorize agent reads.
For private reads, sign in at [Agents](/agents) and create a personal token in Connections. Name it, choose `favourites:read` and/or `saved_searches:read` and/or `garage:read` and copy the secret once. An empty scope list permits public reads only. Tokens last 90 days by default, configurable from 1 to 365 days. Revoke a token in Connections.
Send the token as `Authorization: Bearer <token>`. Keep the secret in an environment variable or credential store.

## REST

Send `{"input":{…}}` as JSON to `POST /api/agent/v1/actions/{name}`. A successful response is the backing read result.

```sh
origin='https://opendeals.run' # use the origin where you found this guide
curl -fsS "$origin/api/agent/v1/actions/search_listings" \
  -H 'Content-Type: application/json' -d '{"input":{"page":1}}'
curl -fsS "$origin/api/agent/v1/actions/list_my_favourites" \
  -H "Authorization: Bearer $OPENDEALS_AGENT_TOKEN" \
  -H 'Content-Type: application/json' -d '{"input":{}}'
```

## MCP

Use stateless Streamable HTTP with JSON responses at `POST /api/mcp`. The optional `/mcp` alias requires the host nginx configuration. Send the protocol version returned by initialize on subsequent calls. Add the same bearer header for scoped tools.

```sh
mcp() {
  curl -fsS "$origin/api/mcp" -H 'Content-Type: application/json' \
    -H 'Accept: application/json, text/event-stream' "$@"
}
mcp -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
version='2025-11-25' # replace with result.protocolVersion if different
mcp -H "MCP-Protocol-Version: $version" -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
mcp -H "MCP-Protocol-Version: $version" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
mcp -H "MCP-Protocol-Version: $version" -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_listings","arguments":{"page":1}}}'
```

## Errors and limits

- `400 invalid_request` — check the JSON input schema.
- `401 auth_required` — supply a personal token for a scoped REST read.
- `401 invalid_token` — check the Bearer challenge. The token may be invalid, expired or revoked. This also applies before MCP dispatch.
- `403 insufficient_scope` — create a token with the action’s scope.
- `404 unknown_action` or `not_found` — check the registry and resource visibility.
- `429 rate_limited` — wait for `Retry-After`.
- Scoped MCP tool errors use `isError: true` and `structuredContent.code`.
- REST and MCP share 120 requests per minute per token or anonymous IP. Invalid credentials have a separate limit per IP. The body limit is 64 KiB. Token creation is limited to 10 requests per minute per account.

## Verify results

Compare the REST response with MCP `result.structuredContent` for the same search. Empty results are valid. Use a returned positive listing ID as a string in `view_listing`, then compare the details with `/carro/{id}`. For a scoped read, compare the data with the signed-in account. Revoke the token and repeat the request to verify HTTP 401.

The agent API offers reads only. It offers no write actions, A2A service or agent card.

## Actions

- `search_listings` (public) — Search public vehicle listings. Results use the marketplace sort and pagination. Partner entries have negative IDs and link to their fleet via partner.externalId. Backing read: `GET /api/listings`.
- `view_listing` (public) — Read a public listing by its positive ID, including related listings. Backing read: `GET /api/listings/{id}`.
- `buyer_shortlist` (public) — Turn a plain-language car request into structured filters and return up to 6 genuine listings ranked by transparent, field-based score components, with reasons, unknown fields and real-only price position (needs 8+ comparables). Read-only: it never saves, contacts, bids or buys. Location and seller type are reported as unsupported. Backing read: `POST /api/buyer/runs`.
- `view_auction_status` (public) — Read the public status of an auction. Available when auctions are enabled. Backing read: `GET /api/auctions/{id}`.
- `list_my_favourites` (favourites:read) — Read the token owner’s saved listings and price alert status. Backing read: `GET /api/favourites`.
- `list_my_saved_searches` (saved_searches:read) — Read the token owner’s saved search filters and alert settings. Backing read: `GET /api/alerts`.
- `list_my_garage` (garage:read) — Read the token owner’s saved vehicles (user-entered make, model, year, mileage, fuel) and upcoming inspection, insurance and service reminders. No plate, VIN or history is stored. Backing read: `GET /api/garage`.
- `search_parts` (public) — Search the curated real automotive parts catalogue by keyword, OEM reference, category, or vehicle fitment. Backing read: `GET /api/parts`.
- `view_part` (public) — Read a curated real part by its positive ID, including OEM references, licensed photos, fitment, and offers. Backing read: `GET /api/parts/{id}`.
- `find_parts` (public) — Parse a natural-language part request, OEM/part number, or vehicle context and return separated curated real parts and labeled example matches with honest fitment confidence. Backing read: `POST /api/parts/finder`.
