Task conversion method and device, electronic equipment, storage medium and product

By parsing the online documentation of the OpenAPI specification and converting the MCP protocol, an MCP proxy service is generated, which solves the problem of insufficient automated parsing and conversion capabilities in the integration of intelligent agents with remote tools, and realizes efficient, accurate and dynamic integration between intelligent agents and external services.

CN121664908APending Publication Date: 2026-03-13中移信息技术有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies lack the ability to automatically parse and convert OpenAPI specifications in the integration of remote tools for intelligent agents, resulting in low implementation efficiency, poor flexibility, high security risks, and difficulty in meeting the dynamic integration needs of massive external services.

Method used

By parsing the online documentation of the OpenAPI specification of the target service provider, extracting API metadata information, and converting it into target metadata that conforms to the MCP protocol based on a pre-defined MCP protocol conversion strategy, an MCP proxy service is generated to respond to the agent's MCP service call request, thus achieving compatibility between external services and the agent.

Benefits of technology

It significantly improves the efficiency and accuracy of intelligent agents in dynamically integrating massive amounts of external services, breaks through the limitations of traditional manual API configuration, and achieves intelligent compatibility between external services and intelligent agents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121664908A_ABST
    Figure CN121664908A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a task conversion method and device, electronic equipment, a storage medium and a product. The method comprises the following steps: analyzing an OpenAPI standard online document provided by a target service providing end, and extracting API metadata information from the OpenAPI standard online document; based on a preset MCP protocol conversion strategy, the API metadata information is converted into target metadata conforming to an MCP protocol, and an MCP proxy service is generated based on the target metadata and service URL information provided by a target service providing end; and in response to an MCP service calling request sent by the intelligent agent, obtaining MCP service information matched with the MCP service calling request from the target service providing end based on the MCP proxy service, and feeding back the MCP service information to the intelligent agent. According to the scheme, the compatibility of the external service and the intelligent agent is intelligently realized, and the efficiency and the accuracy of dynamic integration of the intelligent agent on massive external services are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence and API service integration technology, and in particular to a task conversion method, apparatus, electronic device, storage medium and product. Background Technology

[0002] Currently, intelligent agent remote tool integration technologies mainly rely on manual configuration of application programming interfaces (APIs) or service discovery mechanisms based on simple rules, lacking the ability to automatically parse and convert OpenAPI specifications. Traditional methods include: manual configuration of API documentation based on tools such as Swagger, service proxy conversion through hard coding, and service quality assessment relying on manual review. These methods suffer from low implementation efficiency, poor flexibility, and high security risks, making it difficult to meet the dynamic integration needs of intelligent agents for massive external services. Summary of the Invention

[0003] This application provides a task conversion method, apparatus, electronic device, storage medium, and product that intelligently realizes the compatibility between external services and intelligent agents, significantly improving the efficiency and accuracy of intelligent agents in dynamically integrating massive amounts of external services.

[0004] According to one aspect of this application, a task conversion method is provided, applied to an MCP gateway, the method comprising:

[0005] The online OpenAPI specification document provided by the target service provider is parsed, and API metadata information is extracted from the online OpenAPI specification document.

[0006] Based on a pre-defined MCP protocol conversion strategy, the API metadata information is converted into target metadata that conforms to the MCP protocol, and an MCP proxy service is generated based on the target metadata and the service URL information provided by the target service provider.

[0007] In response to the MCP service call request sent by the agent, based on the MCP proxy service, the agent obtains the MCP service information that matches the MCP service call request from the target service provider and feeds back the MCP service information to the agent.

[0008] According to one aspect of this application, a task switching device is provided, applied to an MCP gateway, the device comprising:

[0009] The API metadata information extraction module is used to parse the online OpenAPI specification document provided by the target service provider and extract API metadata information from the online OpenAPI specification document;

[0010] The MCP proxy service generation module is used to convert the API metadata information into target metadata that conforms to the MCP protocol based on a pre-set MCP protocol conversion strategy, and generate an MCP proxy service based on the target metadata and the service URL information provided by the target service provider.

