A Cost Model for Token Consumption of Hypermedia and the Model-Context-Protocol in Agentic LoopsRecent interest in LLM agents has created demand for agent-to-tool protocols, mechanisms by which agents can perform actions with remote systems.

Abstract

Recent interest in LLM agents has created demand for agent-to-tool protocols, mechanisms by which agents can perform actions with remote systems. Two potential architectural approaches to these protocols are hypermedia, the architectural style underlying the World Wide Web, and Remote Procedure Calls (RPC). The Model Context Protocol (MCP) is a prominent example of the RPC approach currently being deployed for agent-to-tool communication. Hypermedia and MCP differ along two largely independent axes: how data is represented and how available actions are discovered. In this paper we present a cost model for token consumption in the concatenative reasoning and acting (ReAct) loop and show that it is quadratic in the number of tool-use cycles. Using this model we distinguish two possible sources of efficiency difference between hypermedia and MCP: representational efficiency , the per-observation token cost of a format, and architectural efficiency , the number of tool calls a discovery model requires to complete a task. We argue that both are plausible drivers of an efficiency gap and that the quadratic structure of the cost model makes the latter potentially decisive. We frame the question of which factor dominates as an open empirical problem.

1 Introduction

The World Wide Web (WWW) is a hypermedia system [4] characterized by hypermedia controls [7] such as links and forms provided by its hypermedia format, HTML, and interpreted and presented to users by hypermedia clients, i.e. browsers. This novel network architecture avoids the necessity of communicating fixed API information: all such information is communicated within the responses themselves, using hypermedia as the engine of application state. Over three decades this architecture has scaled to billions of users and services, demonstrating the remarkable power and flexibility of hypermedia.

Recently AI systems based on Large Language Models (LLMs) have gained significant attention in the professional, academic, and popular worlds. Such systems are increasingly being deployed in an “agentic” role: LLM agents are being used to perform long-running, general tasks on behalf of a user with minimal prompting and intervention.

In order to be effective in this role, agents must often have access to external tools which allow them to investigate and manipulate their environment. This need has led to proposals for new agent-to-tool and agent-to-agent protocols. Anthropic Inc. has proposed the Model Context Protocol (MCP) [2] in this space. MCP defines a JSON-RPC based interface through which agents can discover and invoke tools exposed by servers. MCP has seen rapid adoption, with thousands of integrations within its first year [19].

To veteran hypermedia practitioners this may sound familiar: agents need to interact with unfamiliar remote systems (tools) to discover what functionality is available to them and then interact with that system in order to achieve a goal. This is exactly the problem that hypermedia solved so effectively for The Web: could hypermedia also be a solution in this new, agentic context?

Hypermedia and MCP differ along two largely independent axes. The first is representation: hypermedia formats such as HTML carry markup and navigational controls alongside data, whereas MCP returns compact, data-oriented JSON. The second is discovery architecture: hypermedia reveals available actions progressively, through links and forms embedded in each response, whereas MCP discloses its full tool catalog up front. Either axis could, in principle, account for a difference in the token cost of completing an agentic task, and the two need not point in the same direction.

In this paper we make the relationship between these two axes precise. We present a cost model for the token consumption of the concatenative reasoning and action (ReAct) loop [18] and show that it is quadratic in the number of tool-use cycles. We then use the model to separate two distinct, testable explanations for any efficiency difference between hypermedia and MCP, which we term representational efficiency and architectural efficiency.

This paper makes the following contributions:

    A cost model formalizing the token consumption of the ReAct agent loop, showing that total consumption is quadratic in the number of tool-use cycles.\

    A distinction between representational and architectural efficiency as separate, testable explanations for token-cost differences between hypermedia and MCP, derived directly from the terms of the cost model.\

2 Background

2.1 Hypermedia and RPC

