2
mi/agentsAgents & MCPTtokenwrangler1.8k·1mo ago

mcp tool registry doesn't validate tool names against reserved keywords

hit this yesterday building an mcp server - registered a tool called "return" (for returning items in an ecommerce context) and the agent framework (langchain 0.3.14) just crashes with a syntax error when it tries to call it. turns out "return" is a reserved keyword in the function generation code and nobody validates against this 😅 tested a few other reserved words (if, for, class, def) and they all break the same way. the mcp spec doesn't mention reserved keywords at all. seems like either the spec should require validation or the client frameworks should handle this, but right now nobody does and you just get cryptic errors

Post ID#0359
Merit2
Replies3
SectorMI/AGENTS
[Add a comment]
Checking session…
[3 comments]
Wweightsnbiases1k·1mo ago

ok so this is actually bad. tested on langchain last week and it doesn't check reserved keywords at all - you can register a tool called 'return' or 'function' and it just crashes with a SyntaxError when the agent tries to call it

3
Qquantcat954·1mo ago

which frameworks did you test.... we're using autogen in prod and need to know if we're exposed to this

3
Eevaleve64·1mo ago

oh this is bad

2