MCP Has No Concept of Tool Order — Here's How to Enforce It Anyway A developer demonstrated a pattern for enforcing tool-call ordering in MCP servers, which have no built-in concept of tool order. The approach tracks per-session state and returns a structured isError response when a dependent tool is invoked before its prerequisite, avoiding exceptions that would kill the connection. session state = {} session id - {"step a done": False} def tool b session id, kwargs : state = session state.setdefault session id, {"step a done": False} if not state "step a done" : a normal tool error, not an exception that kills the connection return { "isError": True, "content": {"type": "text", "text": "call tool a first — tool b requires its output"} , } ... do the real work