[0011] The MCP service information acquisition module is used to respond to the MCP service call request sent by the agent, obtain the MCP service information matching the MCP service call request from the target service provider based on the MCP proxy service, and feed back the MCP service information to the agent.

[0012] According to another aspect of this application, an electronic device is provided, the electronic device comprising:

[0013] At least one processor; and

[0014] A memory that is communicatively connected to at least one processor; wherein,

[0015] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the task switching method of any embodiment of this application.

[0016] According to another aspect of this application, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the task switching method of any embodiment of this application.

[0017] According to another aspect of this application, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the task switching method of any embodiment of this application.

[0018] The technical solution of this application embodiment parses the online OpenAPI specification document provided by the target service provider and extracts API metadata information from the document. Based on a pre-set MCP protocol conversion strategy, the API metadata information is converted into target metadata conforming to the MCP protocol. Based on the target metadata and the service URL information provided by the target service provider, an MCP proxy service is generated. In response to an MCP service call request sent by the agent, based on the MCP proxy service, MCP service information matching the MCP service call request is obtained from the target service provider and fed back to the agent. The technical solution provided in this application embodiment uses OpenAPI specification parsing and automatic MCP protocol conversion technology to intelligently achieve compatibility between external services and the agent. This not only overcomes the limitations of traditional manual API configuration but also significantly improves the efficiency and accuracy of the agent's dynamic integration of massive amounts of external services.

