Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

23 April 2026

15 Pages

Mitigating Execution Hallucinations and Computational Inflation in Agentic RAG via Strict Protocol Boundaries

,
and
College of Information and Intelligent Science and Technology, Hunan Agricultural University, Changsha 410125, China
*
Author to whom correspondence should be addressed.

Abstract

The deployment of large language models as autonomous retrieval agents over unstructured knowledge bases gives rise to a persistent structural conflict between probabilistic neural generation and deterministic physical execution. While agentic paradigms facilitate complex multi-hop retrieval, their unconstrained generative nature frequently violates strict syntactic requirements. This systemic vulnerability directly triggers execution hallucinations, such as fabricated API parameters or malformed schemas. Consequently, these syntax-driven failures force systems into redundant trial-and-error recovery loops, resulting in severe computational inflation that degrades both token efficiency and inference latency. To resolve this reliability–efficiency dilemma, this paper proposes RAG-CoT-MCP, a neuro-symbolic architecture that orthogonally decouples probabilistic cognitive planning from deterministic tool execution. By integrating the Model Context Protocol (MCP) as a strict system-level validation boundary, the framework ensures that latent reasoning trajectories manifest exclusively as syntactically valid operations. Exhaustive empirical evaluations across four disparate datasets—incorporating a multi-dimensional LLM-as-a-Judge framework, rigorous ablation studies, and granular cost tracking—validate the proposed approach. The findings demonstrate that RAG-CoT-MCP compresses network-level execution error rates from 45.2% (in unconstrained baselines) to a mere 6.0%, yielding substantial enhancements in semantic comprehensiveness and logical coherence compared to existing baselines. Counterintuitively, by proactively intercepting malformed actions and redirecting computational resources from reactive error handling to valid causal deduction, the framework drastically reduces redundant token consumption and achieves the lowest overall inference latency. Ultimately, this study establishes that deterministic execution constraints do not hinder agentic flexibility; rather, they serve as a fundamental prerequisite for deploying robust, high-speed, and cost-effective knowledge retrieval systems.

1. Introduction

Large Language Models (LLMs) are undergoing a rapid transition from passive text generators into autonomous agents capable of executing complex, goal-oriented tasks by interacting with external environments [1,2]. In the domain of knowledge-intensive tasks, Retrieval-Augmented Generation (RAG) has emerged as the standard paradigm to mitigate parametric hallucinations by grounding model responses in external knowledge bases [3,4]. Nevertheless, as user queries transition from elementary fact-checking to intricate, multi-hop reasoning over unstructured academic texts or nested APIs, the demands placed on retrieval architectures have undergone a fundamental shift. It is evident that traditional dense vector-based RAG systems, which rely on single-step semantic matching, frequently suffer from attention diffusion and semantic drift when navigating deeply intertwined logical chains [5,6].
In order to surmount the limitations of static retrieval, recent advancements have introduced agentic reasoning paradigms, such as Chain-of-Thought (CoT) combined with action generation (e.g., ReAct) [7]. These approaches endow LLMs with the capacity to dynamically plan, execute searches, and adjust their trajectories based on intermediate observations. Notwithstanding their theoretical flexibility, the deployment of these unconstrained reasoning agents in production environments exposes a critical structural vulnerability: a fundamental misalignment between the probabilistic nature of neural generation and the deterministic requirements of physical computer systems. Unconstrained agents frequently exhibit “execution hallucinations”, which manifest as the fabrication of API endpoints, the generation of malformed JSON payloads, or the hallucination of arguments during complex deductions [8,9]. These syntax-driven failures compel the agent to engage in costly and time-consuming trial-and-error recovery loops [10]. Consequently, it has been demonstrated that the sophisticated reasoning process is often subject to degeneration, resulting in a cycle of handling server errors that is characterized by a high degree of inefficiency. This cycle has been shown to have a significant impact on inference latency and computational token costs, both of which are elevated to a considerable degree.
To resolve this reliability–efficiency dilemma, this paper proposes RAG-CoT-MCP, a neuro-symbolic architecture that orthogonally decouples probabilistic cognitive planning from deterministic tool execution. By “orthogonal decoupling,” we mean that the system structurally separates the language model’s unconstrained reasoning process from the rigid syntactic demands of external databases. We achieve this by integrating the Model Context Protocol (MCP) as a strict system-level validation boundary [11]. Instead of forcing the language model to directly generate perfect API code—which often leads to execution hallucinations—our framework allows the model to freely construct its Chain-of-Thought reasoning steps internally. Subsequently, before any external tool is invoked, the MCP layer intercepts the proposed action and verifies it against deterministic API schemas. If the action is malformed, the MCP layer blocks the execution and returns a deterministic error trace back to the model for correction. This ensures that reasoning trajectories are grounded exclusively in syntactically valid operations, neutralizing syntax-driven failures without sacrificing the depth of agentic reasoning.
The primary contributions of this paper are summarized as follows:
  • Identification of Hidden Computational Inflation: We systematically quantify the system-level overhead caused by syntax-driven execution failures in unconstrained LLM agents. We demonstrate how reactive error handling and infinite recovery loops degrade overall system efficiency and inflate token consumption.
  • Proposal of a Neuro-Symbolic Architecture: We introduce the RAG-CoT-MCP framework, which establishes a strict deterministic execution boundary for probabilistic agents. This protocol-level integration effectively neutralizes execution hallucinations at the source and maintains highly fluid state transitions during deep reasoning tasks.
  • Comprehensive Multi-Dimensional Evaluation: Through rigorous benchmarking across four diverse datasets (Qasper, HotpotQA, 2WikiMultihopQA, and ToolBench), we empirically validate the proposed architecture. Utilizing a pairwise LLM-as-a-Judge evaluation framework and granular cost tracking, we prove that RAG-CoT-MCP achieves superior semantic comprehensiveness (e.g., up to an 89.8% win rate over vanilla RAG and a 67.5% win rate over unconstrained RAG-CoT on complex API tasks). Furthermore, by proactively intercepting malformed actions at the protocol level, the framework reduces the execution failure rate from 45.2% (unconstrained baseline) to a mere 6.0%. This structural constraint compresses the reactive token overhead by an order of magnitude (from 1845 to 185 tokens per query) and counterintuitively reduces the overall average inference latency to 21.97 s, proving its high efficiency.

