An intelligent data report generation method and system based on MCP protocol

By using an intelligent data report generation method based on the MCP protocol, the problems of poor user experience and high migration costs in existing technologies are solved. It realizes an automatic closed loop from natural language intent to chart generation, thereby improving the automation level and user experience of data report analysis.

CN121052228BActive Publication Date: 2026-02-10SHANDONG MAIGANG DATA SYST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511575732.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-02-10
Estimated Expiration
2045-10-31

AI Technical Summary

Technical Problem

Existing natural language to graph technologies suffer from problems such as poor fault tolerance of single agents, excessively heavy process infrastructure, lack of interactive capabilities and correction mechanisms, and poor compatibility with SQL dialects, resulting in poor user experience and high migration costs.

Method used

An intelligent data report generation method based on the MCP protocol is adopted. By acquiring users' natural language commands, constructing semantic intent vectors, using knowledge graphs to construct task path graphs, mapping intent paths to tool capabilities, constructing task flows and optimizing scheduling, the method realizes the generation of visual representations from data to graphics.

Benefits of technology

It achieves a fully automated closed loop from natural language intent to data analysis and chart generation, lowering the barrier to entry for non-technical users, improving the accuracy and scalability of task execution, enhancing the flexibility and personalized configuration of chart capabilities, and improving the automation and interactive experience of data report analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121052228B_ABST
    Figure CN121052228B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data automatic analysis, in particular to an intelligent data report generation method and system based on an MCP protocol. The method comprises the following steps: constructing a semantic intention vector through a context semantic structure according to an obtained user natural language instruction; constructing a semantic task path graph based on the semantic intention vector and by using a knowledge graph; performing intention path and tool capability mapping based on the MCP protocol according to the constructed semantic task path graph; constructing a task flow based on the MCP protocol and performing task scheduling optimization; uniformly modeling a data source based on the constructed task flow, generating a stable controllable calculation task flow; and realizing visual expression generation from data to graphics through an intelligent recommendation and structure modeling mechanism. The application realizes a full-automatic closed loop from a natural language intention to data analysis and graph generation by constructing a semantic-driven MCP plug-in tool chain and a graph table capability component index, and simultaneously reduces the use threshold of non-technical users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of automatic data analysis, in particular to an intelligent data report generation method and system based on MCP protocol. BACKGROUND

[0002] With data-driven decision-making gradually becoming the core of organizational operation, data report technology is widely used. Traditional data report systems usually rely on predefined data query templates, fixed visualization rules and cumbersome ETL (Extract, Transform, Load) processes, which pose a high usage threshold for non-technical personnel. In order to solve this problem, in recent years, with the development of large models and artificial intelligence, a natural language question and answer type of data analysis interaction mode NL2BI (Natural Language to Business Intelligence) has gradually emerged, that is, by inputting natural language questions, the system automatically understands the user's intention and generates the corresponding data report or chart.

[0003] However, the prior art has the following defects:

[0004] The current industry mainstream natural language to chart technology implementation path can be roughly divided into three categories, which are: Agent scheduling mode, RAG (Retrieval-Augmented Generation) workflow mode and NL2SQL (Natural Language to Structured Query Language) model mode. But these modes have some drawbacks, as follows:

[0005] (1) Poor fault tolerance of single Agent: long execution process, multiple links, once a step in the Agent fails, the entire process will completely fail, lacking a redundant path or rollback mechanism.

[0006] (2) Heavy process facilities, lack of generalization ability: RAG workflow successfully solves the problem of poor fault tolerance of single Agent. However, it needs to configure all possible branch paths in advance, which has no adaptability to unexpected scenarios, and due to the execution process limitation, the response time and maintenance cost are extremely high.

[0007] (3) Chart presentation logic is fixed and lacks adaptability: chart selection is often based on prompt hardcode (prompt word), rather than data-driven evolution, and chart selection ability is rigid.

[0008] (4) Lack of interaction ability and correction mechanism: the model generates one-time SQL, users cannot check the logic for fine-tuning and repair, and lacks corresponding explanation ability.

[0009] (5) SQL dialect compatibility is poor: the model is usually trained based on MySQL / PostgreSQL and cannot be compatible with new data engines such as Hive, Presto, ClickHouse, etc. If actually applied, the model needs to be fine-tuned for each database dialect, and the migration and adaptation cost is high.

[0010] Therefore, an intelligent data report generation method based on the MCP protocol is urgently needed. SUMMARY

[0011] In order to solve the above-mentioned problems, the present application provides an intelligent data report generation method and system based on the MCP protocol.

[0012] In the first aspect, the present application provides an intelligent data report generation method based on the MCP protocol, which adopts the following technical solution:

[0013] An intelligent data report generation method based on the MCP protocol, comprising:

[0014] Obtaining a user natural language instruction;

[0015] According to the obtained user natural language instruction, a semantic intention vector is constructed through a context semantic structure;

[0016] Based on the semantic intention vector and using a knowledge graph, a semantic task path graph is constructed;

[0017] According to the constructed semantic task path graph, intention path and tool capability mapping are performed based on the MCP protocol;

[0018] Based on the MCP protocol, a task flow is constructed and task scheduling optimization is performed;

[0019] Based on the constructed task flow, data source unified modeling is performed to generate a stable and controllable calculation task flow;

[0020] Through intelligent recommendation and structure modeling mechanism, visual table expression generation from data to graphics is realized.

[0021] Further, the semantic intention vector is constructed through a context semantic structure, which includes based on BI-GRU +Self-Attention architecture, sequentially performing semantic feature extraction and global semantic aggregation, wherein BI-GR is used to model the forward and backward semantics of the input sentence, and extract the semantic role of each word in the sequence in the context; and the sequence is taken as the input of Self-Attention to capture the association between the current semantic focus and the historical semantics, and the semantic correlation degree is constructed; then based on the semantic correlation degree, an initial semantic intention vector is constructed A normalization strategy modeler is introduced to perform feature compression and orientation alignment on the semantic intent vector, as follows: ,in, Let be the attention weight at time step t; The context feature vector is the joint output of BI-GRU and Self-Attention; the intent vector is normalized. The formula for construction is: ,in, The L2 norm of the intention vector; This is the normalized semantic intent vector; finally, the normalized semantic intent vector... The data is passed to the task reasoning module; by constructing an intent-tool matching scoring function, the optimal operation path is dynamically selected from the registered tool set to realize the mapping and triggering of intent to action; during the reasoning process, a multi-dimensional semantic embedding retrieval mechanism is introduced to calculate the cosine similarity between the embedding vector of each tool and the current intent vector to achieve optimal tool selection. The triggering condition is controlled by a scoring threshold to avoid erroneous execution caused by mismatches, as shown below:

[0022]

[0023] in, For tools Match score with the current intent; For the first Embedding vectors of candidate tools.

[0024] Furthermore, the construction of a semantic task path graph based on semantic intent vectors and utilizing knowledge graphs includes utilizing semantic intent vectors. Semantic space matching is performed with the node representations in the pre-established business knowledge graph to complete the initial alignment of intent to graph semantic nodes, represented as: in, This is a semantic intent vector; Let be the embedding vector of the i-th node in the graph; A set of knowledge graph nodes; The optimal matching semantic node; and based on the optimal matching semantic node An intent-driven task execution path graph is constructed, employing a semantic instruction-driven path generation mechanism. Based on the semantic relevance and dependency structure between nodes in the knowledge graph, a directed acyclic graph is gradually constructed. The path escaping representation of the directed acyclic graph is as follows:

