Dynamic tool discovery and adaptive system construction method oriented to MCP intelligent agent

By employing a dynamic tool discovery and adaptive system construction method, the scalability and adaptability issues of the MCP intelligent agent system in changing environments are addressed. This method enables automatic tool identification and adaptive integration, thereby enhancing the system's scalability and intelligence.

CN121092241APending Publication Date: 2025-12-09SANYA RES INST OF HAINAN UNIV +1

Patent Information

Application Number
CN202511257515.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-04
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing MCP intelligent agent systems lack flexible tool expansion and dynamic adjustment capabilities when facing changing environments, making it difficult to meet real-time response requirements. Furthermore, the lack of a unified tool capability description mechanism limits the system's scalability and intelligence level.

Method used

This paper presents a dynamic tool discovery and adaptive system construction method for MCP agents. Through a tool registration and capability description mechanism, environmental monitoring and task requirement analysis, a dynamic tool discovery module, a policy engine, and a system adaptive construction module, it realizes automatic tool identification, capability matching, and adaptive integration.

Benefits of technology

It improves tool discovery efficiency, enhances system scalability and ecosystem collaboration capabilities, supports tool reuse across different agents or systems, and strengthens the autonomy and collaboration capabilities of MCP agents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092241A_ABST
    Figure CN121092241A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of agent systems, and provides an MCP agent-oriented dynamic tool discovery and adaptive system construction method, which comprises the following steps of: designing a uniform interface to register tools, and storing tool data through a dictionary structure; environment parameters are collected, external input and context information are received, three types of data are fused, task types are judged according to priorities, and task requirements are analyzed; according to the capability description during tool registration, the suitability of task execution is judged, a correlation score is calculated, and tools with the score lower than a preset score are screened; comprehensive calculation is carried out by combining the correlation score of the tool, the cost and the delay value, and the tool for executing the task is selected according to the score; according to the selected tool and the current operation environment, resources needed by tasks and an execution sequence are judged, and an execution chain is automatically constructed; and recording and collecting feedback data, evaluating an execution result, and iterating tool parameters.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of agent systems, and particularly relates to a dynamic tool discovery and adaptive system construction method for MCP agents. BACKGROUND

[0002] With the wide application of agent systems in complex task processing, automatic control and human-computer interaction, how to improve the adaptability of the agent systems in dynamic environments has become a research hotspot.

[0003] In Chinese application No. CN202410052559.2, an information processing method based on a multi-agent system and a multi-agent system are disclosed. The configuration method comprises: the multi-agent system comprises a plurality of agents; the method is applied to a target agent, and the target agent is any agent in the plurality of agents; the target agent corresponding to the target agent is determined; based on an information processing model, when the target agent corresponding to the target agent and the function do not match, the function and the target agent corresponding to the target agent are determined; the target agent is sent to the matched agent for processing, the analysis capability of the information processing model is used to quickly and accurately realize the circulation of the target information between the agents, the target information is processed by the appropriate agent, and the processing effect of the task is effectively improved.

[0004] In the technical field of agent systems, although the existing technology can quickly and accurately circulate information by using an information processing model and improve the task processing effect, when the agent system faces a changing environment, most MCP systems still rely on a static configuration tool chain, lack flexible expansion and dynamic adjustment capability, and are difficult to meet the real-time response demand in the resource change or task adjustment scene; in addition, the lack of a unified tool capability description mechanism also hinders the reuse and discovery of tools between systems, and limits the scalability and intelligence level of the system.

[0005] Therefore, a method for supporting dynamic tool discovery, capability description and adaptive system construction is urgently needed to improve the flexibility and intelligence of the MCP system. SUMMARY

[0006] The application provides a dynamic tool discovery and adaptive system construction method for MCP agents, which aims to realize automatic identification, capability matching and adaptive integration of tools of the agent system in a changing environment, solve the problems of poor system expansibility and weak adaptive capability in the prior art, and significantly improve the autonomy and collaboration capability of the MCP agent.

[0007] The technical solution adopted by the application to solve the above technical problems is: a dynamic tool discovery and adaptive system construction method for MCP agents is provided, which comprises:

[0008] The tool registration and capability description mechanism is established to design a unified interface to register tools, save tool data through a dictionary structure, and describe the dependency relationship, capability list, input and output parameter type, and name of the tool.