[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 A flowchart illustrating a task conversion method provided in an embodiment of this application;

[0022] Figure 2 An interactive signaling diagram for task switching is provided in an embodiment of this application;

[0023] Figure 3 This is a schematic diagram of the structure of a task switching device provided in an embodiment of this application;

[0024] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," "third," "fourth," "actual," "preset," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] Figure 1 This flowchart illustrates a task conversion method provided in an embodiment of this application. This embodiment is applicable to tasks involving the conversion between external API services and tasks involving an agent invoking a Multi-Agent Communication Protocol (MCP) service. The method can be executed by a task conversion device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0028] S110. Parse the online OpenAPI specification document provided by the target service provider and extract API metadata information from the online OpenAPI specification document.

[0029] The target service provider is a qualified service provider; there can be one or more target service providers. After completing service development and testing, the target service provider uses a technology similar to Swagger to generate online documentation conforming to the OpenAPI specification (i.e., the OpenAPI specification online documentation) and provides it to the MCP gateway. The MCP gateway parses the OpenAPI specification online documentation based on the OpenAPI specification and extracts API metadata information from it. This API metadata information includes key API metadata such as API interface path, API operation method, API request parameters, API request body, API response model, and API status codes.

[0030] S120. Based on the pre-set MCP protocol conversion strategy, the API metadata information is converted into target metadata that conforms to the MCP protocol, and an MCP proxy service is generated based on the target metadata and the service URL information provided by the target service provider.

[0031] In this embodiment, the MCP gateway converts the API metadata information provided by the target service provider into target metadata that conforms to the MCP protocol, according to the requirements of the MCP protocol and a pre-set MCP protocol conversion strategy. The target metadata can also be referred to as MCP metadata. Based on the target metadata and the Uniform Resource Identifier (URL) information provided by the target service provider, the MCP gateway generates an MCP proxy service. Optionally, the API metadata information includes API interface path, API operation method, API request parameters, API response model, and API status code. Based on a pre-defined MCP protocol conversion strategy, the API metadata information is converted into target metadata conforming to the MCP protocol, including: converting the API interface path into MCP service identification information by performing a hash operation on the API interface path; converting the API operation method into an MCP operation type method based on a predefined mapping table; mapping the API status code into an MCP standard error code, and converting the API request parameters and the API response model into MCP parameters and MCP models in the input / output format defined by the MCP gateway, respectively; and using the MCP service identification information, the MCP operation type method, the MCP standard error code, the MCP parameters, and the MCP model as target metadata.

[0032] In this embodiment, the API interface path, also known as the REST path, can be hashed (e.g., using MD5) and the hash result used as the MCP service identifier information corresponding to the REST path. The API operation method, also known as the HTTP method, can be converted to an MCP operation type method (e.g., GET corresponds to query, POST corresponds to execution) based on a pre-defined conversion mapping table. The API status code in the API metadata information is an HTTP status code, but it can also be converted to an MCP standard error code based on the HTTP-MCP status code mapping relationship. API request parameters and API response models are converted to MCP parameters and MCP models in the input / output format defined by the MCP gateway, respectively. The MCP service identifier information, MCP operation type method, MCP standard error code, MCP parameters, and MCP model are used as target metadata, which can also be called MCP metadata.

[0033] Based on the transformed target metadata and the actual service URL information provided by the target service provider, the automatic code generation component dynamically generates an executable MCP proxy service using code template technology. This MCP proxy service can receive MCP call requests from the agent and complete protocol conversion and request forwarding. In this embodiment, the generated MCP proxy service can be built as a deployable component (i.e., an MCP proxy service component) and registered in the service repository of the MCP gateway to complete service deployment. These steps achieve automated construction from an OpenAPI description to a runnable MCP proxy service.

[0034] S130. In response to the MCP service call request sent by the agent, based on the MCP proxy service, obtain the MCP service information matching the MCP service call request from the target service provider, and feed back the MCP service information to the agent.

[0035] In this embodiment, when an MCP service call request sent by an agent is detected, the MCP gateway obtains MCP service information matching the MCP service call request from the target service provider based on the MCP proxy service. The MCP service information can be understood as service information conforming to the MCP protocol, and the gateway feeds the MCP service information back to the agent. Optionally, obtaining the MCP service information matching the MCP service call request from the target service provider based on the MCP proxy service includes: converting the MCP service call request into an API call request based on the MCP proxy service, and obtaining API service information matching the API call request from the target service provider; and converting the API service information into MCP service information in MCP protocol format based on the MCP proxy service.

[0036] Since the MCP service call request sent by the intelligent agent is a service call request in MCP protocol format, the MCP gateway converts the MCP service call request into an API call request through the MCP proxy service and sends the API call request to the target service provider. The target service provider determines the API service request that matches the API call request and sends the API service request back to the MCP gateway. The MCP gateway receives the API service information fed back by the target service provider and converts the API service information into MCP service information in MCP protocol format based on the MCP proxy service.

[0037] The technical solution of this application embodiment parses the online OpenAPI specification document provided by the target service provider and extracts API metadata information from the document. Based on a pre-set MCP protocol conversion strategy, the API metadata information is converted into target metadata conforming to the MCP protocol. Based on the target metadata and the service URL information provided by the target service provider, an MCP proxy service is generated. In response to an MCP service call request sent by the agent, based on the MCP proxy service, MCP service information matching the MCP service call request is obtained from the target service provider and fed back to the agent. The technical solution provided in this application embodiment uses OpenAPI specification parsing and automatic MCP protocol conversion technology to intelligently achieve compatibility between external services and the agent. This not only overcomes the limitations of traditional manual API configuration but also significantly improves the efficiency and accuracy of the agent's dynamic integration of massive amounts of external services.

[0038] In some embodiments, before parsing the online OpenAPI specification document provided by the target service provider, the method further includes: in response to a service qualification application request sent by at least one service provider, determining a corresponding service qualification security score based on each service qualification application request sent by the service provider; and filtering a target service provider from among the service providers based on the service qualification security score; wherein the target service provider is a service provider whose service qualification security score is higher than a preset score threshold.

[0039] For example, after each service provider completes service development and testing and generates the corresponding online OpenAPI specification documentation, it sends a service qualification application request to the MCP gateway. This request includes retrieval of service authentication information (which can also be understood as qualification description information) and service assurance information. The service authentication information may include the service URL and the username and password, while the service assurance information is the operational information used to ensure the normal operation of the backend service. The MCP gateway comprehensively analyzes the retrieval of service authentication information and the service assurance information in the service qualification application request to determine the service qualification security score corresponding to the service provider. It then selects the target service provider with the highest service qualification security score from among all service providers.

[0040] Optionally, based on the service qualification application request sent by each of the service providers, a corresponding service qualification security score is determined, including: for each service qualification application request sent by the service provider, extracting and retrieving service authentication information and service assurance information from the service qualification application request; based on the retrieved service authentication information, retrieving service information provided by the service proxy and determining service response information; detecting the service integrity of the service information based on the OpenAPI specification; and determining the service qualification security score corresponding to the service provider based on the retrieved service authentication information, the service assurance information, the service response information, and the service integrity.

[0041] In this embodiment, the MCP gateway extracts service authentication information and service assurance information from each service qualification application request sent by a service proxy, and retrieves service information provided by the service proxy based on the service authentication information. For example, web crawling technology can be used to retrieve service information provided by the service proxy based on the service authentication information. The service information may include an interface list, interface parameters, and interface descriptions. During the service information retrieval process, service response information is determined, including the start time of the connection to the retrieval URL service, the start time of the request service, the start time of the service return, and the completion time of the service return. The MCP gateway parses the service information based on the OpenAPI specification and determines the service integrity of the service information based on the parsing results. A comprehensive analysis of the retrieved service authentication information, service assurance information, service response information, and service integrity is performed to determine the service qualification security score corresponding to the service provider. For example, based on a pre-set security scoring strategy, the retrieval service score corresponding to the retrieval service authentication information, the service assurance score corresponding to the service assurance information, the service response score corresponding to the service response information, and the service integrity score corresponding to the service integrity are determined, and the weights corresponding to the retrieval service score, service assurance score, service response score, and service integrity score are determined respectively. The weights for the search service score, service assurance score, service response score, and service integrity score can be pre-set manually. The weighted sum of the search service score, service assurance score, service response score, and service integrity score with their corresponding weights is used as the service qualification and security score for the service provider.

[0042] Optionally, based on the retrieval service authentication information, the service assurance information, the service response information, and the service integrity, determining the service qualification security score corresponding to the service provider includes: inputting the service assurance information, the service response information, and the service integrity into a pre-trained service quality detection model to obtain the service quality score output by the service quality detection model, and generating a service prediction report based on the service quality score, the service assurance information, the service response information, and the service integrity; inputting the retrieval service authentication information, the service assurance information, the service integrity, and the service prediction report into a pre-trained service qualification security prediction model to obtain the service qualification security score output by the service qualification security prediction model.

[0043] In this embodiment, a pre-trained service quality detection model is obtained. This model is a machine learning model capable of accurately and quickly determining service quality scores. The service quality detection model may include an ALBer layer, a fully connected layer, and an output layer. The training process of the service quality detection model may include the following steps: First, a service data training set is obtained. This training set consists of service data samples accumulated by users historically, including "service integrity, service assurance information, and service response information," along with corresponding quality scores. Professional personnel can revise, label, and review the data in the service data training set to ensure its correctness and reliability. The ALBer layer performs deep feature extraction on each piece of training data in the input service data training set. Through a pre-trained language model, it transforms unstructured service description information into high-dimensional feature vectors. Simultaneously, it parses key information such as service integrity, service assurance information, and service response information in the training data, forming machine-recognizable numerical features. The ALBer layer significantly improves the model's semantic understanding of service quality, laying the foundation for subsequent analysis. After feature extraction, the fully connected layer integrates and learns the high-dimensional features output by the ALBer layer. This layer utilizes a multi-layered neural network structure to uncover the complex correlations between service information, integrity, service assurance information, and the final quality score. During training, the model automatically optimizes the weight allocation of each feature, ensuring that key factors dominate the prediction results while filtering out low-relevance noise data. The output layer transforms the feature correlations learned by the fully connected layer into specific service quality scores (e.g., 0-100). This layer typically uses a linear activation function to directly output the predicted score and can be supplemented with a confidence assessment. After generating the service quality detection model, its prediction results can be verified by professionals to ensure consistency with actual human ratings, ensuring that indicators such as mean absolute error meet business requirements. If standards are not met, the model parameters can be adjusted or training data supplemented until the predictive reliability of the service quality detection model passes review.

[0044] The service qualification security prediction model can also include an ALBer layer, a fully connected layer, and an output layer. The training process of the service qualification security prediction model can include the following steps: First, obtain a service qualification data training set. This training set consists of service qualification data samples accumulated by users historically, including "application qualification information, service integrity, service guarantee information, and service prediction reports," along with corresponding service qualification scores. Professional personnel can revise, annotate, and review the data in the training set to ensure its accuracy and reliability. The ALBer layer uses a pre-trained language model to perform deep feature extraction on the unstructured or semi-structured data in the input service qualification data training set. For example, it parses the text descriptions in the application qualification information and the risk descriptions in the service prediction reports, transforming them into high-dimensional numerical features. Simultaneously, structured data is standardized to form a unified feature vector. The ALBer layer significantly improves the model's semantic understanding of complex qualification security issues. The fully connected layer receives the features extracted by the ALBer layer and analyzes the complex relationships between various data types and their corresponding service qualification scores using a deep neural network. This layer automatically optimizes feature weights through multiple rounds of training, ensuring that key factors have a dominant influence on the prediction results while filtering out irrelevant noise, enabling the model to have accurate predictive capabilities. The output layer transforms the analysis results of the fully connected layer into specific service qualification scores (e.g., 0-100 points) and provides prediction confidence. After generating the service qualification security prediction model, it can be rigorously validated by professionals to compare its prediction results with human scores. If it fails to meet the standards, the model parameters of the service qualification security prediction model need to be further adjusted or supplemented with training data until the prediction reliability passes the review.

[0045] Service assurance information, service response information, and service integrity are input into a trained service quality detection model to obtain a service quality score output by the model. Optionally, service information, service assurance information, service response information, and service integrity can also be input together into the trained service quality detection model to obtain a service quality score output by the model. A service prediction report is generated based on the service quality score, service assurance information, service response information, and service integrity. Then, the retrieved service authentication information, service assurance information, service integrity, and service prediction report are input into a pre-trained service qualification and security prediction model to obtain a service qualification and security score output by the model.

[0046] For example, Figure 2 An interactive signaling diagram for task switching provided in an embodiment of this application, such as Figure 2 As shown, the task conversion method includes the following interactive steps:

[0047] S1. The service provider sends a service qualification application request to the MCP gateway.

[0048] The S2 and MCP gateways retrieve service information based on the service authentication information in the service qualification application request, determine the service response information, and feed back the service response information to the service provider.

[0049] The S3 and MCP gateways detect the service integrity of service information and generate a service prediction report based on the service guarantee information, service response information, and service integrity in the service qualification application request.

[0050] The S4 and MCP gateways determine the service qualification security score based on the retrieved service authentication information, service assurance information, service integrity, and service prediction reports.

[0051] The S5 and MCP gateways determine whether the service provider is qualified to provide services based on the service qualification security score.

[0052] S6. When the MCP gateway determines that the service provider is qualified to provide services, it extracts API metadata information from the online OpenAPI specification document provided by the service provider and generates MCP proxy services based on the API metadata information.

[0053] S7. The agent sends an MCP service call request to the MCP gateway.

[0054] S8 and the MCP gateway convert MCP service call requests into API call requests.

[0055] The S9 and MCP gateways send API call requests to the service provider.

[0056] S10. The service provider determines the API service information based on the API call request received from the MCP gateway and feeds back the API service information to the MCP gateway.

[0057] S11. The MCP gateway converts API service information into MCP service information in MCP protocol format based on the MCP proxy service.

[0058] S12, the MCP gateway feeds back MCP service information to the intelligent agent.

[0059] The task conversion method provided in this application first constructs an online OpenAPI specification document using the OpenAPI specification, and dynamically obtains API resources (i.e., service information) provided by service providers using web crawling technology. Based on this, the MCP gateway performs a quality assessment of the API resources using a service quality detection model, generating a service prediction report. Subsequently, a service qualification and security prediction model is used, combined with retrieved service authentication information, service assurance information, service response information, and service integrity, to complete an automated approval decision. For approved service providers, the API metadata information in the online OpenAPI specification document is automatically converted into an MCP proxy service through a protocol conversion engine and registered with the MCP gateway. Finally, the MCP discovery protocol provides the agent with callable service information. The entire process achieves seamless integration from API retrieval to service invocation through multi-model collaboration and automation, significantly improving flexibility, security, and implementation efficiency compared to traditional manual configuration methods.

[0060] Figure 3 This is a schematic diagram of a task conversion device provided in an embodiment of this application. The device is applied to an MCP gateway and can execute the task conversion method provided in any embodiment of this application, possessing the corresponding functional modules and beneficial effects of the method execution. Figure 3 As shown, the device includes:

[0061] API metadata information extraction module 310 is used to parse the OpenAPI specification online document provided by the target service provider and extract API metadata information from the OpenAPI specification online document;

[0062] The MCP proxy service generation module 320 is used to convert the API metadata information into target metadata that conforms to the MCP protocol based on a pre-set MCP protocol conversion strategy, and generate an MCP proxy service based on the target metadata and the service URL information provided by the target service provider.

[0063] The MCP service information acquisition module 330 is used to respond to the MCP service call request sent by the agent, obtain the MCP service information matching the MCP service call request from the target service provider based on the MCP proxy service, and feed back the MCP service information to the agent.

[0064] Optional, also includes:

[0065] The service qualification security score determination module is used to determine the corresponding service qualification security score based on the service qualification application request sent by at least one service provider before parsing the online document of the OpenAPI specification provided by the target service provider.

[0066] The target service provider filtering module is used to filter target service providers from among the various service providers based on the service qualification security score; wherein, the target service provider is the service provider whose service qualification security score is higher than a preset score threshold.

[0067] Optional, the service qualification security score determination module includes:

[0068] The authentication information extraction unit is used to extract and retrieve service authentication information and service assurance information from each service qualification application request sent by the service provider.

[0069] The service information retrieval unit is used to retrieve service information provided by the service agent based on the retrieval service authentication information, and determine service response information;

[0070] The service integrity detection unit is used to detect the service integrity of the service information based on the OpenAPI specification.

[0071] The service qualification security score determination unit is used to determine the service qualification security score corresponding to the service provider based on the retrieved service authentication information, the service guarantee information, the service response information, and the service integrity.

[0072] Optional, a service qualification security scoring unit is used for:

[0073] The service assurance information, the service response information, and the service integrity are input into a pre-trained service quality detection model to obtain a service quality score output by the service quality detection model, and a service prediction report is generated based on the service quality score, the service assurance information, the service response information, and the service integrity.

[0074] The service authentication information, service assurance information, service integrity, and service prediction report are input into a pre-trained service qualification security prediction model to obtain the service qualification security score output by the service qualification security prediction model.

[0075] Optionally, the API metadata information includes the API interface path, API operation method, API request parameters, API response model, and API status code;

[0076] The MCP agent service generation module is used for:

[0077] The API interface path is hashed and converted into MCP service identifier information.

[0078] The API operation method is converted into an MCP operation type method based on a predefined mapping table;

[0079] The API status code is mapped to the MCP standard error code, and the API request parameters and the API response model are respectively converted into MCP parameters and MCP models in the input / output format defined by the MCP gateway.

[0080] The MCP service identification information, the MCP operation type method, the MCP standard error code, the MCP parameters, and the MCP model are used as target metadata.

[0081] Optionally, the MCP service information acquisition module is used to acquire, based on the MCP proxy service, MCP service information matching the MCP service call request from the target service provider, including:

[0082] Based on the MCP proxy service, the MCP service call request is converted into an API call request, and API service information matching the API call request is obtained from the target service provider.

[0083] Based on the MCP proxy service, the API service information is converted into MCP service information in MCP protocol format.

[0084] The task conversion device provided in this application embodiment can execute a task conversion method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method.

[0085] Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of this application, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0086] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0087] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0088] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as task switching methods.