[0025]

[0026] in, Represents a multidimensional semantic transfer function; denotes the current node with the semantic intention vector , the probability of transferring to the node ; denote the current tool node and the candidate tool node, respectively.

[0027] Further, the construction of the semantic task path graph based on the semantic intention vector and the knowledge graph further comprises extracting variable entities in the semantic context based on the tool nodes in the directed acyclic path graph, completing parameter slot filling, and generating a variable template structure that can be executed by the system, wherein after the path graph is constructed, the abstract path graph is converted into an execution graph with explicit parameters, for each tool node, a slot list to be matched is generated according to the defined parameter specification; through a conditional slot extraction model, a pointing score of each slot in the current context is calculated ; based on the maximum score strategy, a context entity corresponding to the slot is selected to construct a variable template , and the parameter slot extraction formula is:

[0028]

[0029] wherein, denotes a Sigmoid activation function; denotes the score of the slot under the condition of the given intention vector and the current tool node ; the embedding vector of the slot ; is the embedding vector of the tool node ; denotes the transpose of the parameter matrix; is the slot scoring weight matrix.

[0030] Further, the mapping of the intention path and the tool capability based on the MCP protocol comprises dynamically obtaining registered tool resource description information and extracting metadata content through a standardized MCP protocol communication to form a structured capability representation; based on the structured information, a tool capability vector is constructed to uniformly represent the semantic feature space of each tool node to form a multi-dimensional semantic expression, and the tool capability vector construction formula is:

[0031]

[0032] wherein, is the functional description text feature of the tool; is the input parameter specification feature of the tool; is the output result specification feature of the tool; Tool dependency and constraint rule characteristics; To unify the feature decoder, after obtaining the capability vectors of all tools, the semantic vectors of each node in the intent path are aligned and matched with the tool vectors in the same semantic space. Through similarity calculation and feature fusion, the matching degree between each tool node and the user intent is evaluated, ensuring that each task path is bound to the most suitable tool capability resource. Specifically, by calculating the similarity between the capability vector and the intent vector, the tool path that best meets the user's needs is selected. Semantic alignment, by optimizing the alignment of the tool vector and the intent vector in the same semantic space, ensures the accuracy of tool selection, as expressed below: ,in, It is a tool capability vector; It is the normalized intention vector; For similarity calculation; After calculating the similarity of the toolset, the tool paths are finally filtered based on the user's input intent vector. Considering the matching degree of a single tool and the collaborative effect of multiple tools, the overall task execution efficiency is optimized. The optimal tool path formula is expressed as:

[0033]

[0034] in, A collection of tools; This represents the intent vector of the user's needs. is the tool weight coefficient; N is the size of the tool set.

[0035] Furthermore, the task flow construction and scheduling optimization based on the MCP protocol includes extracting task nodes from the task description, analyzing the input-output relationship of tasks and the constraints between tasks based on the dependencies between tasks, combining task nodes sequentially into an execution flow graph and optimizing it. After the task flow graph is constructed, the logical tasks in the task flow are matched with the actual tool interfaces under the MCP protocol at the parameter level, the protocol format is unified, and the interface adaptation is dynamically judged to form a complete task execution preparation path. First, parameter matching is completed based on the output metadata of the upstream task and the input specifications of the downstream tool. If the upstream output and the downstream input are semantically inconsistent, automatic adjustment is performed based on the metadata semantic correction mechanism, as shown below:

[0036]

[0037] in, It is an upstream output field; It is a downstream input field; For field text feature editor; The pre-similarity function is used; after parameter matching is completed, the interface protocol of the target tool is adapted. First, the fields of the interface request body are rearranged or packaged, and then the content of the interface return body is parsed and necessary fields are extracted. Based on the parsed and extracted content, the exception code is unified, and dynamic tool interface adaptation and fit verification, as well as exception parameter handling and fault tolerance compensation are performed.

[0038] Furthermore, the task flow construction and scheduling optimization based on the MCP protocol also includes a multi-round task scheduling and execution phase after the task flow construction is completed. A complete scheduling closed loop is constructed through asynchronous scheduling mechanisms, dynamic priority adjustment, failure retry control, and interrupt recovery mechanisms. Specifically, an asynchronous task scheduling framework is built, based on an event-driven and message model, to asynchronously schedule the execution of each task node. Each task node is pushed to the scheduling queue after its dependency conditions are met, maximizing resource utilization and execution concurrency. The formula for determining whether a node is executable is:

[0039] in, The current task node; For nodes The set of all preceding dependent nodes; For a single front-end node; For nodes Readiness status; Context state tracking and dynamic priority adjustment: Real-time tracking of the execution status of each task, and dynamic adjustment of scheduling priority based on task urgency and dependency impact. The dynamic priority calculation formula for nodes is:

[0040] ,in, The topological hierarchy of the nodes; The number of downstream tasks affected by the node; , To adjust the weighting coefficients; Failure detection and intelligent retry strategy: Failed tasks are categorized based on failure type. If the failure is classified as retryable, it will be added to a delayed retry queue; if it is a non-retryable failure, the error will be recorded and subsequent dependent tasks will be interrupted. The delay algorithm for task retry is as follows: in, Base retry time; This represents the number of retries for the current task. This is the delay time.

[0041] Furthermore, the unified modeling of data sources based on the constructed task flow includes introducing the MetadataDiscovery Engine—a metadata vectorization modeling and detection engine—to automatically identify and dynamically adapt metadata in the data source. Specifically, upon initial access to the data source, the data source type is determined and metadata is acquired. Feature fingerprinting is performed on the probed connection information metadata. Vectorization modeling is then performed by calculating matching confidence scores using multiple features. The confidence score generation formula is as follows:

[0042]

[0043] in, This represents the weight of the i-th feature; This represents the detected feature value; This represents the feature value corresponding to the k-th type of standard data source; This represents feature similarity calculation; after data source identification is completed, authentication is initiated based on the corresponding data source, and after the link is established, all connections are uniformly included in the connection pool management, where the connection model is represented as: ,in, For an active connection pool; It is a single-connection instance; then, a semantically driven metric generation mechanism is constructed. Combining field metadata, user intent, and contextual task configuration, metric expressions are built and executed to retrieve data. This mechanism, through a context-aware binding engine, achieves dynamic adaptation of metric functions to the current data environment, including semantic analysis and template matching, context binding calculation parameters, expression generation, and registration. The dynamic binding formula for metric functions is: ,in, A collection of predefined function templates; For contextual task constraints; The current data structure is used; finally, the fused dataset is cleaned and uniformly modeled to generate a stable and controllable computational task flow.

[0044] Furthermore, the generation of visual representations from data to graphics through intelligent recommendation and structural modeling mechanisms includes constructing a chart type recommendation engine based on the semantic attributes, structural dimensions, and statistical features of data fields. This engine achieves automatic matching of the most suitable chart type through a data feature-driven approach. In the chart recommendation process, each field is assigned a role, and preliminary screening is performed based on a chart adaptation mapping matrix. The semantic fit and visual capacity of candidate charts are comprehensively evaluated. The recommendation process is formally represented as follows:

[0045]

[0046] in, Indicates the type of chart output by the recommendation engine; This indicates the degree of matching between the current chart structure and the field structure; Measure the differences in how the chart reveals the distribution patterns of the fields; This represents the complete set of candidate chart types; This represents the set of fields in the current input dataset; This represents the system's preset chart field adaptation rule set; based on a defined chart type, the chart component layout and style optimization are completed automatically through the structure synthesis engine. The formula for the chart structure synthesis process is as follows: ,in, The generated chart structure tree; For the input field set; For chart templates; The layout parameters are constructed for the driving layer, and then the style parameters are adaptively optimized. The objective function is:

[0047]

[0048] Where w represents the set of style parameters to be adjusted; Represents the automatic evaluation function for the i-th visual factor; This indicates the target visual threshold of the factor in the current context; Importance weights of each style factor.

[0049] Secondly, an intelligent data report generation system based on the MCP protocol includes:

[0050] The data acquisition module is configured to acquire user natural language commands;

[0051] The semantic intent module is configured to construct semantic intent vectors based on the acquired user natural language instructions and the contextual semantic structure.

[0052] The semantic task path graph module is configured to construct a semantic task path graph based on semantic intent vectors and utilizing knowledge graphs.

[0053] The mapping module is configured to map intent paths to tool capabilities based on the constructed semantic task path graph and the MCP protocol.

[0054] The task flow module is configured to build task flows and optimize task scheduling based on the MCP protocol;

[0055] The fusion module is configured to perform unified modeling of data sources based on the constructed task flow, generating a stable and controllable computing task flow;

[0056] The graphics generation module is configured to generate visual representations from data through intelligent recommendation and structural modeling mechanisms.

[0057] Thirdly, the present invention provides a computer-readable storage medium storing a plurality of instructions adapted for loading and execution by a processor of a terminal device of the aforementioned intelligent data report generation method based on the MCP protocol.

[0058] Fourthly, the present invention provides a terminal device, including a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; the computer-readable storage medium is used to store multiple instructions, the instructions being adapted to be loaded and executed by the processor to provide the intelligent data report generation method based on the MCP protocol.

[0059] In summary, the present invention has the following beneficial technical effects:

[0060] (1) This invention achieves a fully automated closed loop from natural language intent to data analysis and chart generation by constructing a semantically driven MCP plugin toolchain and chart capability component index, while lowering the usage threshold for non-technical users. Its semantic reasoning path generation and multi-source data fusion mechanism ensure the accuracy and scalability of task execution. At the same time, the structured registration and adaptive style algorithm of chart capability components enable the visualization results to have high flexibility and personalized configuration capabilities, effectively improving the automation level and interactive experience of data report analysis. The overall solution solves the problems of long "requirement-task-chart" conversion chain, complex configuration, and high tool coupling in traditional data report systems.

[0061] (2) The traditional toolchain orchestration method usually requires users to connect various tool components and orchestrate tool task flows and schedule them themselves by using the LLM-RAG workflow platform. The semantically aware toolchain orchestration engine based on the MCP protocol proposed in this invention enables users to automatically construct execution paths through natural language without pre-defining flowcharts, thereby achieving intent understanding and automatic invocation and combination of complex tool flows.

[0062] (3) This invention enables LLM to autonomously discover, identify, and schedule service functions by semantically annotating service interfaces on the MCP Server side, thus breaking away from the traditional fixed registry and manual matching methods; at the same time, the metadata vectorization modeler of the original fields enables the model to accurately understand the true meaning, context, and function of the table fields, overcoming the limitations of field naming ambiguity; by constructing semantic embedding vectors of all original fields, it is used for automatic understanding of field meaning and matching with user intent. It supports enhanced capabilities such as multilingual aliases, data type recognition, and context.

[0063] (4) The chart-aware self-evolution engine proposed in this invention automatically parses the visualization intent from the user's natural language and derives rendering parameters such as chart type, dimension, indicator, and time granularity. It realizes the parsing of natural language chart intent for report type, dimension indicator, and time granularity. The multi-round data and task execution process verification mechanism introduces a multi-stage security verification step before each data call to ensure that the fields, data quality, and type matching all meet expectations, thereby improving the accuracy and credibility of the final displayed data. The metadata vectorization and confidence matching mechanism enables the model to accurately understand the true meaning, context, and function of table fields, breaking through the limitations of field naming ambiguity. It constructs semantic embedding vectors for all original fields for automatic understanding of field meaning and matching with user intent. It supports enhanced capabilities such as multi-language aliases, data type recognition, and context. Attached Figure Description

[0064] Figure 1 A flowchart of a method for generating intelligent data reports based on the MCP protocol;

[0065] Figure 2 This is a flowchart illustrating the dynamic reasoning generation of the execution path diagram according to the present invention.

[0066] Figure 3 Flowchart for constructing and assembling the dependency graph for the MCP protocol task flow;

[0067] Figure 4 This is a flowchart illustrating the implementation of parameter mapping, protocol encoding / decoding, and tool adaptation.

[0068] Figure 5 It is a flowchart of asynchronous scheduling and failure retry for multi-round task execution flow. Detailed Implementation

[0069] The present invention will be further described in detail below with reference to the accompanying drawings.

[0070] Example 1

[0071] Reference Figure 1 This embodiment of a method for generating intelligent data reports based on the MCP protocol includes:

[0072] Obtain user natural language commands;

[0073] Based on the acquired user natural language instructions, construct a semantic intent vector through contextual semantic structure;

[0074] Based on semantic intent vectors and utilizing knowledge graphs to construct semantic task path graphs;

[0075] Based on the constructed semantic task path graph, intent paths are mapped to tool capabilities using the MCP protocol;

[0076] Task flow is built based on the MCP protocol and task scheduling is optimized.

[0077] Based on the constructed task flow, data sources are modeled uniformly to generate stable and controllable computing task flows;

[0078] Visual representations of data are generated by using intelligent recommendation and structural modeling mechanisms.

[0079] Specifically:

[0080] S10: Registration of chart capability components and construction of structure templates.

[0081] This step establishes a standard registration mechanism for the system's chart visualization capabilities, providing structured support for subsequent semantic command-driven data visualization tasks. During the initialization phase, the platform encapsulates commonly used chart types (such as bar charts, line charts, and pie charts) into chart capability components with a unified descriptive structure through template abstraction and structure definition. Each component must define the following metastructure:

[0082] 1) Chart type identifier;

[0083] 2) Input parameter definition (such as dimension fields, aggregation fields, color matching parameters, etc.);

[0084] 3) Output layer structure template (Chart JSON);

[0085] 4) Style adaptive configuration interface (such as font size adaptive, margin padding, etc.).

[0086] The system registers all components in the MCP tools index and standardizes their interfaces and functional features through structural annotation. This ensures that in the subsequent semantic path reasoning stage, the corresponding chart components can be quickly matched and executed based on the intent vector, thus forming the execution base for semantically driven chart visualization.