[0009] The environmental monitoring and task demand analysis is to collect environmental parameters, receive external input and context information, fuse three types of data to determine the task type according to the priority, and analyze the task demand.

[0010] The dynamic tool discovery module is to judge the adaptability of the tool for executing the task according to the capability description of the tool registration, calculate the correlation score, and filter the tools with a score lower than a preset score.

[0011] The strategy engine performs tool optimization by combining the correlation score, cost, and delay value of the tool to comprehensively calculate and select the tool for executing the task according to the score.

[0012] The system self-adaptive construction module is to judge the required resources and execution order of the task according to the selected tool and the current running environment, and automatically construct an execution chain.

[0013] Executing the task and collecting feedback information is to record and collect feedback data after the task is completed, evaluate the execution result, and iteratively update the tool parameters through online learning.

[0014] As a preferred embodiment, the specific steps of the tool registration and capability description mechanism are as follows: a unified tool registration interface is designed to receive basic information of the tool, an agent adaptive system selects and calls the tool according to the task demand, different functions of the tool registration interface are defined, the data format adopts a JSON format to transmit tool information, a tool ID is used as a unique identifier, all data of the tool is saved by the agent adaptive system using a dictionary structure, and the basic information is packaged and sent to the registration interface for registration of the tool.

[0015] When multiple tools are used in series, the related tools are connected into a tool chain, the tool chain information is registered, a corresponding configuration file is defined to record the execution order, dependency relationship, and input and output parameter type information of the tools in the tool chain, and multiple tools are automatically selected according to the capability list, input and output parameter type, and task requirement, and are connected in a predetermined order.

[0016] As a preferred embodiment, the specific steps of the environment monitoring and task demand analysis are as follows: collecting the current environment parameters of the agent, receiving external inputs and context information from different sources, integrating the environment parameters, external inputs and context information to form a unified data structure, comprehensively fusing three types of sources including task driving based on external input, task intention inference based on context and task adaptive switching based on environment state, and determining the current task type by using priority strategy, judging the task execution and degradation of the current running environment through the state perception mechanism, and mapping the task type and the function capability label.

[0017] For the task driving based on external input, when the agent adaptive system receives external user requests, platform task instructions or superior dispatcher commands, the task type is extracted from the input, and the task type is explicitly labeled in the request header, task label or structured field. For the task intention inference based on context, in the absence of explicit task instructions, the agent adaptive system will infer and determine the current task type according to the following context information. For the task adaptive switching based on environment state, the agent adaptive system collects the current environment state parameters in real time, and when the environment is in a constrained state, the agent adaptive system will automatically adjust the task type to a lightweight, offline processable and locally prioritized task. For the three sources, priority is set when there is an external input instruction, the external input instruction is used first, when there is no explicit external input instruction, the context information is inferred, and when the context is unclear and there is no external constraint, the environment state is used to adjust the task strategy.

[0018] The environment parameters are defined, the CPU, memory and disk states are obtained by using the commands in the operating system, the network connection is monitored by using the network monitoring tool, the environment parameters are updated by using the event-driven method, and the environment state vector E={cpu, memory, network} is constructed by integrating multiple environment parameters, wherein cpu, memory and network represent CPU load, memory state and network connection, respectively, and are mapped to the interval of 0 to 1 after normalization processing. The required capability label set and importance weight are established for each task type, the required labels of the task are matched with the current capability inventory by weighting, and the formula is:

[0019] ,

[0020] wherein m represents task m, represents the capability matching degree, i represents the capability label i, and n represents the total number of capability labels, represents the importance of the capability label i to the task m, represents the quality score of the capability label i in the capability inventory;

[0021] The capability matching degree of the comprehensive task and the environment state vector calculate the executable score, and a corresponding threshold is set in advance to perform or degrade the operation of the task.

[0022] As a preferred embodiment, the specific steps of the dynamic tool discovery module are: mapping the function declaration submitted when the task is initiated to the established capability label set, and outputting a candidate capability set; through an environment constraint filtering mechanism, removing tools that do not meet the running conditions by combining the running requirements declared by each tool when registered with the current environment state of the system;

[0023] A context-related tool fitness pre-scoring mechanism is introduced. By analyzing the processing records of tools in historical tasks, the matching degree of task context labels, and the basic fitness in the current environment, the preliminary relevance score of the tool is calculated, and the formula is:

[0024] ,

