AI Hints
Home›MCP Tutorial›Cheat Sheets
MCP · Lesson 117 of 120

Common Mistakes

And fixes.

⏱ 2 min read▶ Video at 1:43:40🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

Let's finish the cheat sheets with the mistakes almost everyone makes once. Avoid these, and you'll save hours.

Common Mistakes
From the video: Common Mistakes
  • Everyone makes them
  • Avoid them
  • Save hours

Mistakes and fixes

Printing to standard output breaks standard IO servers. Vague descriptions confuse the model. Relative paths fail in host configs. Trusting arguments invites attacks. And raising plain exceptions hides the real error from the model.

MistakeFix
print() in a stdio serverlog to stderr
Vague descriptionsclear docstrings
Relative paths in configsfull paths
Trusting argumentsvalidate everything
Plain exceptionsraise ToolError

Before and after

A vague tool called get, with a one word description, leaves the model guessing. A tool called order status, with a clear description and a typed order number, tells it exactly what to do.

Before

  • def get(x)"Gets data."No types

After

  • def order_status(order_id: int)"Look up a Northwind order."Typed, validated

Summary

Log to standard error, describe tools clearly, use full paths, validate, and raise tool errors. Next, the MCP ecosystem.

Key takeaways
  • stderr
  • Clear docstrings
  • ToolError
Next up: The MCP Ecosystem — popular servers