[0089] In some embodiments, the task switching method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the task switching method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the task switching method by any other suitable means (e.g., by means of firmware).

[0090] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0091] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable task switching device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0092] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0093] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0094] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0095] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0096] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the task switching method provided in any embodiment of this application.

[0097] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0098] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired information of the technical solution of this application can be achieved, and this is not limited herein.

[0099] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A task switching method, characterized in that, Applied to an MCP gateway, the method includes: The online OpenAPI specification document provided by the target service provider is parsed, and API metadata information is extracted from the online OpenAPI specification document. Based on a pre-defined MCP protocol conversion strategy, the API metadata information is converted into target metadata that conforms to the MCP protocol, and an MCP proxy service is generated based on the target metadata and the service URL information provided by the target service provider. In response to the MCP service call request sent by the agent, based on the MCP proxy service, the agent obtains the MCP service information that matches the MCP service call request from the target service provider and feeds back the MCP service information to the agent.

2. The method according to claim 1, characterized in that, Before parsing the online OpenAPI specification documentation provided by the target service provider, the following steps are also included: In response to a service qualification application request sent by at least one service provider, a corresponding service qualification security score is determined based on each service qualification application request sent by the service provider. Based on the service qualification security score, a target service provider is selected from all the service providers; wherein, the target service provider is the service provider whose service qualification security score is higher than a preset score threshold.