3. Methodology

We formalize the LLM-based multi-hop retrieval task as a sequential decision-making process within a semi-structured environment. To clarify the scope of our approach, the proposed RAG-CoT-MCP architecture encompasses the entire closed-loop system illustrated in Figure 1. It consists of three interconnected modules:
Figure 1. The CoT-MCP Collaborative Framework.
  • User and Client (Initiation, left panel): This acts as the entry point, capturing the user’s initial natural language query and routing it through the MCP Host App controller.
  • LLM Brain (Cognition and Planning, central blue panel): This is the neural core of the framework. It receives the query and generates latent Chain-of-Thought (CoT) trajectories to dynamically plan and formulate candidate tool calls.
  • MCP Standard System (Execution and Tools, right panel): This serves as the deterministic physical boundary. It receives the proposed tool calls, rigorously validates them against predefined API schemas, and either executes valid actions against external resources (e.g., File Systems, Databases) or returns precise error traces for malformed requests.
The proposed architecture adheres to a neuro-symbolic paradigm by orthogonally decoupling probabilistic cognitive planning (Module 2) from deterministic tool execution (Module 3). To maintain strict architectural consistency and isolate the impact of the protocol layer during empirical evaluation, GLM-4.7 is deployed as the singular foundational reasoning engine across all neural planning phases.

3.1. Cognitive Planning Phase

Operating exclusively within the ‘LLM Brain’ module (the central blue component of Figure 1), the cognitive planning phase is driven by a large language model parameterized by θ (specifically, GLM-4.7) [21], which acts as the central reasoning agent. Given a user query q passed from the Initiation module and the interaction history at step t − 1 denoted as H t − 1 , the neural planner first samples a reasoning trajectory—the latent Chain-of-Thought variable z t —within the latent space:
z t   ~   P _ θ ( z t | q , H t − 1 )
Unlike traditional direct-action frameworks that eagerly generate API calls based on shallow context matching, this latent variable z t serves as an explicit cognitive prior. Conditioned on this structured reasoning trace, the model subsequently generates a candidate tool action a t rom the unconstrained action space A :
a ^ t ~ P _ θ ( a | q , H t − 1 , z t )
By explicitly defining θ as the GLM-4.7 engine throughout both the latent reasoning and action generation stages, the architecture ensures that complex semantic parsing relies on a consistent parametric memory before being subjected to symbolic validation.

3.2. Symbolic Protocol Layer

The candidate action a t generated by the neural planner is inherently probabilistic and prone to syntax errors. In conventional software engineering, malformed executions are typically handled via rigid exception-catching mechanisms. However, such unidirectional error handling fails to address the root cause of the neural planner’s hallucinations. To elevate this process from a mere engineering patch to a neuro-symbolic architecture, the Model Context Protocol (MCP) functions as an active, bidirectional symbolic boundary.
We define the valid action space A m C P as the strict subset of operations that perfectly conform to the pre-defined schemas of the target database APIs. The protocol layer applies a deterministic validation function V ( a t ) :
V ( a t ) = a t   ,             if   a t ∈ A m C P ∧ S c h e m a C h e c k ( a t ) = True ϵ e r r o r , otherwise
Crucially, when validation fails, the MCP layer does not merely abort the operation. Instead, it generates a deterministic, schema-grounded error trace ϵ e r r o r . This trace acts as a symbolic corrective signal—functionally analogous to a semantic gradient—that is immediately injected back into the cognitive state space:
H t   =   H t − 1 ⊕ ⟨ z t , a t , ϵ e r r o r ⟩
Consequently, during the subsequent planning phase, the new latent variable z t + 1 is mathematically forced to condition on this absolute physical constraint:
z t + 1 ∼ P θ ( z t + 1 | q , H t )
This bidirectional feedback loop ensures that the symbolic protocol actively reshapes the neural planner’s reasoning trajectory, effectively bridging the gap between approximate neural generation and exact symbolic logic.

3.3. Theoretical Bounds and System Stability

