Most AI agents today ship with a fixed list of tools hardcoded by their developers.

That works in prototypes, until a provider deprecates an endpoint, rate-limits the agent, changes its payload shape or suffers a quiet outage. The agent then halts, because it has no way to find an alternative on its own.

Runtime discovery moves tool selection into the agent's loop: given an intent, the agent asks a registry for compatible services, checks credentials and live health, calls the best candidate, and falls back if anything fails.

Here is a 4-step model to make autonomous tool selection reliable.

Step 1 - Describe the need, not the vendor
Agents reason in tasks ("send a transactional email", "verify an IBAN"), not brand names. A discovery layer should accept intent-based queries and map them to declared capabilities:

curl -s "https://agentnexus.app/api/public/discover?need=send%20a%20transactional%20email&limit=5"
The response returns matching services with live status, auth requirements and rate limits.

Step 2 - Filter by credentials before calling
A match that requires interactive OAuth is useless to an unattended agent holding only API keys. Each candidate should declare its auth contract up front:

Auth type: bearer, api_key, oauth2 or none
Placement: header or query parameter
Parameter name: e.g. Authorization, x-api-key
Filtering against the agent's credentials before any network call prevents avoidable 401 failures.

Step 3 - Separate live health from historical trust
An HTTP 200 just means the server is breathing. It does not prove the data is fresh or the schema unchanged. Agents need two separate signals:

current_health: the latest liveness, capability and schema checks.
trust.reliability_score: the track record over all stored probe samples.
If the top provider is down, the registry returns ranked alternatives (advisory, never auto-called).

Step 4 - Close the feedback loop
Probes only see synthetic checks. The strongest evidence comes from real agent runs. After a call, the agent reports the outcome:

curl -X POST https://agentnexus.app/api/public/report \
-H "content-type: application/json" \
-d '{"slug":"mailgun-api","outcome":"success","status_code":200,"latency_ms":420}'
What the logs reveal
Across 720+ MCP servers and APIs, we see many clients connect and call tools/list but never search. Listing the menu is not tool selection. The resilient pattern is: keep the prompt lean, discover on demand, verify health, call, report.

Try it live
Five live discovery scenarios (geolocation, payments, web search, comparing 3 APIs, fallback on outage), computed against the real registry:

https://agentnexus.app/demos

Originally published at https://agentnexus.app/articles/how-ai-agents-discover-tools