[0087] S20: Semantic Guidance Layer. The semantic guidance layer is the entry module for the system to receive user natural language input and perform preliminary semantic modeling. It is responsible for collecting user natural language instructions, performing preliminary deconstruction of contextual semantics, constructing a visual semantic intent vector, and providing structural support for subsequent task mapping and path generation.

[0088] S21: Construct a natural language acquisition and context buffering mechanism.

[0089] This step incorporates a semantic collector and a context buffer mechanism to support multi-round semantic recognition and context consistency maintenance for complex tasks. The system receives user natural language commands through a front-end semantic collector and simultaneously calculates semantic relevance using the context buffer.

[0090] To support the processing of complex multi-turn semantics, a context modeling buffer is introduced within the system. This module is based on a BI-GRU + Self-Attention architecture, sequentially completing two stages: semantic feature extraction and global semantic aggregation. First, the BI-GRU (Bidirectional Gated Recurrent Unit) performs forward and backward semantic modeling on the input sentence, extracting the semantic role of each word in the sequence within the context. Subsequently, this sequence serves as the input for Self-Attention, further enhancing the long-range dependency modeling capability across semantic units and capturing the association between the current semantic focus and historical semantics.

[0091] BI-GRU Output Sequence Construction Formula for:

[0092]

[0093] in, Let be the concatenated vector representation at time t; Forward GRU output; Backward output to GRU.

[0094] Self-Attention weight calculation formula for:

[0095]

[0096] in, q represents the attention weight at time step t; q is the query vector, representing the semantic focus of the current context. Let q be the scoring function, measuring q with respect to q. Semantic relevance.

[0097] Through this process, the system can understand the meaning of the current input and dynamically maintain semantic consistency in the context. At the same time, BI-GRU + Self-Attention constructs semantic relevance.

[0098] S22: Semantic intent vector construction and normalization strategy modeling mechanism.

[0099] This step constructs an initial semantic intent vector based on the semantic relevance output of S21. This vector not only carries the information currently expressed by the user but also incorporates contextual dependencies to drive downstream task reasoning logic. To improve the model's generalization ability to different user expression habits, a normalization strategy modeler is introduced to perform feature compression and direction alignment on the semantic intent vector, thereby enhancing the consistency of intent expression and computational stability.

[0100] Intent vector The formula for construction is:

[0101]

[0102] in, The attention weights are the base t time steps; This is the context feature vector jointly output by BI-GRU and Self-Attention.

[0103] Intent vector normalization The formula for construction is:

[0104]

[0105] in, The L2 norm (Euclidean length) of the intention vector; This is the normalized semantic intent vector.

[0106] S23: Dynamic tool matching and reasoning decision triggering mechanism.

[0107] This step will normalize the semantic intent vector. It is passed to the task reasoning module. By constructing an intent-tool matching scoring function, the optimal operation path is dynamically selected from the set of registered tools to realize the mapping and triggering of intent to action.

[0108] During the inference process, a multi-dimensional semantic tool matching (MST-Match) mechanism is introduced to calculate the cosine similarity between the embedding vector of each tool and the current intent vector, thereby achieving optimal tool selection. The triggering condition is controlled by a score threshold to avoid erroneous execution caused by mismatches.

[0109] The formula for calculating the tool matching score is:

[0110]

[0111] in, For tools Match score with the current intent; For the first Embedding vectors of candidate tools.

[0112] The selection and trigger formula is:

[0113]

[0114] in, Index of the selected best tool; For tools Match score with the current intent; The tool triggers a lower threshold for the score. This represents the average historical matching score. The adjustment coefficient, used to control tolerance, is set to 0.75; The standard deviation is denoted as .

[0115] S30: Task Reasoning Path Generation. After matching semantic intent with tools, the system needs to construct a complete and executable semantic task path graph to ensure the logical completeness of the execution process. This involves combining knowledge graphs to complete sub-processes such as intent semantic node matching, dynamic path graph construction, and parameter variable extraction, ultimately generating a task execution path that meets user needs and is executable.

[0116] S31: Knowledge graph matching and semantic node localization based on intent vectors.

[0117] This step will convert the constructed semantic intent vector Semantic space matching is performed with node representations in a pre-established business knowledge graph to achieve initial alignment of intent to graph semantic nodes. A knowledge graph is then constructed based on the alignment results. This construction involves three steps: First, task entity extraction and nodeization are performed, extracting core operations from the task scenario, including data retrieval and comparison behaviors, and standardizing them into graph nodes, each with a semantic description and vectorized representation. Next, semantic relationship modeling is performed, constructing hierarchical relationships and tool binding relationships, gradually establishing semantic relationships between nodes. Finally, a semantic vector space is generated, encoding nodes and relationships to form a graph embedding representation, providing a computational foundation for subsequent vector matching. During execution, cosine similarity is used for vector matching, combined with the graph context for local expansion and node localization. The core objective is to find the operation node most relevant to the current intent. As the starting point of the task path.

[0118] The matching calculation formula is:

[0119]

[0120] in, This is a semantic intent vector; Let be the embedding vector of the i-th node in the graph; A set of knowledge graph nodes; This is the optimal matching semantic node.

[0121] S32: Dynamically infer to generate execution path graph.

[0122] Figure 2 This is a flowchart of the dynamic reasoning generation execution path diagram of the present invention.

[0123] This step is based on the optimal matching semantic node. The system constructs an intent-driven task execution path graph. This structure adopts a semantic instruction-driven path generation mechanism, which is based on the semantic correlation and dependency structure between nodes in the knowledge graph. It gradually constructs a directed acyclic graph to ensure that the task execution path has logical closure and the legality of data dependencies.

[0124] Around the starting node, the system constructs a path structure based on a directed acyclic graph. Graph structure generation process:

[0125] 1) Path initialization: (Intent semantic node) serves as the starting root node;

[0126] 2) Semantic expansion prediction: using conditional semantic escaping probability. Predict the next tool node;

[0127] 3) Tool call for edge construction: If P exceeds the threshold (Refer to S23), then establish The directed edge.

[0128] 4) Graph structure closure determination: The graph stops when it expands to a terminal node that satisfies the target requirements.

[0129] The path escaping formula is as follows:

[0130]

[0131] in, Represents a multidimensional semantic transfer function; Indicates the current node With semantic intent vector Under the condition of, transfer to node The probability of; These represent the current tool node and the candidate tool node, respectively.

[0132] S33: Parameter slot extraction and variable template construction.

[0133] This step involves extracting variable entities from the semantic context of each tool node in the aforementioned directed acyclic path graph, filling parameter slots, and generating a variable template structure that the system can execute. After the path graph is constructed, to make it practically executable, the system needs to transform the abstract path graph into a parameterized execution graph. For each tool node, a list of slots to be matched is generated according to its defined parameter specifications. Then, using a conditional slot extraction model, the directional score of each slot in the current context is calculated. Based on the strategy of maximizing the score, select the context entity corresponding to the slot and construct a variable template. .

[0134] The formula for extracting parameter slots is:

[0135]