Distributed hypermedia is characterized by a distinct approach to network architecture in which the network actions are communicated via hypermedia controls embedded in response content [4, 5]. This allows hypermedia-based systems to evolve dynamically over time in a manner that is difficult for fixed-format, RPC style systems. Hypermedia systems do not need to provide schemas or other documentation for their remote interface. Instead, actions are selected by users based on the affordances [6, 13] provided by hypermedia clients based on hypermedia responses. In this manner we say that users “discover” the actions available in the response of hypermedia servers and then act on those options based on their needs and goals.

This highly dynamic, late-bound approach to communicating networked operations to clients can be contrasted with the RPC-style network architecture, which relies on fixed schemas and the function-call metaphor. In an RPC system, available operations are defined ahead of time in a schema or interface definition that both client and server must share. Clients must know the names, parameter types, and calling conventions of remote procedures before any interaction can occur.

Crucially, this means that changes to the server's interface require corresponding updates to clients, creating a tight coupling between the two that does not exist in hypermedia approaches. Further, the function-call metaphor implies a flat action space: all operations are presented at the same level of abstraction, rather than being contextually offered based on the current state of the interaction. Where a hypermedia system guides users through a workflow by presenting relevant actions at each step, an RPC system presents its full catalog of operations and relies on the client to determine which are applicable in a given context.

2.2 Agentic AI and The ReAct Paradigm

Agentic AI is a form of artificial intelligence that can make decisions, plan, and act with minimal human intervention. It uses an iterative style of planning to solve problems that require multi-step, complex, and real-time decisions.

The ReAct paradigm [18] is a formalized approach to agentic reasoning, in which reasoning and acting are combined in a single iterative loop. At each step of this paradigm, an agent produces a thought that reasons about the current state of affairs, selects an action to perform, and observes the result. To the hypermedia practitioner, this think-act-observe loop closely mimics the way that humans interact with hypermedia systems: selecting actions based on the affordances presented to them.

In order to act effectively, ReAct agents are given access to tools, typically defined as callable functions. These functions are then invoked by the agent as it attempts to make progress towards its goal. The model does not execute a predetermined plan; rather, at each step it decides, based on the results of previous iterations, whether to gather more information, try a different approach, or conclude.

Note that in the ReAct paradigm, interactions with the LLM are stateless, and the entire conversation is re-processed at each step of the loop in a concatenative manner. This means that token efficiency, that is, the total number of tokens produced by tool invocations, is extremely important because these responses compound in future iterations of the ReAct loop.

2.3 Model Context Protocol

The Model Context Protocol (MCP) [2] is an open, model-agnostic protocol developed by Anthropic that standardizes how LLM agents discover and invoke external tools. MCP adopts a client-server architecture in which an MCP server exposes a catalog of tools, each described by a name, a natural-language description, and a JSON schema defining its input parameters [1]. Communication between client and server uses JSON-RPC 2.0 [9], giving MCP the RPC-style characteristics discussed in Section 2.1.

Tool discovery in MCP is a single, up-front operation. A client issues a tools/list request and receives the complete tool catalog in one response. The agent can then invoke any tool by name, supplying arguments that conform to the declared schema. This contrasts sharply with the incremental, interaction-driven discovery model of hypermedia: where a hypermedia client learns what actions are available by following links and inspecting forms in each response, an MCP client receives the full action space before any domain interaction occurs.

2.4 HTML and Markdown as Agentic Formats

HTML does not immediately appear to be an efficient format for agentic tooling interactions. It is based on SGML and includes significant redundant information. While HTML compresses very well, this is not useful for agentic tooling, where token counts rather than bytes are what is billed against. Nonetheless, HTML can be streamlined significantly for agentic workloads by adopting a minimalist approach to the language that strips away unnecessary nesting and elements used for purely aesthetic reasons.