[0025] Among them, represents the preliminary relevance score of the candidate tool k, represents the context weight, represents the historical performance weight, represents the environment fitness weight, represents the context matching degree, represents the historical success rate, represents the environment fitness degree.

[0026] A corresponding preliminary relevance score threshold is set in advance for different candidate tools. For candidate tools below the score threshold, screening and removal are performed.

[0027] As a preferred embodiment, the specific steps of the strategy engine for tool optimization are: combining the cost value and the delay value of the post-candidate tool to calculate the overall relevance score of different candidate tools above the preliminary relevance score threshold, and the formula is:

[0028] ,

[0029] Among them, represents the overall relevance score of the candidate tool k, , , respectively represent the weights of the preliminary relevance score, the cost value, and the delay value, represents the cost value of the candidate tool k, represents the delay value of the candidate tool k.

[0030] The cost is considered from multiple dimensions, linearly weighted and synthesized, normalized to map to the interval of 0 to 1, the historical average delay of the tool is taken as the original delay, and the min-max method is used for normalization processing, and all numerical values are linearly scaled to the interval of 0 to 1.

[0031] According to the overall correlation score, the candidate tools are sorted from large to small, and the tools are selected for task execution according to the score.

[0032] As a preferred embodiment, the specific steps of the system adaptive construction module are: after selecting the tool, the agent adaptive system combines the current task type and context information to automatically generate the current execution chain structure of the agent, and constructs the execution path configuration and task scheduling process under the task driving;

[0033] According to the task type and the ability description of the selected tool, the agent adaptive system judges the data format and conversion logic required by the task, and according to the scheduling intention in the task context and the data registered by the selected tool, the agent adaptive system automatically fills in the required parameters for calling the selected tool, searches for components in the selected tool set according to the processing logic before and after the task, assembles them in the order of dependence to form a complete execution, selects the execution mode according to the current environment state, and reserves computing resources for high-priority tasks in advance.

[0034] As a preferred embodiment, the specific steps of executing the task and collecting feedback information are: calling the selected tool to complete the task according to the constructed execution chain, recording and collecting the execution results after each execution, constructing a standardized feedback information structure, calculating the execution situation of the feedback information, and storing it in the usage archive of the used tool for subsequent data adjustment;

[0035] The three types of feedback data, output quality score, timeliness score, and historical success rate, are integrated to calculate the task execution score, and the formula is:

[0036] ,

[0037] Wherein represents the task execution score, , , respectively represent the weights of quality, timeliness, and success rate, represents the output quality score, represents the timeliness score, represents the historical success rate.

[0038] Respectively set threshold value for output quality score, timeliness score, historical success rate, periodically collect and standardize task execution score, when there is feedback data lower than the preset threshold value, generate candidate parameter set through online learning method, collect execution feedback data in real time and build labeled sample, predefine loss function to optimize parameters in the way of small batch gradient descent, output candidate parameters regularly and form a set, use gray test to verify the influence on feedback data, record modification log for backtracking and offline retraining, so that the parameters are self-adaptive optimized.

[0039] The beneficial effects of the present application are:

[0040] 1. The present application stores various tool capability structures by standardized tool registration and capability description, supports quick retrieval and matching based on function, interface and performance, thereby improving tool discovery efficiency.

[0041] 2. The present application quantitatively scores based on capability matching degree, historical performance and environment adaptation degree, and sorts according to strategy, outputs interpretable optimal decision, which is convenient for audit and operation and maintenance judgment through dynamic tool discovery mode.

[0042] 3. The present application reduces the tool access threshold through unified capability description and interface specification, facilitates tool reuse among different intelligent agents or systems, and improves the overall scalability and ecological synergy of the system. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1 is a flowchart of the present application.

[0045] Figure 2 is an effect comparison chart of the present application and prior art, wherein the gray column represents the prior art and the black column represents the present application. DETAILED DESCRIPTION

[0046] In order to make the technical means, creative features, purposes and effects realized by the present application easy to understand, the present application is further described below in combination with specific embodiments, but the following embodiments are only preferred embodiments of the present application, not all. Based on the embodiments in the embodiments, other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.

[0047] Embodiment 1, as Figure 1 A dynamic tool discovery and self-adaptive system construction method for MCP intelligent agent, comprising the following steps:

[0048] Establishment of tool registration and capability description mechanism;

[0049] Environment monitoring and task demand analysis;

[0050] a dynamic tool discovery module;

[0051] the policy engine performs tool optimization;