[0136] in, This represents the Sigmoid activation function, and its output is the correlation strength between the slot, the current node, and the intent vector. Indicates that, given an intent vector and the current tool node Under these conditions, slot The points obtained from the draw; slot Embedded vector; For tool nodes The embedding vector; This represents the transpose of the parameter matrix, used for the linear transformation in the last layer, combined with sigmoid activation, to output the final slot association score; The scoring weight matrix for slots is used to project the fused feature vectors onto the scoring space.

[0137] The final generated variable template will serve as input to the task execution engine, driving the actual tool call process and ensuring that the semantic path graph is feasible and has complete execution.

[0138] S40: MCP tool capability parsing and semantic binding.

[0139] This step, following the semantic-driven task path graph construction and variable parameter template generation in the previous stage, requires binding the abstract path graph with actual callable tool capability resources. Through tool resources registered under the MCP protocol, dynamic parsing and capability modeling of tool interfaces are completed, enabling vectorized expression of tool capabilities and mapping intent paths to tool capabilities.

[0140] S41: MCP tool protocol scanning and capability structured modeling.

[0141] This step begins with interface scanning and capability parsing of available MCP Servers. The system dynamically acquires description information for each tool through standardized MCP protocol communication, extracting metadata such as function points, input / output parameters, and dependency constraints to form a structured capability representation. Subsequently, based on this structured information, a tool capability vector is constructed. This unifies the semantic feature space of each tool node. The capability vector not only encodes the basic description of the tool (such as function labels and parameter types), but also integrates contextual dependencies and execution constraints to form a multi-dimensional semantic expression.

[0142] The formula for constructing tool capability vectors is:

[0143]

[0144] in, Describe the functional features of the tool using textual features; The input parameters of the tool are standardized features; Define the characteristics of the tool's output; Tool dependency and constraint rule characteristics; To unify the feature decoder.

[0145] S42: Tool capability vectorization is semantically aligned with intent vector.

[0146] After obtaining the capability vectors of all tools, this step aligns and matches the semantic vectors of each node in the intent path with the tool vectors within the same semantic space. Through similarity calculation and feature fusion, the system evaluates the matching degree between each tool node and the user's intent, ensuring that each task path is bound to the most suitable tool capability resource. The key to this process is selecting the tool path that best meets the user's needs by calculating the similarity between the capability vector and the intent vector. Specifically, semantic alignment ensures the accuracy of tool selection by optimizing the alignment of tool vectors and intent vectors within the same semantic space.

[0147] The formula for aligning tools with semantic intent:

[0148]

[0149] in, It is a tool capability vector; It is the normalized intention vector; For similarity calculation; This is a toolset after similarity calculation.

[0150] S43: Semantic-tool matching mechanism construction and optimal tool path selection.

[0151] This step first filters tool paths based on the user's input intent vector. By comparing the semantic similarity between each tool and the intent, the system determines which tools best meet the task objective.

[0152] The semantic similarity calculation typically involves encoding textual information such as tool function descriptions and input / output parameter specifications, and then converting it into a vector representation. Subsequently, cosine similarity and an algorithmic approach are used to calculate the semantic similarity between the demand intent vector and the tool vector, as shown in the following formula:

[0153]

[0154] Where q represents the demand intent vector, and t represents the tool semantic vector. The closer this value is to 1, the higher the match between the tool and the demand.

[0155] Subsequently, considering the execution constraints of each tool (such as dependencies and execution order), the system selects the optimal tool path and generates a corresponding execution plan. During the tool path selection process, the system considers not only the compatibility of individual tools but also the collaborative effectiveness of multiple tools to optimize overall task execution efficiency.

[0156] Optimal toolpath formula:

[0157]

[0158] in, It is a set of tools, containing the capability vectors of multiple tools; This represents the intent vector of the user's needs. is the tool weight coefficient; N is the size of the tool set.

[0159] S50: Semantic execution scheduling and task flow assembly.

[0160] This step includes building the task flow, adapting tools and protocols, and optimizing task scheduling to ensure that each task is executed according to the optimal path and order, and to automatically retry in case of exceptions to ensure the running status of tasks.

[0161] S51: MCP Protocol Task Flow Construction and Dependency Graph Assembly.

[0162] Figure 3 A flowchart for constructing and assembling the dependency graph for the MCP protocol task flow.

[0163] This step dynamically constructs a task flow graph based on the input-output relationships, dependency constraints, and execution conditions between tasks.

[0164] The specific steps are as follows:

[0165] 1) Task Node Identification: The system extracts task nodes from the task description, including the task's function, inputs and outputs, and execution requirements. Each node represents an execution unit.

[0166] 2) Dependency Resolution: Based on the dependencies between tasks, the system resolves and identifies which tasks must be completed before others. The core of this step is analyzing the input-output relationships of the tasks and the constraints between them.

[0167] 3) Task Flow Graph Assembly: After the task dependencies are clear, the system will combine the task nodes into an execution flow graph in sequence. This graph ensures that tasks are executed in the correct order, avoiding execution conflicts caused by unmet dependencies.

[0168] 4) Parallel task scheduling: Where possible, the system will optimize the task flow graph and identify concurrently executable tasks to improve overall execution efficiency. This is typically adjusted based on the independence between tasks and resource availability.

[0169] S52: Parameter mapping, protocol encoding / decoding, and tool adaptation.

[0170] Figure 4 It is a flowchart of parameter mapping, protocol encoding / decoding and tool adaptation.

[0171] After the task flow graph is constructed, this step requires matching the logical tasks in the task flow with the actual tool interfaces under the MCP protocol at the parameter level, unifying the protocol format, and dynamically judging interface adaptation to form a complete task execution preparation path.

[0172] The specific implementation steps are as follows:

[0173] 1) Input / Output Parameter Mapping: First, parameter matching is automatically completed based on the output metadata of the upstream task and the input specifications of the downstream tool. If there is a semantic inconsistency between the upstream output and the downstream input, the system automatically adjusts based on the metadata semantic correction mechanism. The correction process calculates similarity after encoding field features, using the following formula:

[0174]

[0175] in, It is an upstream output field; It is a downstream input field; For field text feature editor; This is a pre-defined similarity function.

[0176] 2) Protocol Encoding / Decoding and Standardization: After parameter matching, the system needs to adapt the interface protocol of the target tool. First, the interface request body's fields are rearranged or packaged. Then, the interface return body is parsed and necessary fields are extracted. Based on the parsed and extracted content, exception codes and status codes are standardized to adapt to the unified specifications of the scheduling process.

[0177] 3) Dynamic Tool Interface Adaptation and Fit Verification: After protocol standardization, the system will determine the fit between the current task requirements and the tool capability vector. The fit calculation is based on the tool capability vector space modeled in stage S31, using simple similarity inference to determine fit, without the need for remodeling. If the fit is insufficient, the system will attempt to select other alternative tools or provide task adjustment suggestions to ensure the effectiveness and stability of the execution path.

[0178] 4) Abnormal Parameter Handling and Fault Tolerance Compensation: During parameter mapping or interface adaptation, if abnormal situations such as missing parameters or mismatched field types are encountered, the system will automatically attempt to correct them based on a context inference mechanism. Specifically, this includes: inference based on parameter characteristics of similar tasks in the most recent context; fault tolerance compensation using default values ​​or intelligently inferred values; and, if necessary, sending the abnormal information back to the scheduling layer for manual confirmation or secondary automatic repair.