While HTML does have obvious weaknesses as an agentic tool format, it also has strengths derived from its hypermedia nature [7, 14]. The most significant of these is that discoverability is carried by the responses themselves—through hypermedia controls such as links and forms, in concert with the underlying HTTP methods that act on them—rather than through a dedicated protocol-level catalog mechanism. This also allows tool providers to return context-sensitive actions as affordances embedded in responses, in a manner not possible with MCP's “discover up front” approach. Recent work on signifiers in hypermedia multi-agent systems [16] demonstrates how agents can discover and reason about interaction possibilities through hypermedia affordances exposed at runtime.

Markdown is a more compact hypermedia format. It supports a subset of HTML (headers, lists, tables, hyperlinks) but has no native form syntax; forms may be preserved as embedded HTML. Cloudflare's “Markdown for Agents” [12] recently reported up to an 80% token reduction over HTML. Markdown thus offers a way to vary the representational costs of a hypermedia interface while holding its discovery architecture constant.

3 A Cost Model for Agentic Tool Use

We can formalize the compounding cost of the ReAct loop. Let s denote the number of tokens in the system prompt (including tool definitions), and let r, a, and o denote the average number of tokens consumed by the reasoning, action, and observation components of a single ReAct cycle, respectively. We define the per-cycle token increment as k = r + a + o. After n tool-use cycles, the context window contains C(n) = s + nk tokens.

Because the entire context is re-processed at each cycle, the input to the LLM at cycle i is C(i − 1) = s + (i − 1)k tokens: the system prompt plus the accumulated history from all prior cycles. After n tool-use cycles, the agent makes a final call against the full context C(n) to produce its answer.

The cumulative token cost is therefore:

begin{align} T(n) &= sum {i=1}^{n} C(i-1) + C(n) end{align} (1)

begin{align} &= sum {i=0}^{n} (s + ik) end{align} (2)

begin{align} &= (n+1),s + k,frac{n(n+1)}{2}, end{align} (3)

which is O(n2) in the number of cycles.

In practice, the observation component dominates: tool results (database rows, API responses, HTML documents) are typically far larger than the reasoning or action tokens, so or + a and ko. Under this simplification:

begin{equation} T(n) approx (n+1),s + frac{o,n^2}{2} end{equation} (4)


This quadratic relationship has a direct bearing on any comparison of tool protocols. Because hypermedia responses may differ in token cost from MCP's JSON responses, even modest per-observation differences are amplified quadratically over a multi-step task. A protocol that produces observations averaging o1 tokens versus one averaging o2 tokens will, over n cycles, differ in cumulative cost by approximately $frac{(o1 - o2),n^2}{2}$ tokens.

More significantly, tool architectures that increase the number of tool calls, n, needed to complete a task will suffer quadratic (rather than linear) increases in total token consumption.

4 Representational and Architectural Efficiency

Equation 4 isolates two terms through which a tool protocol can influence total token cost: the per-observation size o and the number of tool-use cycles n. These correspond to the two axes along which hypermedia and MCP differ, and they motivate two distinct notions of efficiency.

Representational efficiency concerns the o term: the number of tokens a format consumes to convey a given observation. This is the axis on which HTML is most often criticized, as its markup carries redundant structure relative to the compact JSON returned by MCP. Markdown occupies an intermediate position, conveying the same hypermedia content as HTML in fewer tokens [12]. A representational account of any hypermedia/MCP efficiency gap holds that the gap is driven primarily by the verbosity of the format: reduce o, and the gap narrows.

Architectural efficiency concerns the n term: the number of tool calls a discovery model requires to complete a task. Hypermedia reveals functionality progressively, so an agent may need several interactions to navigate from an entry point to the data it needs, whereas MCP exposes its full catalog in a single discovery step. An architectural account holds that the gap is driven primarily by this difference in tool call counts rather than by per-response verbosity.

The two accounts make different predictions. Because o enters Equation 4 linearly while n enters quadratically, a difference in tool call counts is amplified relative to an equivalent proportional difference in per-observation size. This suggests that architectural efficiency may dominate representational efficiency in determining total cost, but the cost model alone does not settle the question: the relative magnitudes of o and n for real hypermedia and MCP interfaces are an empirical matter.

