Skip to content

MCP workflows

These workflows show how an assistant can use the Pingdex tools together. Each one lists the scopes it needs and the tool calls involved. You can give an assistant the steps as a prompt, or read them as a checklist for your own process.

All examples use synthetic values.

Scopes: providers:manage

A direct-post provider has a single commit leg. Give the assistant the buyer’s field list and endpoint, and ask it to draft the integration. A prompt might read:

Draft a Pingdex direct-post provider named “Buyer One”. It posts JSON to https://buyer.example/post. Map email and postcode from the lead payload, add a static Source of pingdex, and send an API key from a secret called api_token. Treat Accepted in status as accepted.

The assistant should produce arguments like these:

{
"name": "Buyer One",
"enabled": false,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"encoding": "json",
"fields": {
"Email": { "type": "field", "source": "payload.email", "transform": "lower" },
"Postcode": { "type": "field", "source": "payload.postcode", "transform": "upper" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
},
"response": {
"accepted": "status",
"accepted_values": ["Accepted"],
"rejected_values": ["Rejected"],
"transaction_id": "data.id",
"rejection_reason": "data.reason"
}
}
]
},
"secrets": { "api_token": "<the buyer's API key>" }
}

Keep these points in mind:

  • Build the integration to the integration specification. Field mappings are covered in Request mapping and Response mapping.
  • Leave enabled as false until you have tested.
  • Secrets are written by name and never returned. The integration refers to them with { "type": "secret", "secret": "api_token" }, so the value itself never appears in the integration.
  • Put any buyer authentication headers in headers, keyed by leg name, for example { "post": { "Authorization": "Bearer ..." } }.
  • Avoid pasting real credentials into a chat if you can. Where your client allows it, have the assistant leave the secret value for you to set separately.

Scopes: providers:manage

Always check a draft before you save it.

  1. Call validate_provider with the draft arguments from the previous workflow.
  2. If it returns an error, read the path and reason, for example legs.0.request.fields: empty. Fix the draft and validate again.
  3. When it returns { "valid": true }, call create_provider with the same arguments.
  4. Call get_provider with the returned id and check that secret_names lists api_token and header_leg_names lists the legs you expected.

To check a change to an existing provider, pass its id to validate_provider together with the new draft. Pingdex validates the draft against that provider’s stored headers and secrets, so you do not need to resend them, and the stored provider is not changed. Then call update_provider with the full document to apply it.

Scopes: providers:manage, campaigns:manage

A highest_bid campaign asks each quote-capable provider for a bid and posts the lead to the winner. Its providers must have a quote leg followed by a commit leg. See Routing and eligibility.

  1. Call list_providers and pick the providers to assign. Each must use a quote then commit integration. A direct-post provider is not compatible with highest_bid.
  2. Call create_campaign with the strategy, a lead schema and the provider ids.
  3. Call get_campaign to confirm the schema, routing strategy and provider order.
  4. Enable the campaign with update_campaign when you are ready to accept leads.

Example arguments for create_campaign:

{
"name": "Home insurance, UK (test)",
"description": "Test campaign for the spring comparison page.",
"enabled": false,
"routing_strategy": "highest_bid",
"schema": [
{ "name": "email", "type": "string", "required": true },
{ "name": "postcode", "type": "string", "required": true },
{ "name": "property_value", "type": "integer", "required": false },
{ "name": "marketing_consent", "type": "boolean", "required": true }
],
"provider_ids": [
"0b6f1e2a-3c4d-4e5f-8a9b-1c2d3e4f5a6b",
"7d8e9f0a-1b2c-4d3e-9f4a-5b6c7d8e9f01"
]
}

update_campaign replaces the campaign’s settings, so to enable it, fetch the campaign with get_campaign, change enabled to true, and send every field back. Use priority routing instead if your providers are direct-post providers. See Create a campaign and Lead schema.

Scopes: leads:ingest

Use an idempotency key so that an assistant that retries a call cannot create duplicate leads. Pass it as the idempotency_key argument, not as a header.

{
"campaign_id": "3e1a7c52-9b04-4d68-a2f1-6c8d0e5b7a93",
"external_id": "mcp-test-0001",
"idempotency_key": "mcp-test-0001",
"payload": {
"email": "alex.example@example.com",
"postcode": "XX2 2XX",
"marketing_consent": true
}
}

What to expect:

  • The first call returns the lead id and a status, normally received.
  • Calling again with the same key and the same campaign_id, external_id and payload returns the same lead. No second lead is created.
  • Calling with the same key and a different body returns the error Idempotency key was reused with a different request. Use a new key for a different lead.
  • A disabled campaign is rejected.
  • external_id alone does not prevent duplicates.

The result only confirms that Pingdex received the lead. Delivery happens afterwards. See Idempotency and Submit a lead.

Scopes: leads:read

Once a lead has been submitted, ask the assistant to follow it.

  1. Call get_lead with the lead id. Check status, commercial_status, selected_provider and latest_attempt.
  2. Call list_lead_attempts with the same id. Attempts are listed oldest first, so you can read them in the order they happened.
  3. For each attempt, look at leg_role, status, response_status, error_code and duration_ms. On a ping/post campaign, selected marks the quote that won, and bid_amount shows each provider’s bid.
  4. Fix the cause, then submit a new test lead with a new idempotency key.

If you do not have the lead id, call list_leads with campaign_id, external_id or a received_from and received_to window. Results are newest first. Use next_cursor as the cursor input to get the next page.

Lead and attempt reads never return the lead payload, buyer transaction ids or rejection reasons. If you need to see the rejection reason, use the dashboard. For what each status and error code means, see Lifecycle and statuses, Attempts and Lead troubleshooting.