[0179] S53: Asynchronous scheduling and retry mechanism for multi-round task execution flow.

[0180] Figure 5 It is a flowchart of asynchronous scheduling and failure retry for multi-round task execution flow.

[0181] After the task flow is constructed, the system enters the multi-round task scheduling and execution phase. To ensure execution stability under high concurrency and correctness under complex dependencies, this step constructs a complete scheduling closed loop through asynchronous scheduling mechanisms, dynamic priority adjustment, failure retry control, and interrupt recovery mechanisms.

[0182] The specific implementation steps are as follows:

[0183] 1) Constructing an asynchronous task scheduling framework: The system is based on an event-driven and message model to asynchronously schedule the execution of each task node. Each task node is pushed to the scheduling queue once its dependency conditions are met, maximizing resource utilization and execution concurrency. The formula for determining whether a node is executable is:

[0184]

[0185] in, The current task node; For nodes The set of all preceding dependent nodes; For a single front-end node; For nodes Is it ready? (1 indicates ready, 0 indicates not ready).

[0186] 2) Context State Tracking and Dynamic Priority Adjustment: After a task is pushed into the queue, the system tracks the execution status of each task in real time and dynamically adjusts the scheduling priority based on the task's urgency and dependency impact. The dynamic priority calculation formula for a node is as follows:

[0187]

[0188] in, The topological hierarchy of the nodes (the closer to the starting point, the higher the priority); The number of downstream tasks affected by the node; , To adjust the weighting coefficients.

[0189] 3) Failure Detection and Intelligent Retry Strategy: If a task in the queue fails, the system handles it in a tiered manner based on the failure type. If the failure is retryable (e.g., temporary network fluctuations), it will be added to the delayed retry queue; if it is a non-retryable failure (e.g., parameter errors), the error will be directly recorded and subsequent dependent tasks will be interrupted. The delay algorithm for task retry is as follows:

[0190]

[0191] in, Base retry time; This represents the number of retries for the current task. This is the delay time.

[0192] 4) Multi-round execution flow coordination and anomaly recovery: In multi-round task flow execution scenarios, the system supports persistent storage of intermediate states. When batch failures or system interruptions occur, recovery can be performed from the most recent consistent snapshot, avoiding a complete rollback. The anomaly recovery process includes: verifying the state comparison between completed nodes and nodes to be executed, dynamically completing the task reconstruction of the dependency chain after failed nodes, and if recovery fails, rolling back to a stable snapshot based on the most recent snapshot.

[0193] S60: Multi-source data fusion and indicator calculation.

[0194] This step utilizes a modular data extraction mechanism to load data from heterogeneous, multi-source data sources and establish a unified connection channel. Subsequently, based on task requirements, indicator calculation functions are dynamically constructed to complete data fusion, cleaning, and feature extraction, providing consistent and structured data support for subsequent data report generation and inference analysis.

[0195] S61: Modular loading of data extraction and initialization of multi-source connections.

[0196] This step establishes a data extraction and connection initialization framework, enabling efficient and intelligent multi-source data fusion. This framework not only supports traditional data source configuration modes but also introduces the Metadata Discovery Engine—a metadata vectorization modeling and detection engine—to automatically identify and dynamically adapt metadata from data sources, significantly improving the intelligence of multi-source integration.

[0197] The specific implementation steps are as follows:

[0198] 1) Data Source Identification: Upon initial data source integration, the system automatically determines the data source type and acquires metadata, proactively probing connection information and metadata for feature fingerprinting. It then calculates matching confidence scores based on multiple features, including connection information, Table Name, Columns, and Comments, and performs vectorized modeling. The vectorized modeling method is referenced in S41, and the confidence score generation formula is:

[0199]

[0200] in, This represents the weight of the i-th feature; This represents the detected feature value; This represents the feature value corresponding to the k-th type of standard data source; This indicates feature similarity calculation (e.g., 1 for complete similarity, 0.5 for partial matching).

[0201] 2) Session Authentication and Connection. After data source identification, authentication will be initiated based on the corresponding data source. Once a connection is established, it will be uniformly included in the connection pool management. The connection model can be represented as:

[0202]

[0203] in, For an active connection pool; It is a single connection instance, and all connections are dynamically adjusted according to the load.

[0204] S62: Data indicator function construction and dynamic binding.

[0205] This step, after initializing the data source, establishes a semantically driven metric generation mechanism. Combining field metadata, user intent, and contextual task configuration, it automatically constructs metric expressions adapted to SQL or DSL languages ​​and executes them to retrieve data. This mechanism, through a Context-Aware Binding Engine (CABE), dynamically adapts metric functions to the current data environment, supporting function template selection, parameter filling, and execution binding, thus improving the consistency of metric construction across data sources and multiple languages. The construction process consists of three steps: semantic analysis and template matching, context binding parameter calculation, and expression generation and registration. The dynamic binding formula for the metric function is as follows:

[0206]

[0207] in, A collection of predefined function templates; For contextual task constraints; This is the current data structure.

[0208] S63: Unified modeling of the cleaning and execution process of integrated datasets.

[0209] After completing the semantic construction and dynamic binding of the indicator functions, this step needs to ensure that these functions can be executed accurately on a consistent data structure. Therefore, a cleaning and unified modeling process will be carried out around the fused dataset, aiming to generate a stable and controllable computational task flow to provide structured support for subsequent analysis.

[0210] First, an embedded field similarity modeling method is used to semantically align the fused field names, ensuring they conform to a predefined standard structure. For missing or redundant fields, the system performs missing completion and anomalous field filtering based on contextual dependencies and task metadata. Next, the system loads a pre-built feature generation template and applies rule functions and statistical functions to the field set to automatically construct a data computation query task and return the result data.

[0211] For field similarity modeling, refer to the similarity modeling method in step S23.

[0212] S70: Intelligent chart selection and visual structure generation.

[0213] This step aims to automatically translate the results returned in step S60 into a visual representation. Through intelligent recommendation and structural modeling mechanisms, it automatically completes the selection of chart types, layout combination, and interactive logic reasoning, thereby generating high-quality visual representations from data to graphics.

[0214] S71: Intelligent chart selection and visual structure generation.

[0215] This step builds a chart type recommendation engine based on the semantic attributes, structural dimensions, and statistical features of the data fields in step S60. This engine integrates rule-guided and machine learning models, achieving automatic matching of the most suitable chart type through a data feature-driven approach. In the chart recommendation process, the system first determines the role of each field (such as dimension, metric, time label, etc.), then performs preliminary screening based on the chart adaptation mapping matrix, and finally comprehensively evaluates the semantic fit and visual capacity of candidate charts. The recommendation process is formalized as follows:

[0216]

[0217] in, Indicates the type of chart output by the recommendation engine; This indicates the degree of matching between the current chart structure and the field structure; Measure the differences in how the chart reveals the distribution patterns of the fields; This represents the complete set of candidate chart types; This represents the set of fields in the current input dataset; This represents the system's preset chart field adaptation rule set.

[0218] S72: Application of chart structure synthesis and style adaptive algorithm.

[0219] This step, based on the chart type determined in the previous step, uses a structure synthesis engine to automatically lay out and optimize the style of chart components, ensuring that the recommended chart conforms to the data expression logic at the presentation layer. The structure synthesis part constructs a visualization structure tree based on data field roles (dimensions / measures), hierarchical relationships, and serialization requirements; the style adaptation part uses an adaptive adjustment algorithm, combined with parameters such as chart theme, background color, display density, and terminal resolution, to generate the final chart style configuration. The formula for the chart structure synthesis process is:

[0220]

[0221] in, The generated chart structure tree; For the input field set; For chart templates; Layout parameters for building the driving layer.

[0222] Then, adaptive optimization of the style parameters is performed, with the objective function as follows:

[0223]

[0224] Where w represents the set of style parameters to be adjusted; Represents the automatic evaluation function for the i-th visual factor; This indicates the target visual threshold of the factor in the current context; Importance weights of each style factor.

[0225] S80: Visualized results output and user interaction.

[0226] After generating the chart structure and style, this step immediately enters the unified output process. First, the scheduling engine triggers the chart component rendering module, which, based on the established structure and style configuration, completes the parallel construction of multimodal results, including charts, tables, and reports. Subsequently, through the built-in multi-terminal adapter, the various rendering results are converted into output formats suitable for Web, PDF, or embedded large screens, and can be packaged into a unified display container to form standardized components.

[0227] Example 2

[0228] This embodiment provides an intelligent data report generation system based on the MCP protocol, including:

[0229] The data acquisition module is configured to acquire user natural language commands;

[0230] The semantic intent module is configured to construct semantic intent vectors based on the acquired user natural language instructions and the contextual semantic structure.

[0231] The semantic task path graph module is configured to construct a semantic task path graph based on semantic intent vectors and utilizing knowledge graphs.

[0232] The mapping module is configured to map intent paths to tool capabilities based on the constructed semantic task path graph and the MCP protocol.

[0233] The task flow module is configured to build task flows and optimize task scheduling based on the MCP protocol;

[0234] The fusion module is configured to perform unified modeling of data sources based on the constructed task flow, generating a stable and controllable computing task flow;

[0235] The graphics generation module is configured to generate visual representations from data through intelligent recommendation and structural modeling mechanisms.

[0236] A computer-readable storage medium storing a plurality of instructions adapted for loading and execution by a processor of a terminal device of the aforementioned intelligent data report generation method based on the MCP protocol.

[0237] A terminal device includes a processor and a computer-readable storage medium, the processor being configured to implement various instructions; the computer-readable storage medium being configured to store multiple instructions adapted for loading and execution by the processor of the aforementioned intelligent data report generation method based on the MCP protocol.

[0238] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A method for generating intelligent data reports based on the MCP protocol, characterized in that, include: Based on the acquired user natural language instructions, construct a semantic intent vector through contextual semantic structure; Based on semantic intent vectors and utilizing knowledge graphs to construct semantic task path graphs; Based on the constructed semantic task path graph, intent paths are mapped to tool capabilities using the MCP protocol; Task flow is built based on the MCP protocol and task scheduling is optimized. Based on the constructed task flow, data sources are modeled uniformly to generate stable and controllable computing task flows; Visual representations of data are generated by intelligent recommendation and structural modeling mechanisms. The intent path and tool capability mapping based on the MCP protocol includes: performing interface scanning and capability parsing on available MCP servers; dynamically obtaining registered tool resource description information and extracting metadata content through standardized MCP protocol communication to form a structured capability representation; and constructing tool capability vectors based on the structured information. To uniformly represent the semantic feature space of each tool node, forming a multi-dimensional semantic expression, the formula for constructing the tool capability vector is: in, Describe the functional features of the tool using textual features; The input parameters of the tool are standardized features; Define the characteristics of the tool's output; Tool dependency and constraint rule characteristics; For a unified feature encoder; After obtaining the capability vectors of all tools, the semantic vectors of each node in the intent path are aligned and matched with the tool vectors in the same semantic space. By combining similarity calculation with feature fusion, the matching degree between each tool node and the user's intent is evaluated; By calculating the similarity between the capability vector and the intent vector, the tool path that best meets the user's needs is selected. Semantic alignment optimizes the alignment of the tool vector and the intent vector within the same semantic space, as follows: ,in, It is a tool capability vector; It is the normalized intention vector; For similarity calculation; The toolset after similarity calculation; Finally, based on the user's input intent vector, the tool path is filtered, and the formula for the optimal tool path is expressed as: in, A collection of tools; This represents the intent vector of the user's needs. is the tool weight coefficient; N is the size of the tool set.

2. The intelligent data report generation method based on the MCP protocol according to claim 1, characterized in that, The construction of semantic intent vectors through contextual semantic structure includes: based on the BIG-GRU + Self-Attention architecture, semantic feature extraction and global semantic aggregation are performed sequentially. First, BIG-GRU is used to perform forward and backward semantic modeling on the input sentence to extract the semantic role of each word in the sequence in the context; then, the sequence is used as the input of Self-Attention to capture the association between the current semantic focus and historical semantics, and semantic relevance is constructed. Then, an initial semantic intent vector is constructed based on semantic relevance. A normalization strategy modeler is introduced to perform feature compression and orientation alignment on the semantic intent vector, as follows: ,in, Let be the attention weight at time step t; The context feature vector is the joint output of BI-GRU and Self-Attention; the intent vector is normalized. The formula for construction is: ,in, The L2 norm of the intention vector; This is the normalized semantic intent vector; Finally, the normalized semantic intent vector is... The data is passed to the task reasoning module; by constructing an intent-tool matching scoring function, the optimal operation path is dynamically selected from the registered tool set to realize the mapping and triggering of intent to action; during the reasoning process, a multi-dimensional semantic embedding retrieval mechanism is introduced to calculate the cosine similarity between the embedding vector of each tool and the current intent vector to achieve the optimal tool selection, expressed as: in, For tools Match score with the current intent; For the first Embedding vectors of candidate tools.

3. The intelligent data report generation method based on the MCP protocol according to claim 2, characterized in that, The construction of a semantic task path graph based on semantic intent vectors and utilizing knowledge graphs includes: Using semantic intent vectors Semantic space matching is performed with the node representations in the pre-established business knowledge graph to complete the initial alignment of intent to graph semantic nodes, represented as: ,in Let be the embedding vector of the i-th node in the graph; A set of knowledge graph nodes; The optimal matching semantic node; Based on optimal matching semantic nodes An intent-driven task execution path graph is constructed, employing a semantic instruction-driven path generation mechanism. Based on the semantic relevance and dependency structure between nodes in the knowledge graph, a directed acyclic graph is gradually constructed. The path escaping representation of the directed acyclic graph is as follows: in, Represents a multidimensional semantic transfer function; Indicates the current node With semantic intent vector Under the condition of, transfer to node The probability of; These represent the current tool node and candidate tool nodes, respectively; finally, a variable template structure that can be executed by the system is generated based on the directed acyclic path graph.