Table 1 summarizes the broader set of architectural differences between the two approaches, of which discovery and representation are the two most directly implicated in token cost. The remaining properties—coupling, state management, visibility, and evolvability—bear on other trade-offs between the approaches but are outside the scope of this cost model.

Table 1: Architectural comparison of hypermedia and MCP interfaces. Representation governs the o term of Equation 4; discovery governs the n term.

Property

Hypermedia (HTML)

MCP (JSON-RPC)

Discovery

Dynamic: follow links/forms

Static: tools/list catalog

Representation

HTML (controls + content)

JSON (data-oriented)

State management

Server-driven

Client-driven

Coupling

Loose: URLs can change

Tight: tool names are API

Visibility

Intermediaries can inspect

Opaque to intermediaries

Evolvability

Server can add/remove links

Schema changes break clients

Separating these two notions of efficiency matters because they imply different remedies. If a hypermedia/MCP gap is primarily representational, it can be addressed by adopting more compact hypermedia formats. If it is primarily architectural, closing the gap instead requires reducing the number of tool calls, for example by designing hypermedia interfaces that surface more information earlier, or by replacing the concatenative ReAct loop with architectures that do not re-process the full history at every step [3, 10, 11, 17].

5 Related Work

A small but important body of work has addressed hypermedia in the context of agentic workflows. Vachtsevanou et al. [16] investigate the effectiveness of hypermedia in multi-agent systems, introducing the concept of signifiers as a first-class abstraction. Ricci et al. [15] defend hypermedia in an agentic context, arguing that MCP suffers from the traditional criticisms of RPC-based approaches, notably a lack of open-ended discovery, and propose that hypermedia can complement MCP-style approaches within their Agents & Artifacts meta-model. Ilin [8] analyzes hypermedia within the context of knowledge architectures and proposes that both MCP and Web of Things standards can be consolidated into hypermedia-described web resources based on discoverable affordances. These works argue for hypermedia on architectural grounds; our cost model contributes a quantitative basis on which such arguments can be evaluated.

6 Conclusion and Future Work

We have presented a cost model for the token consumption of the concatenative ReAct loop and shown that it is quadratic in the number of tool-use cycles. Using this model we distinguished two explanations for any token-cost difference between hypermedia and MCP: representational efficiency, governed by the per-observation size o, and architectural efficiency, governed by the number of tool calls n. The quadratic structure of the model suggests that the architectural term may dominate, but which factor in fact accounts for the difference between real hypermedia and MCP interfaces is an empirical question that the model leaves open.

We regard a controlled empirical study isolating these two factors as the natural next step, and one we intend to pursue.

Source


    Imported from ACM’s structured HTML source. ACM Reference Format: Carson Gross and Matthew Revelle. 2026. A Cost Model for Token Consumption of Hypermedia and the Model-Context-Protocol in Agentic Loops. In 37th ACM Conference on Hypertext (HT '26), September 14--18, 2026, London, United Kingdom. ACM, New York, NY, USA 4 Pages. https://doi.org/10.1145/3800935.3830851

References

[1] Anthropic. 2024. Model Context Protocol Architecture Overview. Retrieved April 25, 2026 from https://modelcontextprotocol.io/docs/learn/architecture.

[2] Anthropic. 2024. Model Context Protocol Specification. Retrieved April 25, 2026 from https://modelcontextprotocol.io/specification.

[3] Lutfi Eren Erdogan, Nicholas Lee, Sehoon Kim, Suhong Moon, Hiroki Furuta, Gopala Anumanchipalli, Kurt Keutzer, and Amir Gholami. 2025. Plan-and-Act: Improving Planning of Agents for Long-Horizon Tasks. In Proceedings of the 42nd International Conference on Machine Learning (ICML ’25).

[4] Roy Thomas Fielding. 2000. Architectural Styles and the Design of Network-Based Software Architectures. Ph. D. Dissertation. University of California, Irvine.

[5] Roy Thomas Fielding and Richard N. Taylor. 2002. Principled Design of the Modern Web Architecture. ACM Transactions on Internet Technology 2, 2 (2002), 115–150. https://doi.org/10.1145/514183.514185

[6] William W. Gaver. 1991. Technology Affordances. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI ’91). ACM, 79–84. https://doi.org/10.1145/108844.108856