A fundamental limitation of existing autonomous agents is the lack of mathematical guarantees regarding execution stability. To address this, we formalize the execution cost and establish strict theoretical bounds using a bounded retry mechanism, parameterized by a maximum retry threshold τ m a x = 3.
Let P e ∈ 0 ,   1 denote the empirical probability of the neural planner generating a syntactically invalid tool call at any given reasoning step. In an unconstrained generative framework permitting infinite retries, the expected number of execution attempts E k follows a geometric distribution:
E [ k ] = ∑ k = 1 ∞   k ⋅ ( 1 − p e ) p e k − 1 = 1 1 − p e
During complex cognitive loads where parameter hallucination is severe, as P e → 1 , the expected execution cost E [ k ] → ∞ . This mathematical property directly explains the catastrophic infinite recovery loops observed in baseline models. By enforcing the strict upper bound τ m a x , our architecture deterministically caps the maximum number of interactions per logical step. Consequently, the probability of a systemic abort—defined as the system failing to produce a valid action after exhausting all retries—is strictly bounded by an exponential decay function:
P ( a b o r t ) = ( p e ) τ m a x
Given an empirical baseline failure rate of P e ≈ 0.28 (as observed in prompt-constrained models), the integration of the protocol layer combined with τ m a x = 3 exponentially compresses the theoretical abort probability to approximately 0.021.
Furthermore, assuming an entire multi-hop task requires a reasoning trajectory of length N , the worst-case time complexity of the RAG-CoT-MCP architecture is strictly constrained to O ( N ⋅ τ m a x ) . This formulation provides a rigorous mathematical guarantee that the inference latency remains strictly linear with respect to the reasoning depth, effectively eradicating the O ( ∞ ) instability inherent in unconstrained LLM agents.

4. Experiments

In order to provide a comprehensive evaluation of the effectiveness and generalizability of the proposed RAG-CoT-MCP architecture, a rigorous evaluation protocol was established. The objective of the experiments was twofold: firstly, to assess the framework in terms of retrieval accuracy; and secondly, to evaluate its execution robustness and computational efficiency under complex, multi-hop reasoning conditions.

4.1. Experimental Setup

4.1.1. Evaluation Datasets

To move beyond simplistic, single-hop question-answering tasks and rigorously stress-test the agentic execution boundaries, we curated a benchmark comprising four diverse datasets:
  • Qasper: A dataset designed for deep, multi-hop reasoning over complex academic full-text papers [22]. We constructed a local knowledge base consisting of 1585 full-text scientific papers to evaluate the model’s capacity for granular document navigation.
  • HotpotQA: A standard benchmark for open-domain multi-hop retrieval [23], utilized to evaluate the system’s cross-domain reasoning robustness.
  • 2WikiMultihopQA: A dataset emphasizing structured logical chains across multiple entities [24]. This was introduced to test the architecture’s resilience against semantic drift during extended reasoning trajectories.
  • ToolBench (Subset): A dataset tailored for complex API interactions [17]. This subset was specifically incorporated to challenge the agent’s ability to handle strict schema constraints and diverse tool invocations, directly evaluating the efficacy of the Model Context Protocol (MCP) layer.
In order to ensure the reproducibility of the experiments and to prevent selection bias, a stratified sampling strategy was employed in order to construct the evaluation subsets. Instead of utilizing simple random sampling, the original datasets were stratified based on reasoning complexity, namely the depth of the logical chains (e.g., 2-hop, 3-hop, and 4+ hop dependencies) and the diversity of the required tool schemas. Precisely 500 sample complex queries were extracted from each dataset, thereby ensuring an equitable distribution across all levels of difficulty. This rigorous sampling protocol guarantees that the evaluated subsets accurately reflect the long-horizon reasoning challenges inherent in the full corpora, while maintaining computational feasibility for extensive pairwise comparisons.

4.1.2. Baseline Architectures

The proposed framework was then compared against three established paradigms in order to isolate the impact of different architectural constraints. In order to facilitate a fair comparison and to isolate the architectural impact, GLM-4.7 was utilized as the foundational reasoning engine across all configurations.
  • Vanilla RAG: Employs standard dense vector-based retrieval (e.g., utilizing BGE-large embeddings) [5,25] and synthesizes answers through static semantic similarity search, serving as the fundamental non-agentic baseline.
  • RAG-CoT (Unconstrained): Enables the LLM to perform autonomous reasoning and multi-step search via the ReAct paradigm. However, it operates without any strict protocol-level execution constraints, allowing for unconstrained API parameter generation.
  • ReAct (Prompt-Constrained): An enhanced variant of RAG-CoT where the LLM is explicitly guided via meticulous system prompts to output API calls within a predefined JSON schema. This serves as an intermediate baseline to evaluate the efficacy of prompt engineering versus system-level protocol enforcement.
  • RAG-CoT-MCP (Ours): The proposed neuro-symbolic architecture, which integrates latent Chain-of-Thought reasoning at the planning level and enforces deterministic MCP-based schema validation at the execution boundary. For reproducibility, the GLM-4.7 foundational reasoning engine was strictly configured with a temperature of 0.1 to prioritize deterministic and logical outputs, a top_p of 0.9, and a maximum output token length of 2048. All experiments were conducted using a fixed random seed of 42. Furthermore, to bridge the gap between our mathematical formulations and practical implementation, a detailed algorithmic representation of the execution loop and sample MCP tool schemas are provided in our public open-source repository.

4.1.3. Evaluation Metrics

In order to mitigate the potential for evaluator bias and to capture both execution stability and human-perceived reasoning quality, a hybrid evaluation metric system was adopted. This system comprises deterministic execution metrics and an LLM-as-a-Judge framework.
  • Objective Execution Metrics: We utilized Exact Match (EM) and macro F1 Score to quantify final retrieval accuracy. Furthermore, the stability of agentic execution was explicitly quantified by the Tool Success Rate (TSR). TSR is defined as the ratio of syntactically valid and successfully executed atomic tool calls to the total number of attempted tool invocations during a given reasoning trajectory.
  • Multi-dimensional LLM-as-a-Judge Evaluation: Traditional rigid metrics frequently struggle to capture the nuance of long-form multi-hop reasoning. Inspired by recent advanced evaluation protocols, we introduced a multi-dimensional pairwise comparison framework utilizing a strong evaluator model (e.g., GPT-4o) [26]. To strictly mitigate evaluator bias and ensure reproducibility, the judge model was configured with a temperature of 0.0. Furthermore, we implemented a bidirectional ‘Position Swapping’ protocol to neutralize position bias. Every answer pair was evaluated twice (Model A preceding Model B, and vice versa). A definitive ‘Win’ was only aggregated into the final metrics if the evaluator consistently preferred the same model across both positional permutations; otherwise, the comparison was strictly recorded as a ‘Tie.’ To minimize prompt sensitivity, the evaluator was constrained by dimension-specific rubrics rather than open-ended preference prompts. The generated responses were evaluated blind across four primary dimensions:
    • Comprehensiveness: The extent to which the response covers all necessary multi-hop evidence and implicit relationships required by the query.
    • Factuality and Accuracy: The strict adherence to retrieved contextual evidence, specifically penalizing parametric hallucinations or fabricated tool execution results.
    • Logical Coherence: The soundness and fluidity of the reasoning chain connecting the initial query to the final synthesis.
    • Overall Preference: A holistic judgment determining the superior response based on the cumulative performance of the preceding three criteria.

4.2. Accuracy and Execution Robustness

As detailed in Table 1, the evaluated architectures exhibit a clear stepwise stratification. The performance of vanilla RAG highlights the inherent limitations of shallow semantic matching, achieving an F1 score of only 0.523 on Qasper. Pure vector retrieval frequently provides fragmented context to the neural planner, triggering semantic drift in multi-hop scenarios.
Table 1. Win rates (%) of baselines versus the proposed RAG-CoT-MCP architecture across four datasets and four evaluation dimensions.
A thorough examination of the evaluation dimensions has exposed a variety of distinct failure modes among the baselines. This finding serves to further emphasize the structural advantages of neuro-symbolic coupling.
With regard to the Comprehensiveness dimension, the proposed architecture demonstrates significant superiority over Vanilla RAG, achieving an 81.5% win rate on the Qasper dataset and 89.8% on ToolBench. Evidence from Evaluator logs indicates that traditional vector-based retrieval frequently suffers from attention diffusion when processing lengthy academic texts or nested API descriptions. The RAG-CoT-MCP framework is a retrieval approach that utilizes latent CoT planning to decompose complex queries into atomic retrieval intents. This ensures that implicit multi-hop evidence is systematically captured, thereby mitigating the semantic drift commonly observed in static retrieval approaches.
A critical divergence is also observed in the Accuracy/Factuality metric when a comparison is made against the unconstrained RAG-CoT baseline. The unconstrained model is heavily penalized when operating without protocol constraints. The proposed architecture achieves a 77.6% win rate on Qasper and an 84.8% win rate on ToolBench. Unconstrained autonomous agents have been observed to demonstrate a marked tendency to hallucinate API parameters or fabricate file paths during complex logical deductions. This phenomenon results in the generation of answers that are contingent on fabricated execution results. The integration of the Model Context Protocol functions as a strict schema validation boundary. It is mathematically proven that reasoning trajectories are exclusively grounded in syntactically valid operations. This, in turn, neutralizes execution hallucinations at the source.
Finally, in terms of logical coherence, while the Prompt-Constrained ReAct baseline mitigates parameter hallucination to a certain degree through instructional tuning, it remains highly susceptible to logical fragmentation. In the context of profound cognitive exercises, reliance on natural language prompts alone is inadequate in ensuring the complete prevention of syntax errors. This forces the prompt-constrained model into erratic trial-and-error loops, frequently leading to broken reasoning chains. The proposed architecture is predicated on the principle of delegating the entirety of schema validation to the deterministic MCP layer. This approach is intended to ensure the maintenance of a highly fluid and unbroken state transition throughout the reasoning process. The present study has demonstrated that systemic stability is reflected by consistent dominance across all four datasets, ranging from 55.9% to 65.5% in overall win rates.

4.3. Ablation Studies

To rigorously validate the necessity and individual contribution of each neuro-symbolic component within the proposed architecture, an ablation study was conducted. We derived three simplified variants of the RAG-CoT-MCP framework by systematically removing core systemic constraints. The average performance across all four datasets was evaluated using Exact Match (EM), macro F1 Score, and Tool Success Rate (TSR).
The empirical results in Table 2 demonstrate that the removal of any systemic component results in a significant degradation of both execution stability and reasoning accuracy.
Table 2. Ablation study results: Average performance metrics across all evaluation datasets.
The reversion to the baseline RAG-CoT, following the removal of the deterministic Model Context Protocol layer, resulted in the most severe performance collapse, with the system being forced to rely entirely on the LLM’s intrinsic capacity to format tool calls. In this configuration, while the F1 score decreased by 17.2%, the Tool Success Rate (TSR) experienced a precipitous decline from 94% to 64.2%. In the absence of a stringent schema validation boundary, the model exhibited a proclivity for generating malformed JSON strings, fabricating non-existent API endpoints, or hallucinating missing arguments. The present empirical evidence confirms the hypothesis that probabilistic natural language models are incapable of reliably sustaining deterministic execution states in long-horizon tasks in the absence of external symbolic constraints.
Further analysis reveals the essential impact of the cognitive planning phase. When the latent variable generation ( z t ) was ablated, the model was compelled to execute a Direct Action ( a t ) based solely on the current context. This variant maintained a relatively high TSR (89.4%), primarily because the MCP layer was still actively filtering syntax errors. However, its task-solving metrics degraded significantly, with the F1 score falling to 55.7%. Evaluator logs revealed that without explicit intermediate reasoning, the agent suffered from severe semantic drift during complex multi-hop queries, frequently invoking irrelevant tools or terminating the search prematurely. This proves that decoupling cognitive planning from physical execution is critical for maintaining logical coherence.
Finally, examining the system’s boundary conditions, we evaluated an Unbounded Retry setting by removing the strict systemic retry threshold ( τ m a x = 3 ). Under this configuration, the model was permitted infinite attempts to recover from errors or unanswerable queries. Counterintuitively, granting the model unlimited retries did not improve accuracy; instead, the TSR dropped to 82.6%, and the F1 score slightly declined to 65.1%. Without bounded termination, the agent frequently fell into infinite recovery loops, repeatedly attempting to brute-force a solution when the required knowledge was genuinely missing from the database (e.g., in Miss-Answer scenarios). The bounded retry mechanism is thus proven crucial not only for capping inference latency but also for forcing the model to acknowledge knowledge boundaries gracefully.

4.4. Model Cost and Execution Efficiency

We define the valid action space A m C P as the discrete set of atomic operations strictly permitted by the MCP server specifications. The protocol layer enforces a staged validation function V ( a t ) , which acts as an uncompromising gatekeeper between the neural and symbolic components:
C o s t = T p l a n n i n g + ∑ i = 1 C   T r e c o v e r y i + L A P I
where T p l a n n i n g represents the base token generation time for the initial cognitive planning, C denotes the number of failed API execution attempts, T r e c o v e r y is the token overhead spent on error analysis and prompt re-generation, and L A P I is the network latency incurred by redundant API calls. Based on this formulation, we tracked the average resource consumption per query across the agentic baselines, with the comparative results detailed in Table 3.
Table 3. Comparison of execution cost and efficiency metrics per query.
As illustrated in Table 3, examining the interaction with external interfaces reveals a stark contrast in API utilization efficiency. The Baseline RAG-CoT model exhibits a highly inefficient retrieval pattern, averaging 8.4 API calls per query with a failure rate of 45.2%. Evaluator logs indicate that a substantial portion of these calls are wasted on resolving 400 Bad Request or 500 Internal Server Error responses caused by malformed JSON payloads. While the Prompt-Constrained ReAct model partially mitigates this issue through instructional tuning, it still suffers from a 28.6% failure rate. In contrast, by enforcing deterministic schema validation prior to network execution, the proposed RAG-CoT-MCP architecture compresses the average API calls down to 3.1 and virtually eliminates syntax-driven network failures, effectively minimizing the Σ L A P I component of the cost equation.
To address potential ambiguities regarding the 6.0% network failure rate achieved by the proposed architecture, it is imperative to strictly delineate the statistical definition of an API failure within this study. The reported failure metric exclusively quantifies syntactic execution aborts—such as malformed JSON payloads, hallucinated endpoints, or missing mandatory arguments that trigger 400 Bad Request or 500 Internal Server Error responses. Conversely, valid semantic null-returns resulting from exploratory logical errors (e.g., querying a non-existent document ID returning a 404 Not Found, or triggering a server-side rate limit warning) are categorically classified as successful network executions. These null returns provide deterministic, valid observations that the latent cognitive planner utilizes to update its state space and formulate alternative search strategies. The profound reduction in the failure rate is therefore not a result of filtering complex environmental edge cases, but rather demonstrates that the Model Context Protocol effectively shields the network layer from the generative syntax chaos inherent in unconstrained baselines.
The minimization of network errors directly translates into a dramatic reduction in computational waste, specifically regarding token overhead ( T r e c o v e r y ). When conventional agentic systems encounter an API failure, they are forced to consume large amounts of context window to parse the error trace and generate self-reflective corrections (e.g., generating tokens to explain the syntax error before attempting a new call). This reactive error handling process costs the Baseline RAG-CoT an average of 1845 redundant tokens per query. By proactively intercepting invalid actions at the protocol layer, the MCP framework ensures that the LLM’s token generation capacity is invested exclusively in valid causal reasoning, reducing the token overhead to a negligible 185 tokens.
This architectural efficiency leads to a counterintuitive but highly advantageous outcome regarding overall inference latency. It is typically assumed that introducing an additional protocol validation layer would inflate system latency. However, empirical data demonstrate the opposite. Although the MCP layer introduces a marginal local validation overhead (approximately 0.37 s per query), it fundamentally eradicates the protracted trial-and-error loops that plague unconstrained models. As a result, the RAG-CoT-MCP architecture achieves the lowest average latency at 21.97 s, proving that strict systemic constraints are not computational burdens, but rather the prerequisite for deploying high-speed, cost-effective LLM agents.