4. The intelligent data report generation method based on the MCP protocol according to claim 3, characterized in that, The process of generating a variable template structure executable by the system based on a directed acyclic path graph includes extracting variable entities from the semantic context of tool nodes in the directed acyclic path graph, filling parameter slots, and generating a variable template structure executable by the system. Specifically, the abstract path graph is transformed into a parameter-defined execution graph. For each tool node, a list of slots to be matched is generated according to the defined parameter specifications. A conditional slot extraction model is used to calculate the directional score of each slot in the current context. Based on the strategy of maximizing the score, select the context entity corresponding to the slot and construct a variable template. The formula for extracting parameter slots is: in, This represents the Sigmoid activation function; Indicates that, given an intent vector and the current tool node Under these conditions, slot The points obtained from the draw; slot Embedded vector; For tool nodes The embedding vector; This represents the transpose of the parameter matrix; A weight matrix for scoring slots.

5. The intelligent data report generation method based on the MCP protocol according to claim 4, characterized in that, The process of constructing a task flow and optimizing task scheduling based on the MCP protocol includes: Extract task nodes from the task description, analyze the input-output relationship of tasks and the constraints between tasks based on the dependencies between tasks, and combine the task nodes in sequence into an execution flow graph and optimize it. After the task flow graph is constructed, the logical tasks in the task flow are matched with the actual tool interfaces under the MCP protocol at the parameter level, the protocol format is unified, and the interface adaptation is dynamically judged to form a complete task execution preparation path. Parameter matching is completed based on the output metadata of the upstream task and the input specifications of the downstream tool. If the upstream output and the downstream input are semantically inconsistent, automatic adjustment is performed based on the metadata semantic correction mechanism, as shown below: in, It is an upstream output field; It is a downstream input field; For field text feature editor; For pre-defined similarity functions; After completing parameter matching, the interface protocol of the target tool is adapted. First, the fields of the interface request body are rearranged or packaged. Then, the content of the interface return body is parsed and necessary fields are extracted. Based on the parsed and extracted content, the exception code is unified, and dynamic tool interface adaptation and fit verification, as well as exception parameter handling and fault tolerance compensation, are performed. Finally, a complete scheduling closed loop is built based on the scheduling execution phase.

6. The intelligent data report generation method based on the MCP protocol according to claim 5, characterized in that, The construction of a complete scheduling closed loop based on the scheduling execution phase includes a multi-round task scheduling execution phase after the task flow is constructed. This closed loop is built through asynchronous scheduling mechanisms, dynamic priority adjustment, failure retry control, and interrupt recovery mechanisms. Specifically, an asynchronous task scheduling framework is constructed based on an event-driven and message model to asynchronously schedule the execution of each task node. Each task node is pushed to the scheduling queue after its dependency conditions are met, maximizing resource utilization and execution concurrency. The formula for determining whether a node is executable is as follows: in, The current task node; For nodes The set of all preceding dependent nodes; For a single front-end node; For nodes Is it ready? Next, context state tracking and dynamic priority adjustment are performed: the execution status of each task is tracked in real time, and the scheduling priority is dynamically adjusted according to the urgency and dependency impact of the task. The dynamic priority calculation formula for a node is as follows: ,in, The topological hierarchy of the nodes; The number of downstream tasks affected by the node; , To adjust the weighting coefficients; Finally, a failure detection and intelligent retry strategy is implemented: Failed tasks are categorized based on their failure type. Retryable failures are placed in a delayed retry queue; non-retryable failures are directly recorded and subsequent dependent tasks are interrupted. The delay algorithm for task retry is as follows: in, Base retry time; This represents the number of retries for the current task. This is the delay time.

7. The intelligent data report generation method based on the MCP protocol according to claim 6, characterized in that, The unified modeling of data sources based on the constructed task flow includes: The Metadata Discovery Engine—a metadata vectorization modeling detection engine—is introduced to automatically identify and dynamically adapt metadata from data sources. Specifically, upon initial data source access, the data source type is determined and metadata is acquired. Connection information and metadata are detected and fingerprinted. Vectorization modeling is then performed by calculating matching confidence scores using multiple features. The confidence score generation formula is as follows: in, This represents the weight of the i-th feature; This represents the detected feature value; This represents the feature value corresponding to the k-th type of standard data source; Indicates feature similarity calculation; After the data source is identified, authentication is initiated based on the corresponding data source. Once a connection is established, all connections are managed within the connection pool. The connection model is represented as follows: ,in, For an active connection pool; It is a single-connection instance; Then, a semantically driven metric generation mechanism is constructed. Combining field metadata, user intent, and contextual task configuration, metric expressions are built and executed to acquire data. This mechanism, through a context-aware binding engine, achieves dynamic adaptation of metric functions to the current data environment, including semantic analysis and template matching, context binding calculation parameters, expression generation and registration. The dynamic binding formula for the metric function is: ,in, A collection of predefined function templates; For contextual task constraints; The current data structure is used; finally, the fused dataset is cleaned and uniformly modeled to generate a stable and controllable computational task flow.

8. The intelligent data report generation method based on the MCP protocol according to claim 7, characterized in that, The method of generating visual representations from data to graphics through intelligent recommendation and structural modeling mechanisms includes: Based on the semantic attributes, structural dimensions, and statistical features of data fields, a chart type recommendation engine is constructed. This engine achieves automatic matching of the most suitable chart type through a data feature-driven approach. In the chart type recommendation process, each field is assigned a role, and initial screening is performed based on a chart adaptation mapping matrix. Finally, the semantic fit and visual capacity of candidate charts are comprehensively evaluated. The recommendation process is formally represented as follows: in, Indicates the type of chart output by the recommendation engine; This indicates the degree of matching between the current chart structure and the field structure; Measure the differences in how the chart reveals the distribution patterns of the fields; This represents the complete set of candidate chart types; This represents the set of fields in the current input dataset; This represents the system's preset chart field adaptation rule set; Based on a defined chart type, the chart components are automatically laid out and styled using a structure composition engine. The formula for the chart structure composition process is as follows: ,in, The generated chart structure tree; For the input field set; For chart templates; The layout parameters are constructed for the driving layer, and then the style parameters are adaptively optimized. The objective function is: Where w represents the set of style parameters to be adjusted; Represents the automatic evaluation function for the i-th visual factor; This indicates the target visual threshold of the factor in the current context; Importance weights of each style factor.

9. A smart data report generation system based on the MCP protocol, executing the smart data report generation method based on the MCP protocol as described in claim 1, characterized in that, include: The data acquisition module is configured to acquire user natural language commands; The semantic intent module is configured to construct semantic intent vectors based on the acquired user natural language instructions and the contextual semantic structure. The semantic task path graph module is configured to construct a semantic task path graph based on semantic intent vectors and utilizing knowledge graphs. The mapping module is configured to map intent paths to tool capabilities based on the constructed semantic task path graph and the MCP protocol. The task flow module is configured to build task flows and optimize task scheduling based on the MCP protocol; The fusion module is configured to perform unified modeling of data sources based on the constructed task flow, generating a stable and controllable computing task flow; The graphics generation module is configured to generate visual representations from data through intelligent recommendation and structural modeling mechanisms.

Citation Information

Patent Citations

  • Natural language question and answer method, system and device, medium and product

    CN120578755A

  • Cabin active recommendation system and method based on knowledge graph and semantic reasoning

    CN120578813A