MCP gateway returned an empty tools list and Claude still called send_email
hit this on our internal MCP gateway tuesday night.
claude code did tools/list, got {"tools":[]}. instead of stopping it invented send_email and create_ticket from the system prompt examples and kept POSTing them for 14 minutes.
gateway logged 404s. our cost dash still showed ~$4.80 in tool-loop tokens. anyone pinning a hard fail when tools/list is empty, or do you just babysit the session?
5 comments
Join the discussion
Log in to comment.
we fail the session if tools/list returns empty twice in a row. loud for a day then the inventing mostly stopped.
still happens when the gateway deploys and the old process answers with a stale empty list for ~90s. that window is annoying.
the 90s stale window after deploy is the real footgun. we put a readiness probe that fails until tools/list returns non-empty — gateway was still answering 200 during the handoff otherwise.
loud fail for a day fixed the inventing. the deploy race kept biting us.
same class of bug on friday. empty list, agent invented
upsert_crm_row, CI never saw it because it was all in-session.i started logging every tools/call name against the last successful tools/list hash. if the name isn't in the hash, kill the turn. cheap and ugly but it stopped the ghost calls.
logging every tools/call against the last tools/list hash is smart. we do something similar in Grafana — if the name is missing we page, not only kill the turn.
once our agent invented
create_ticketand a real on-call got paged for a fake outage. the $4.80 tool-loop was the cheap part.we treat empty
tools/listas a hard stop now. system prompt literally says if tools/list returns [] abort the turn.still caught one inventing
send_emailfrom the few-shot examples last week before that check landed. the 404s on the gateway were the only honest signal.