5. Discussion

The primary objective of this study is to resolve the structural contradiction between probabilistic neural generation and deterministic physical execution in autonomous knowledge retrieval. The introduction of the Model Context Protocol (MCP) as a strict neuro-symbolic interface has been demonstrated to result in a significant reduction in network-level execution error rates to an almost imperceptible level. From the perspective of dual-process cognitive theory, this orthogonal decoupling carries profound implications [27]. The conventional static vector retrieval process functions in a manner analogous to System 1 thinking, relying on rapid, heuristic pattern matching. This approach is particularly vulnerable to semantic drift when traversing complex texts. In contrast, latent chain-of-thought reasoning augmented by protocol constraints endows the agent with deliberate, System 2-like cognitive capacities. In this framework, the protocol layer functions as a stringent logical gatekeeper, enabling the language model to concentrate exclusively on high-dimensional causal deduction without exhausting valuable context window resources on low-dimensional syntax correction.
Moreover, the empirical findings call into question prevailing intuitive assumptions in the realm of distributed system design. It is a commonly held belief that the implementation of an additional protocol validation layer would inevitably result in an increase in overall system latency. However, detailed cost tracking reveals a significant phenomenon of “hidden computational inflation” within unconstrained agentic models, where a substantial quantity of generation tokens is wasted on processing invalid server responses and executing iterative self-correction loops [28]. The proactive interception mechanism of the deterministic protocol layer has been shown to disrupt this irrational trial-and-error cycle. By implementing front-loaded systemic constraints, computational resources are efficiently reallocated towards the exploration of valid knowledge, thereby establishing a critical pathway for the low-latency, cost-effective deployment of LLM agents in cloud environments.
Notwithstanding the considerable advantages in terms of semantic accuracy and resource utilization, the practical implementation of the RAG-CoT-MCP architecture gives rise to specific theoretical and engineering challenges. Firstly, the uniform application of this computationally onerous System 2 framework to all queries contravenes the cognitive principle of least effort. Specifically, under conditions involving simple, single-hop factoid queries or scenarios with intrinsically low error rates, the mandatory execution of latent Chain-of-Thought planning and protocol-level validation introduces unnecessary token generation costs and latency overhead. This results in an overall irrational allocation of resources for elementary questions. It is imperative that future research addresse this issue by developing an adaptive, entropy-driven routing mechanism that is capable of dynamically toggling between standard System 1 RAG and the System 2 MCP framework. Furthermore, the current empirical evaluation was deliberately constrained to a singular foundational reasoning engine to strictly isolate the architectural impact of the protocol layer. Consequently, performance variations when deploying different families of Large Language Models (e.g., varying parameter scales or open-source versus proprietary models) as the cognitive planner remain unexplored. Investigating the framework’s model-agnostic robustness and potential prompt sensitivity across diverse LLMs constitutes a vital direction for future research. Secondly, the present cognitive planning phase is reliant upon an autoregressive, sequential generation process, which fails to fully exploit the concurrency of contemporary cloud platforms. Exploring speculative concurrent retrieval could further minimize latency [29]. Finally, the delegation of execution validation entirely to the deterministic MCP layer necessitates the rigorous pre-definition of API schemas, which severely degrades zero-shot adaptability in unknown environments. Because the protocol relies on static structural rules to intercept hallucinations, the system currently lacks the capacity to interact with dynamically mutating APIs or strictly open-world toolsets where schemas are unmapped. In order to achieve a reconciliation between the strictness of deterministic execution and open-world exploratory flexibility, it is essential that subsequent studies direct their attention to the fields of dynamic schema induction (e.g., enabling the LLM to autonomously parse OpenAPI specifications on the fly to configure the MCP server dynamically) and automated protocol discovery mechanisms.

6. Conclusions

