# MCP Has No Concept of Tool Order — Here's How to Enforce It Anyway

> Source: <https://dev.to/ramdai_bista/mcp-has-no-concept-of-tool-order-heres-how-to-enforce-it-anyway-3c4l>
> Published: 2026-11-25 14:32:24+00:00

**Recommendation:** When one MCP tool depends on another's output, gate it on per-session state and return a structured isError telling the model which tool to call first, rather than raising.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

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
