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.
Scaffold a direct-post provider
Section titled “Scaffold a direct-post provider”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. Mappostcodefrom the lead payload, add a staticSourceofpingdex, and send an API key from a secret calledapi_token. TreatAcceptedinstatusas 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
enabledasfalseuntil 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.
Validate, then create
Section titled “Validate, then create”Scopes: providers:manage
Always check a draft before you save it.
- Call
validate_providerwith the draft arguments from the previous workflow. - If it returns an error, read the path and reason, for example
legs.0.request.fields: empty. Fix the draft and validate again. - When it returns
{ "valid": true }, callcreate_providerwith the same arguments. - Call
get_providerwith the returnedidand check thatsecret_nameslistsapi_tokenandheader_leg_nameslists 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.
Create a highest-bid campaign
Section titled “Create a highest-bid campaign”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.
- Call
list_providersand pick the providers to assign. Each must use a quote then commit integration. A direct-post provider is not compatible withhighest_bid. - Call
create_campaignwith the strategy, a lead schema and the provider ids. - Call
get_campaignto confirm the schema, routing strategy and provider order. - Enable the campaign with
update_campaignwhen 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.
Submit a test lead with idempotency
Section titled “Submit a test lead with idempotency”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
idand astatus, normallyreceived. - Calling again with the same key and the same
campaign_id,external_idandpayloadreturns 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_idalone does not prevent duplicates.
The result only confirms that Pingdex received the lead. Delivery happens afterwards. See Idempotency and Submit a lead.
Inspect attempts
Section titled “Inspect attempts”Scopes: leads:read
Once a lead has been submitted, ask the assistant to follow it.
- Call
get_leadwith the leadid. Checkstatus,commercial_status,selected_providerandlatest_attempt. - Call
list_lead_attemptswith the same id. Attempts are listed oldest first, so you can read them in the order they happened. - For each attempt, look at
leg_role,status,response_status,error_codeandduration_ms. On a ping/post campaign,selectedmarks the quote that won, andbid_amountshows each provider’s bid. - 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.