[0052] the system adaptive construction module;

[0053] perform a task and collect feedback information.

[0054] The specific implementation steps are as follows: a dynamic tool discovery and adaptive system construction method for MCP intelligent agents, wherein the specific steps for establishing a tool registration and capability description mechanism are: designing and unifying a tool registration interface for receiving basic information of tools, including tool name, capability list, input and output parameter type, etc., and sending the above basic information to the registration interface for tool registration by packaging;

[0055] Specifically, the design of the unified tool registration interface, the intelligent agent adaptive system first selects and calls appropriate tools according to task requirements, defines different functions of the tool registration interface such as registration, update, query, and deletion, and transmits tool information in JSON format to make the registration and description of various tools consistent, uses a dictionary structure to save all data of the tools, and uses a tool ID as a unique identifier.

[0056] In the scenario of using multiple tools in series, such as text extraction to sentiment analysis, the related tools are connected into a tool chain, and the tool chain information is registered, and a corresponding configuration file is defined to record the execution order, dependency relationship, input and output parameter type, etc. of the tools in the tool chain, according to the use requirements, a plurality of tools are automatically selected according to the capability list, input and output parameter type, task requirements, etc. of the tools, and are connected in a predetermined order to realize dynamic replacement and degradation fault tolerance.

[0057] Based on the above steps, the specific steps for environment monitoring and task demand analysis are: collecting current environment parameters of the intelligent agent such as CPU load, memory state, network connection and disconnection, etc., receiving external input and context information from different sources, integrating the environment parameters, external input and context information to form a unified data structure, comprehensively judging the current task type by using a priority strategy based on task driving based on external input, task intention inference based on context, and task adaptive switching based on environment state, fusing three types of source information, and establishing a mapping between the task type and the function capability label through a state perception mechanism to judge whether the task is executable and whether it needs to be degraded.

[0058] Specifically, the fusion of three types of source information adopts a priority strategy to determine the task type, and drives the task based on external input. When the intelligent agent adaptive system receives external user requests, platform task instructions or superior dispatcher commands, the task type can be directly extracted from the input, and the task type is explicitly labeled in the request header, task label or structured field. For task intent inference based on context, in the absence of explicit task instructions, the intelligent agent adaptive system will infer the most likely task type based on the following context information, which is achieved through rule matching, keyword extraction, semantic label mapping and other means. For task adaptive switching based on environment state, the intelligent agent adaptive system collects real-time environment state parameters. When the environment is in a constrained state such as high load, network interruption, the intelligent agent adaptive system will automatically adjust the task type to lightweight, offline processable or local priority task. For the three sources, when there is an external input instruction, the external input instruction is preferred, when there is no explicit external input instruction, the context information is inferred, and when the context is unclear and there is no external constraint, the environment state is used to adjust the task strategy.

[0059] Specifically, the state-aware mechanism first defines the environment parameters, uses the commands in the operating system to obtain CPU, memory and disk state, uses network monitoring tools to monitor network connection, and uses event-driven method to update environment parameters. A plurality of environment parameters are integrated to construct an environment state vector E={cpu,memory,network}, wherein cpu, memory, network represent CPU load, memory state and network connection respectively, and are normalized to map to the interval of 0 to 1. The required capability label set and importance weight are established for each task type. The required label of the task and the current capability inventory are weighted matched, and the formula is:

[0060] ,

[0061] wherein m represents task m, represents the capability matching degree, i represents the capability label i, and n represents the total number of capability labels, represents the importance of capability label i to task m, represents the quality score of capability label i in the capability inventory.

[0062] The executable score is calculated by integrating the capability matching degree of the task and the environment state vector. The corresponding threshold is set in advance to execute or degrade the operation, such as degradation threshold of 0.4 and execution threshold of 0.75. For the executable score of 0.6, the task degradation operation is performed, which is specifically reduced by reducing the data volume, delaying the non-real-time task and other ways.

[0063] Based on the above steps, the specific steps of the dynamic tool discovery module are: performing preliminary matching based on function declaration, specifically mapping the function declaration submitted when the task is initiated to the established set of capability tags, and outputting a candidate capability set; through an environment constraint filtering mechanism, the running requirements declared by each tool when registered, such as whether to need networking, whether to depend on GPU, required memory limit, etc., are combined with the current environment state of the system, and tools that do not meet the running conditions are removed;