[7] Carson Gross, Dillon Shaffer, and Matthew Revelle. 2024. Hypermedia Controls: Feral to Formal. In Proceedings of the 35th ACM Conference on Hypertext and Social Media (HT ’24). ACM, New York, NY, USA. https://doi.org/10.1145/3648188.3675127

[8] Maksim Ilin. 2025. Converging Hypermedia, Protocols, and Knowledge Architectures: A New Paradigm for Grounded and Interoperable LLM-Agent Systems. In CEUR Workshop Proceedings.

[9] JSON-RPC Working Group. 2013. JSON-RPC 2.0 Specification. Retrieved April 25, 2026 from https://www.jsonrpc.org/specification.

[10] Sehoon Kim, Suhong Moon, Ryan Tabrizi, Nicholas Lee, Michael W. Mahoney, Kurt Keutzer, and Amir Gholami. 2024. An LLM Compiler for Parallel Function Calling. In Proceedings of the 41st International Conference on Machine Learning (ICML ’24)(PMLR 235). 24370–24391.

[11] Anton Bulle Labate, Valesca Moura de Sousa, Sandro Rama Fiorini, Leonardo Guerreiro Azevedo, Raphael Melo Thiago, and Viviane Torres da Silva. 2025. Solving Context Window Overflow in AI Agents. arXiv preprint arXiv:2511.22729 (2025).

[12] Celso Martinho and Will Allen. 2026. Introducing Markdown for Agents. Cloudflare Blog. Retrieved April 25, 2026 from https://blog.cloudflare.com/markdown-for-agents/.

[13] Joanna McGrenere and Wayne Ho. 2000. Affordances: Clarifying and Evolving a Concept. In Proceedings of Graphics Interface 2000. Montreal, Canada, 179–186.

[14] Alexander William Petros, Carson Gross, Dillon Shaffer, and Matthew Revelle. 2025. The Missing Mechanic: Behavioral Affordances as the Limiting Factor in Generalizing HTML Controls. In Proceedings of the 36th ACM Conference on Hypertext and Social Media (HT ’25). ACM, New York, NY, USA. https://doi.org/10.1145/3720553.3746684

[15] Alessandro Ricci and Andrei Ciortea. 2025. Empowering the Concept of Tool in Agentic AI: Co-evolving AI Agents and Environments with A&A and Hypermedia MAS. In Proceedings of the 22nd European Conference on Multi-Agent Systems (EUMAS ’25).

[16] Danai Vachtsevanou, Andrei Ciortea, Simon Mayer, and Jérémy Lemée. 2023. Signifiers as a First-Class Abstraction in Hypermedia Multi-Agent Systems. In Proceedings of the 22nd International Conference on Autonomous Agents and Multiagent Systems (AAMAS ’23). IFAAMAS, London, United Kingdom.

[17] Qingyue Wang, Yanhe Fu, Yanan Cao, Shuai Wang, Zhiliang Tian, and Liang Ding. 2025. Recursively Summarizing Enables Long-Term Dialogue Memory in Large Language Models. Neurocomputing (2025). https://doi.org/10.1016/j.neucom.2025.130193

[18] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. In International Conference on Learning Representations (ICLR).

[19] Xingyao Zhang, Yiwen Song, Yanyu Xiong, Jialian Li, Yanjia Li, and Xiaodan Liang. 2025. MCP-AgentBench: Evaluating Real-World Language Agent Performance with MCP-Mediated Tools. arXiv preprint arXiv:2509.09734 (2025).

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime