Find (and optionally pay) the best service for a need
route_by_intentGiven a plain-language description of what you need, find, and optionally pay in the same call, the single best payable catalog service, so you do not have to pick among listings yourself. Use it instead of search_services when you want the right service for a task rather than a list to browse: it ranks candidates on Nevermined's own relevance and quality signals (deterministic; no model reads the merchant listings), applies a fail-closed payability gate (listed, healthy, moderated, x402/mpp, not flagged unpayable) and a relevance floor, and returns the winner as chosen (with its opaque invoke handle, never a raw host) plus a ranked shortlist; every shortlist item carries a closed matchReason, gateReason, per-item rankingSource, and one scale-specific score. With autoPay:false (the default) it returns the pick only and charges nothing; the next step is normally get_service on chosen.slug, then pay_service with the endpoint you need. With autoPay:true it also pays the winner through the same path as pay_service and returns the upstream call in result: result.status and result.body are the vendor's answer, and result.paid: true means a payment was attempted, not that it settled, so read result.payment.status (Settled, Issued or Failed). autoPay calls the winner at its base URL plus any path you pass, and you only learn the winner from this call, so it suits single-endpoint services; a multi-endpoint winner typically answers 404 at its base URL. autoPay requires requestId; an API-key caller must also pass delegationId, while an OAuth-connected caller spends from the grant it approved and needs none. Outcomes: matches, but none could be chosen (or nothing matched while semantic ranking is down) → {"status":"no_fundable_match"} (broaden the intent or filters; nothing charged); payable matches that are all too weak to choose → the same status with reason: "below_relevance_floor", and no match at all → reason: "no_match" (for either, rephrase the intent to name the capability concretely or relax filters, or browse with search_services; nothing charged); the close match is unhealthy or held by moderation right now → the same status with reason: "relevant_candidate_unavailable" (retry later, or browse with search_services; nothing charged); close matches that all fail to return the media named in wantedMedia → the same status with reason: "media_mismatch" and wantedMedia as applied (browse with search_services, or pin a slug in filters.require; nothing charged); on autoPay, a close match sold for Nevermined credits only, with nothing else to choose → the same status with reason: "credits_only" and its slug (pay it with pay_service and no delegationId, from your credits; nothing charged); on autoPay while semantic ranking is unavailable → {"status":"autopay_unavailable"} (the Router will not pay a keyword-only pick: retry later with the same requestId, or call without autoPay and pay the pick with pay_service; nothing charged). Relevance compares what you wrote with how each listing describes itself; when you list the media you need back in wantedMedia (an image, audio or a video), it also chooses only a service it records as returning each of them (from some endpoint; audio beside video is not checked separately, and the Router does not verify that a returned video has sound), unless you pin one with filters.require. The Router never infers the media from the intent, so set wantedMedia whenever you need media back. It checks what the winner returns, not what it accepts, so a need that combines several steps can still get a pick that does only one: for such a need, select without autoPay and check the winner with get_service before you pay. Other outcomes: missing_autopay_fields (nothing charged); on autoPay, payment_indeterminate (check list_payments, and retry only with the same requestId) and already_paid (this requestId already carries a payment, see paymentId; nothing new billed, and it does not by itself say whether the original succeeded). Every pick and each of these outcomes carries an instructions string with the next step; a payment the Router declines on autoPay comes back as a tool error carrying the API's message. Requires your Nevermined API key on the Authorization header.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"intent": "<intent>"
},
"name": "route_by_intent"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Request body for the paid call (autoPay only). | |
| path | No | Subpath appended to the winner when paying (autoPay only). | |
| limit | No | Shortlist size to return (1–20, default 5). | |
| intent | Yes | Plain-language description of the service you need (e.g. "translate English to German"). | |
| method | No | HTTP method for the paid call (autoPay only). | |
| search | No | Query string (no leading ?) for the paid call (autoPay only). | |
| autoPay | No | When true, also pay and relay the winner in the same call (same path as pay_service); requires requestId, plus delegationId when you authenticate with an API key. Default false → return the pick only, no charge. A paid body too large or binary to inline comes back as `result.bodyOmitted`, as pay_service describes for `responseOmitted`. | |
| filters | No | Optional structured narrowing; all fields optional. | |
| headers | No | Extra headers for the paid call (autoPay only). | |
| requestId | No | Idempotency key — REQUIRED when autoPay is true. | |
| wantedMedia | No | The media you need the chosen service to return. Set it whenever you need an image, audio or a video back, for example `["video"]` to dub a video or `["audio"]` for text to speech; leave it unset for text or data. When set, only a service recorded as returning each of them (from some endpoint) is chosen (a `filters.require` pin is exempt); `audio` beside `video` is not checked separately (the Router does not verify that a returned video has sound), and when no close match does, the result is `no_fundable_match` with `reason: "media_mismatch"` (the API's BCK.ROUTER.0053). The Router never infers it from `intent`. | |
| delegationId | No | Delegation to charge on autoPay. Required when you authenticate with an API key; an OAuth-connected caller spends from the grant it approved, so it can omit this (a value there does not choose the delegation). | |
| maxTotalCents | No | Refuse a paid quote above this (fee-inclusive), before purchase (autoPay only). | |
| credentialHeader | No | Header the Router should carry the minted payment credential in on the paid hop (autoPay only). Send it only when the winning service needs its own auth AND a payment credential (e.g. "Payment"). Ignored when autoPay is false. |