Menu

I approved the order. Then my Genkit Dart agent forgot its own tool.
πŸ“°

I approved the order. Then my Genkit Dart agent forgot its own tool.

DEV Community: dartΒ·Esra KadahΒ·about 9 hours ago
#Mt4MEE0G
#devtodart#devto#dev#tool#order_part
Reading 0:00
15s threshold

My agent asked me "can I order this part?". I said yes. And the answer came back as a failure:

finishReason: FinishReason.failed finishMessage: Tool order_part not found

Enter fullscreen mode

Exit fullscreen mode

The tool was right there. It had been found one step earlier, when the agent stopped to ask for approval. 🫠

I was building a dispatch assistant in pure Dart for a small, made-up field service company ( full write-up here ). Looking up a work order is free, booking a technician is free, but order_part costs money, so it waits for a person. It took me an evening to find out why the "yes" broke it, and the fix turned into my first PR to Genkit Dart. πŸ₯³

The setup: MCP tools behind an approval

The agent gets its tools from an MCP server and puts toolApproval middleware in front of them. Simplified from my agent:

final mcpTools = await mcpClient . getActiveTools ( ai ); // includes `work-orders/order_part`

final response = await ai .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.