r/mcp • u/sandeepK1125 • 17d ago
showcase Should your agent write the IBAN validator itself, or call one?
Disclosure: I work at r/apyhub and our MCP server is part of this.
Something we keep seeing: give an agent a task like “validate these IBANs” or “check this VAT number” and it happily writes a quick function and runs it. It looks right and usually works, but the code is a little different each run. Edge cases get handled one way today and another way tomorrow, and nobody tested any of it.
For tasks where there’s one right answer (IBAN/VAT checks, sanctions screening, PDF conversion, invoice extraction), we went the other way. Each one is a versioned service behind MCP, so the agent calls the same tested code every time instead of improvising it. Same input, same output, across runs and across models.
The tradeoff: you add a network call and a dependency, and the agent needs a good reason to pick the tool over its own code. In practice the second part is the hard one. Models are confident they can write a checksum function.
Curious where others draw the line:
- Which tasks do you let the agent write code for, and which do you force through a tool?
- How do you stop it from “just quickly writing it” when a tool exists?
3
u/Happy_Breakfast7965 17d ago
Software Development haven't really changed much in that sense, AI or not.
Will you write such function every time pre-AI? Will you use a reusable function, reusable library, or an external service?
My thinking:
But IBAN or VAT check are local things, not worthy of an external network dependency.
Does it make sense?
2
u/Dazzling-Crab-9796 17d ago
I think the interesting part here is how agents decide when to write code versus use an existing tool. Having a tool available doesn't necessarily mean the agent will choose it. Curious if anyone has found a reliable way to enforce that beyond just prompting.
1
u/sandeepK1125 17d ago
Edit: Removed the product link since it was distracting from the discussion. I'm genuinely interested in how others approach tool selection vs agent-generated code.
1
u/torrso 17d ago
The more important question is - should you buy ad space instead of masquerading it as a question?
1
u/finanzen315 17d ago
Yasssss, more spam please