The present paper addresses the critical reliability and efficiency bottlenecks encountered when deploying Large Language Models as autonomous multi-hop retrieval agents over complex knowledge bases. In order to address the fundamental structural gap between probabilistic neural generation and deterministic physical execution, the RAG-CoT-MCP neuro-symbolic architecture was proposed. The successful neutralization of syntax-driven execution hallucinations at their source is achieved by orthogonally decoupling latent cognitive planning from physical tool invocation and enforcing the Model Context Protocol as a rigorous system-level validation boundary.
Comprehensive empirical evaluations across four diverse datasets demonstrate that the proposed architecture establishes a new standard for agentic retrieval. The framework enhances semantic comprehensiveness and logical coherence, while also resolving the prevalent systemic issue of hidden computational inflation. The deterministic interception of malformed actions prevents the agent from entering protracted trial-and-error recovery loops. This, in turn, has the effect of dramatically reducing redundant API calls and wasteful token consumption. The architecture achieves lower overall inference latency, despite the addition of a strict protocol validation layer, a result that may appear counterintuitive at first glance.
The findings of this research establish that programmatic execution constraints do not hinder agentic flexibility; rather, they serve as a fundamental prerequisite for deploying robust, high-speed, and cost-effective LLM agents in production environments. Whilst the current limitations regarding strict schema maintenance dependencies persist, future explorations into dynamic protocol discovery and speculative concurrent retrieval mechanisms will further advance the scalability and zero-shot adaptability of neuro-symbolic intelligent systems.

Author Contributions

H.Z.: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Resources, Data curation, Writing—original draft, Writing—review and editing, Visualization; D.L.: Conceptualization, Formal analysis, Investigation, Resources; X.N.: Methodology, Project administration, Funding acquisition, Supervision. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by the Hainan Provincial Sanya Yazhou Bay Science and Technology Innovation Joint Project (No: ZDYF2025GXJS154).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The datasets used in this study (Qasper, HotpotQA, 2WikiMultihopQA, and ToolBench) are publicly available from their respective original sources. To ensure methodological transparency, the core algorithmic implementations (pseudo-code) and sample MCP validation schemas for the RAG-CoT-MCP architecture have been made publicly available on GitHub at: https://github.com/zhtt-hub/RAG-CoT-MCP.git (accessed on 20 April 2026).

Acknowledgments

The authors would like to thank the reviewers for their valuable comments and suggestions.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
LLMsLarge Language Models
RAGRetrieval-Augmented Generation
MCPModel Context Protocol
CoTChain-of-Thought