[0064] A context-related tool adaptation pre-scoring mechanism is introduced, which calculates the preliminary relevance score of the tool by analyzing the processing records of the tool in historical tasks, the matching degree of task context labels, and the basic adaptability in the current environment. The formula is:

[0065] ,

[0066] Among them, represents the preliminary relevance score of the candidate tool k, represents the context weight, represents the historical performance weight, represents the environment adaptation weight, represents the context matching degree, represents the historical success rate, represents the environment adaptation degree;

[0067] A corresponding preliminary relevance score threshold is set for different candidate tools in advance. For candidate tools below the score threshold, screening and removal are performed;

[0068] Based on the above steps, the specific steps of the strategy engine for tool optimization are: combining the cost value and delay value of the candidate tool, calculating the overall relevance score of the candidate tool, and the formula is:

[0069] ,

[0070] Among them, represents the overall relevance score of the candidate tool k, , , respectively represent the weights of the preliminary relevance score, the cost value, and the delay value, represents the cost value of the candidate tool k, represents the delay value of the candidate tool k;

[0071] Specifically, the cost and delay values of the candidate tools are linearly weighted and synthesized by considering multiple dimensions of cost, such as consumption of computing resources, memory occupation, bandwidth consumption, and monetary expenses, and are mapped to the interval of 0 to 1 through normalization processing; the historical average delay of the tool is taken as the original delay, and normalization processing is performed in the min-max manner, specifically, the maximum value and the minimum value are selected from the original numerical values, and all numerical values are linearly scaled to the interval of 0 to 1 according to the range of the minimum value and the maximum value;

[0072] According to the overall correlation score, the candidate tools are sorted from large to small, and one or several tools with the highest score are selected for task execution;

[0073] Based on the above steps, the specific steps of the system adaptive construction module are as follows: based on the selected optimal tool, the agent adaptive system combines the current task type and context information to automatically generate the current execution chain structure of the agent, and constructs the execution path configuration and task scheduling process under the task driving;

[0074] Specifically, the automatic generation of the agent execution chain structure first determines the data format and conversion logic required by the task according to the task type and the capability description of the selected tool, such as whether base64 encoding of images, JSON structured text, etc. is required, and then according to the scheduling intention in the task context such as whether batch processing or high-precision calculation is required, and the data registered by the selected tool, the agent adaptive system automatically fills in the parameters required for calling the selected tool, retrieves components in the selected tool set according to the pre-processing and post-processing logic contained in the task, assembles them in the order of dependence to form a complete execution, selects an execution mode according to the current environment state, such as selecting local call or remote API service, reserves computing resources in advance for high-priority tasks to ensure execution quality and timeliness;

[0075] Based on the above steps, the specific steps of executing the task and collecting feedback information are as follows: the selected tool is called to complete the task according to the constructed execution chain, and the execution result is recorded and collected after each execution, and a standardized feedback information structure is constructed, including task type, called tool name, output result quality score, current system environment state, etc. The execution situation is calculated based on the feedback information, and is stored in the usage file of the used tool for subsequent adjustment of tool performance weighting, optimization sorting, and strategy template data;

[0076] Specifically, the feedback information is calculated for execution, and the output quality score, timeliness score, and historical success rate are combined to calculate the task execution score, and the formula is as follows:

[0077] ,

[0078] wherein representing the task execution score, , , representing the weight of quality, timeliness, and success rate, respectively, representing the output quality score, representing the timeliness score, representing the historical success rate;

[0079] Thresholds are set for the output quality score, the timeliness score, and the historical success rate, respectively. For example, the output quality score threshold is 0.65, the timeliness score threshold is 0.7, and the periodic collection and standardization of task execution scores are performed. When there is feedback data below the preset threshold, a candidate parameter set is generated by an online learning method. Specifically, execution feedback data is collected in real time and labeled samples are constructed. A loss function is defined in advance, and the parameters are optimized by online calculation of gradients in small batches, gradient clipping, and regularization processing. Candidate parameters are output periodically to form a set, and a grayscale test is used to verify the impact on feedback data. Modification logs are recorded for backtracking and offline retraining to enable adaptive optimization of parameters.

[0080] Specifically, the parameters are updated by the small-batch gradient descent method, small-batch training samples are constructed according to time windows, the batch average loss is calculated for each small batch, and the gradient is obtained. Then, gradient clipping and regularization are performed to ensure numerical stability and generalization ability. The parameter candidate is updated incrementally using a momentum-based gradient optimizer. After the parameter candidate is constrained within a limited range, it is first verified on a small proportion of feedback data in the grayscale test. If the grayscale period performance meets the preset performance and compliance requirements, the online parameters are replaced in stages. Otherwise, it is automatically rolled back and a generation log is recorded.

