cd /news/ai-agents/mcp-has-no-concept-of-tool-order-her… · home › topics › ai-agents › article
[ARTICLE · art-176155] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

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.

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 playbook: Designing agent systems
by read1 min views1 publishedNov 25, 2026
MCP Has No Concept of Tool Order — Here's How to Enforce It Anyway
Image: Dev.to
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"]:


        return {

            "isError": True,

            "content": [{"type": "text", "text": "call tool_a first — tool_b requires its output"}],

        }

── more in #ai-agents 4 stories · sorted by recency
── more on @mcp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/mcp-has-no-concept-o…] indexed:0 read:1min 2026-11-25 · —