References

  1. Xi, Z.; Chen, W.; Guo, X.; He, W.; Ding, Y.; Hong, B.; Zhang, M.; Wang, J.; Jin, S.; Zhou, E.; et al. The rise and potential of large language model based agents: A survey. Front. Comput. Sci. 2023, 17, 172800. [Google Scholar] [CrossRef] [Scilit]
  2. Wang, L.; Ma, C.; Feng, X.; Zhang, Z.; Yang, H.; Zhang, J.; Chen, Z.; Tang, J.; Chen, X.; Lin, Y.; et al. A survey on large language model based autonomous agents. Front. Comput. Sci. 2024, 18, 182701. [Google Scholar] [CrossRef] [Scilit]
  3. Lewis, P.; Perez, E.; Piktus, A.; Petroni, F.; Karpukhin, V.; Goyal, N.; Küttler, H.; Lewis, M.; Yih, W.; Rocktäschel, T.; et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. Adv. Neural Inf. Process. Syst. 2020, 33, 9459–9474. [Google Scholar]
  4. Yao, S.; Zhao, J.; Yu, D.; Du, N.; Shafran, I.; Narasimhan, K.; Cao, Y. ReAct: Synergizing reasoning and acting in language models. In Proceedings of the Eleventh International Conference on Learning Representations (ICLR), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
  5. Karpukhin, V.; Oguz, B.; Min, S.; Lewis, P.; Wu, L.; Edunov, S.; Chen, D.; Yih, W. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), Online, 16–20 November 2020; pp. 6769–6781. [Google Scholar]
  6. Liu, N.F.; Lin, K.; Hewitt, J.; Paranjape, A.; Bevilacqua, M.; Petroni, F.; Liang, P. Lost in the middle: How language models use long contexts. Trans. Assoc. Comput. Linguist. 2024, 12, 157–173. [Google Scholar] [CrossRef] [Scilit]
  7. Wei, J.; Wang, X.; Schuurmans, D.; Bosma, M.; Xia, F.; Chi, E.; Le, Q.V.; Zhou, D. Chain-of-thought prompting elicits reasoning in large language models. Adv. Neural Inf. Process. Syst. 2022, 35, 24824–24837. [Google Scholar]
  8. Ji, Z.; Lee, N.; Frieske, R.; Yu, T.; Su, D.; Xu, Y.; Ishii, E.; Bang, Y.J.; Madotto, A.; Fung, P. Survey of hallucination in natural language generation. ACM Comput. Surv. 2023, 55, 1–38. [Google Scholar] [CrossRef] [Scilit]
  9. Willard, B.T.; Louf, R. Efficient guided generation for large language models. arXiv 2023, arXiv:2307.09702. [Google Scholar] [CrossRef] [Scilit]
  10. Shinn, N.; Cassano, F.; Gopinath, A.; Narasimhan, K.; Rao, S. Reflexion: Language agents with verbal reinforcement learning. Adv. Neural Inf. Process. Syst. 2023, 36, 8634–8652. [Google Scholar]
  11. Anthropic. Model Context Protocol. Available online: https://modelcontextprotocol.io (accessed on 24 March 2026).
  12. Edge, D.; Trinh, H.; Cheng, N.; Bradley, J.; Chao, A.; Mody, A.; Truitt, S.; Larson, J. From Local to Global: A Graph RAG Approach to Query-Focused Summarization. arXiv 2024, arXiv:2404.16130. [Google Scholar] [CrossRef] [Scilit]
  13. Kojima, T.; Gu, S.S.; Reid, M.; Matsuo, Y.; Iwasawa, Y. Large language models are zero-shot reasoners. Adv. Neural Inf. Process. Syst. 2022, 35, 22199–22213. [Google Scholar]
  14. Wang, X.; Wei, J.; Schuurmans, D.; Le, Q.; Chi, E.; Narang, S.; Chowdhery, A.; Zhou, D. Self-consistency improves chain of thought reasoning in language models. In Proceedings of the Eleventh International Conference on Learning Representations (ICLR), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
  15. Schick, T.; Dwivedi-Yu, J.; Dessì, R.; Raileanu, R.; Lomeli, M.; Hambro, E.; Zettlemoyer, L.; Cancedda, N.; Scialom, T. Toolformer: Language models can teach themselves to use tools. Adv. Neural Inf. Process. Syst. 2023, 36, 68539–68551. [Google Scholar]
  16. Patil, S.G.; Zhang, T.; Wang, X.; Gonzalez, J.E. Gorilla: Large language model connected with massive apis. arXiv 2023, arXiv:2305.15334. [Google Scholar] [CrossRef] [Scilit]
  17. Qin, Y.; Liang, S.; Ye, Y.; Zhu, K.; Yan, L.; Lu, Y.; Lin, Y.; Cong, X.; Tang, X.; Qian, B.; et al. ToolLLM: Facilitating large language models to master 16000+ real-world apis. In Proceedings of the Twelfth International Conference on Learning Representations (ICLR), Vienna, Austria, 7–11 May 2024. [Google Scholar]
  18. Gur, I.; Furuta, H.; Huang, A.; Safdari, M.; Matsuo, Y.; Eck, D.; Faust, A. A real-world webagent with planning, long context understanding, and program synthesis. arXiv 2023, arXiv:2307.12856. [Google Scholar]
  19. Hitzler, P.; Sarker, M.K. Neuro-symbolic artificial intelligence: The state of the art. Front. Artif. Intell. 2022, 5, 862974. [Google Scholar]
  20. Hao, S.; Gu, L.; Ma, P.; Hong, H.; Wang, S.; Wang, H.; Hu, J. Reasoning with language model is planning with world model. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP), Singapore, 6–10 December 2023; pp. 8154–8173. [Google Scholar]
  21. GLM Team. ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools. arXiv 2024, arXiv:2406.12793. [Google Scholar]
  22. Dasigi, P.; Lo, K.; Beltagy, I.; Cohan, A.; Smith, N.A.; Gardner, M. A dataset of information-seeking questions and answers anchored in research papers. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Online, 6–11 June 2021; pp. 4599–4610. [Google Scholar]
  23. Yang, Z.; Qi, P.; Zhang, S.; Bengio, Y.; Cohen, W.W.; Salakhutdinov, R.; Manning, C.D. HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), Brussels, Belgium, 31 October–4 November 2018; pp. 2369–2380. [Google Scholar]
  24. Ho, X.; Schmid, A.K.D.; Costa-jussà, M.R. Constructing a multi-hop QA dataset for comprehensive evaluation of reasoning steps. In Proceedings of the 28th International Conference on Computational Linguistics (COLING), Barcelona, Spain, 8–13 December 2020; pp. 6609–6625. [Google Scholar]
  25. Robertson, S.; Zaragoza, H. The probabilistic relevance framework: BM25 and beyond. Found. Trends Inf. Retr. 2009, 3, 333–389. [Google Scholar] [CrossRef] [Scilit]
  26. Zheng, L.; Chiang, W.L.; Ying, Y.; Shen, S.; Hou, S.; Lin, H.; Chen, S.; Hao, Z.; Gonzalez, J.E.; Stoica, I.; et al. Judging LLM-as-a-judge with MT-Bench and Chatbot Arena. Adv. Neural Inf. Process. Syst. 2023, 36, 46595–46626. [Google Scholar]
  27. Kahneman, D. Thinking, Fast and Slow, 1st ed.; Farrar, Straus and Giroux: New York, NY, USA, 2011; pp. 1–499. [Google Scholar]
  28. Mialon, G.; Dessì, R.; Lomeli, M.; Nalmpantis, C.; Pasunuru, R.; Raileanu, R.; Rozière, B.; Schick, T.; Dwivedi-Yu, J.; Celikyilmaz, A.; et al. Augmented language models: A survey. Trans. Mach. Learn. Res. 2023, arXiv:2302.07842. [Google Scholar]
  29. Wang, G.; Xie, Y.; Jiang, Y.; Mandlekar, A.; Xiao, C.; Zhu, Y.; Fan, L.; Anandkumar, A. Voyager: An open-ended embodied agent with large language models. arXiv 2023, arXiv:2305.16291. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.