[0081] The above describes embodiments of the present application. Without departing from the embodiments of the present application and its broader aspects, data modifications and method changes can be made by those skilled in the art based on the above. The appended claims are intended to include all such data modifications and method changes that do not depart from the embodiments of the present application.

Claims

1. A method for constructing a dynamic tool discovery and adaptive system for MCP agents, characterized in that, include: The establishment of a tool registration and capability description mechanism involves designing a unified interface to register tools, storing tool data through a dictionary structure, and describing the tool's dependencies, capability list, input and output parameter types, and names. Environmental monitoring and task requirements analysis involves collecting environmental parameters, receiving external inputs and contextual information, integrating these three types of data, determining the task type based on priority, and analyzing task requirements. The dynamic tool discovery module assesses the suitability of a tool for a given task based on its capability description during registration, calculates a relevance score, and filters out tools with scores below a preset threshold. The strategy engine selects the best tools by combining the relevance score of the tools with the cost and latency values ​​to calculate and select the tools to perform the task based on the scores. The system's adaptive build module determines the resources required by the task and the execution order based on the selected tools and the current operating environment, and automatically builds the execution chain. Executing tasks and collecting feedback information involves recording and collecting feedback data after the task is completed, evaluating the execution results, and iterating on the tool parameters through online learning.

2. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps for establishing the tool registration and capability description mechanism are as follows: Design a unified tool registration interface to receive basic tool information. The intelligent agent adaptive system selects and calls tools according to task requirements. Define different functions of the tool registration interface. The data format adopts JSON to transmit tool information. The tool ID is used as a unique identifier. The intelligent agent adaptive system saves all tool data using a dictionary structure and packages the basic information to send to the registration interface to register the tool. When multiple tools are used in series, the relevant tools are linked into a toolchain, and the toolchain information is registered. At the same time, a corresponding configuration file is defined to record the execution order, dependencies, and input / output parameter types of the tools in the toolchain. Based on the usage requirements, multiple tools are automatically selected and linked in a predetermined order according to the tool's capability list, input / output parameter types, and task requirements.

3. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps for environmental monitoring and task requirements analysis are as follows: The system collects current environmental parameters of the intelligent agent and receives external inputs and context information from different sources. It integrates environmental parameters with external inputs and context information to form a unified data structure. It combines three sources: task-driven based on external input, task intent inference based on context, and task adaptive switching based on environmental state. It uses a priority strategy to determine the current task type and uses a state awareness mechanism to judge the task execution status and degradation status of the current operating environment. It establishes a mapping between task type and functional capability label.

4. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 3, characterized in that: The specific steps of the environmental monitoring and task requirements analysis also include: For task-driven tasks based on external input, when the agent adaptive system receives external user requests, platform task instructions, or commands issued by the superior scheduler, the task type is extracted from the input and explicitly labeled in the request header, task tag, or structured fields. For task intent inference based on context, in the absence of explicit task instructions, the agent adaptive system will infer the current task type based on the following contextual information. For task adaptation switching based on environmental state, the agent adaptive system collects current environmental state parameters in real time. When the environment is under constraints, the agent adaptive system will automatically adjust the task type to a lightweight, offline-processable, or locally-priority task. Priorities are set for the three sources. When there are external input instructions, they are used first. When there are no explicit external input instructions, inference is made based on contextual information. When the context is unclear and there are no external constraints, the task strategy is adjusted based on the environmental state.

5. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 3, characterized in that: The specific steps of the environmental monitoring and task requirements analysis also include: Environmental parameters are defined, and CPU, memory, and disk status are obtained using operating system commands. Network monitoring tools are used to monitor network connectivity, and event-driven methods are used to update environmental parameters. Multiple environmental parameters are integrated to construct an environmental state vector E={cpu,memory,network}, where cpu, memory, and network represent CPU load, memory status, and network connectivity, respectively. After normalization, these parameters are mapped to a range of 0 to 1. A set of required capability labels and their importance weights are established for each task type. A weighted matching is performed between the required labels for the task and the current capability inventory, using the following formula: , Where m represents task m. This represents the ability matching degree, where i represents ability label i, and n represents the total number of ability labels. This indicates the importance of capability label i to task m. This indicates the quality score of capability label i in the capability inventory; The executable score is calculated by combining the task's capability matching degree and the environmental state vector, and corresponding thresholds are preset to execute or downgrade the task.

6. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps of the dynamic tool discovery module are as follows: The function declaration submitted when the task is initiated is mapped to the established set of capability tags, and a set of candidate capabilities is output. Through the environmental constraint filtering mechanism, the running requirements declared when each tool is registered are combined with the current system environment status to remove tools that do not meet the running conditions. A context-dependent tool fit pre-scoring mechanism is introduced. By analyzing the tool's processing records in historical tasks, the degree of task context label matching, and its basic fit in the current environment, a preliminary relevance score of the tool is calculated. The formula is as follows: , in This represents the initial relevance score of candidate tool k. Indicates context weight, Indicates historical performance weights. Indicates environment adaptation weight. Indicates the degree of context matching. Indicates historical success rate. Indicates environmental adaptability; Pre-set initial relevance score thresholds for different candidate tools; filter and remove candidate tools that are below the score threshold.

7. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps for the strategy engine to perform tool selection are as follows: For candidate tools that exceed the initial relevance score threshold, the overall relevance score is calculated by combining the cost value and delayed value of subsequent candidate tools, using the following formula: , in This represents the overall relevance score of candidate tool k. , , These represent the weights of the initial relevance score, cost value, and delayed value, respectively. This represents the cost value of candidate tool k. This indicates the delayed value of candidate tool k; Costs are considered from multiple dimensions and linearly weighted and synthesized. They are then normalized to a range of 0 to 1. The historical average latency of the tool is used as the original latency, and the min-max method is used for normalization to linearly scale all values ​​to the range of 0 to 1. Based on the overall relevance score, the candidate tools are sorted from highest to lowest, and the tool is selected for task execution according to the score.

8. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps of the system adaptive construction module are as follows: After selecting a tool, the agent adaptive system combines the current task type and context information to automatically generate the agent's current execution chain structure and construct the execution path configuration and task scheduling process under task-driven conditions. The intelligent agent adaptive system determines the data format and conversion logic required by the task based on the task type and the capability description of the selected tool. Then, based on the scheduling intent in the task context and the data registered by the selected tool, the intelligent agent adaptive system automatically fills in the parameters required for the selected tool. For the pre- and post-processing logic contained in the task, it retrieves components from the selected tool set, assembles them in the order of dependency to form a complete execution, selects the execution mode according to the current environment state, and reserves computing resources in advance for high-priority tasks.

9. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 1, characterized in that: The specific steps for performing the task and collecting feedback information are as follows: The selected tools are called according to the constructed execution chain to complete the task. After each task is completed, the execution results are recorded and collected, and a standardized feedback information structure is constructed. The execution status is calculated based on the feedback information and stored in the usage file of the tool used for subsequent data adjustment. The task execution score is calculated by combining three types of feedback data: output quality score, timeliness score, and historical success rate. The formula is as follows: , in This indicates the score for task execution. , , These represent the weights of quality, timeliness, and success rate, respectively. This indicates the output quality score. Indicates the timeliness score. This indicates the historical success rate.

10. The method for constructing a dynamic tool discovery and adaptive system for MCP agents according to claim 9, characterized in that: The specific steps for performing the task and collecting feedback information also include: Thresholds are set for output quality score, timeliness score, and historical success rate. Task execution scores are collected and standardized periodically. When there are feedback data that are lower than the preset threshold, a candidate parameter set is generated through online learning. Execution feedback data is collected in real time and labeled samples are constructed. A loss function is predefined and the parameters are optimized online using mini-batch gradient descent. Candidate parameters are output periodically and formed into a set. Gray-scale experiments are used to verify the impact on feedback data. Modification logs are recorded for backtracking and offline retraining to enable adaptive parameter optimization.

Citation Information

Patent Citations

  • Information processing method based on multi-agent system and multi-agent system

    CN118535688A

Cited By

  • Space-time task processing method and system and storage medium

    CN121349705A

  • Lightweight agent development method and system based on MCP protocol

    CN121833293A

  • Tool plan execution method and device, electronic equipment and storage medium

    CN122086574A

  • Heterogeneous software-oriented agent-callable tool construction method and storage medium

    CN122363691A