3. The method according to claim 2, characterized in that, Based on the service qualification application request sent by each of the service providers, a corresponding service qualification security score is determined, including: For each service qualification application request sent by the service provider, retrieve service authentication information and service guarantee information from the service qualification application request. Based on the retrieval service authentication information, retrieve the service information provided by the service proxy and determine the service response information; The service integrity of the service information is detected based on the OpenAPI specification. Based on the retrieval service authentication information, the service guarantee information, the service response information, and the service integrity, the service qualification security score corresponding to the service provider is determined.

4. The method according to claim 3, characterized in that, Based on the retrieval service authentication information, the service assurance information, the service response information, and the service integrity, a service qualification security score is determined for the service provider, including: The service assurance information, the service response information, and the service integrity are input into a pre-trained service quality detection model to obtain a service quality score output by the service quality detection model, and a service prediction report is generated based on the service quality score, the service assurance information, the service response information, and the service integrity. The service authentication information, service assurance information, service integrity, and service prediction report are input into a pre-trained service qualification security prediction model to obtain the service qualification security score output by the service qualification security prediction model.

5. The method according to claim 1, characterized in that, The API metadata information includes the API interface path, API operation method, API request parameters, API response model, and API status code. Based on a pre-defined MCP protocol conversion strategy, the API metadata information is converted into target metadata that conforms to the MCP protocol, including: The API interface path is hashed and converted into MCP service identifier information. The API operation method is converted into an MCP operation type method based on a predefined mapping table; The API status code is mapped to the MCP standard error code, and the API request parameters and the API response model are respectively converted into MCP parameters and MCP models in the input / output format defined by the MCP gateway. The MCP service identification information, the MCP operation type method, the MCP standard error code, the MCP parameters, and the MCP model are used as target metadata.

6. The method according to claim 1, characterized in that, Based on the MCP proxy service, obtain MCP service information matching the MCP service call request from the target service provider, including: Based on the MCP proxy service, the MCP service call request is converted into an API call request, and API service information matching the API call request is obtained from the target service provider. Based on the MCP proxy service, the API service information is converted into MCP service information in MCP protocol format.

7. A task switching device, characterized in that, The device, applied to an MCP gateway, includes: The API metadata information extraction module is used to parse the online OpenAPI specification document provided by the target service provider and extract API metadata information from the online OpenAPI specification document; The MCP proxy service generation module is used to convert the API metadata information into target metadata that conforms to the MCP protocol based on a pre-set MCP protocol conversion strategy, and generate an MCP proxy service based on the target metadata and the service URL information provided by the target service provider. The MCP service information acquisition module is used to respond to the MCP service call request sent by the agent, obtain the MCP service information matching the MCP service call request from the target service provider based on the MCP proxy service, and feed back the MCP service information to the agent.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the task switching method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the task switching method according to any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the task conversion method according to any one of claims 1-6.