A large language model mass MCP tool calling system and method based on an AI image processing platform
By optimizing the MCP tool calls through vector database and tool retrieval and execution modules, the problems of context explosion and low resource utilization in large language models are solved, thereby improving retrieval efficiency and system stability.
Patent Information
- Application Number
- CN202610901024.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-11-10
AI Technical Summary
Existing AI image processing platforms suffer from issues such as context explosion, low retrieval efficiency, low resource utilization, and system response delays when large language models call MCP tools.
By employing a vector database and independent tool retrieval and execution modules, the MCP tool invocation process is optimized through vector encoding and similarity retrieval, reducing the context occupation of large language models and improving retrieval efficiency and resource utilization.
It achieves constant context usage, improves retrieval efficiency and resource utilization, and reduces system latency and the probability of errors.
Smart Images

Figure CN123068463A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and in particular, to a system and method for calling a large number of MCP tools for large language models based on an AI image processing platform. Background Technology
[0002] As AI image processing platforms continue to develop, the number of integrated MCP (Model Context Protocol) tools has increased dramatically, typically reaching hundreds or even thousands. See also Figure 1 The figure illustrates an existing method for invoking massive MCP tools using a large language model based on an AI image processing platform. This method involves loading the descriptions of all MCP tools from the large language model and retrieving the desired MCP tool based on the user's request and the descriptions of all available MCP tools. The drawbacks of this method are at least: 1. Context explosion problem: Each MCP tool's description occupies 500-1000 tokens. Assuming there are 1000 MCP tools, this would require 500,000-1,000,000 tokens, far exceeding the context limitations of most large language models; 2. Poor retrieval efficiency: A linear search is required within the descriptions of all MCP tools; 3. Low resource utilization: At least 90% of the MCP tools are not used in a single session; 4. System response latency: Processing extremely long contexts significantly increases model inference time. Summary of the Invention
[0003] The technical problem to be solved by this invention is the context explosion problem in existing AI image processing platforms when large language models call MCP tools. This invention provides a system and method for calling massive MCP tools for large language models based on an AI image processing platform.
[0004] To address the aforementioned technical problems, the technical solution of this invention is as follows: A large-scale language model massive MCP tool invocation system based on an AI image processing platform, comprising: a vector database configured to: vector-encode and store description information of each MCP tool stored in the MCP tool repository; a tool retrieval module configured to: perform vector similarity retrieval in the vector database according to the tool retrieval request of the large language model and return the retrieval result to the large language model, wherein the tool retrieval request of the large language model is determined based on a user request; and a tool execution module configured to: dynamically execute the corresponding MCP tool in the MCP tool repository according to the tool execution request of the large language model and return the execution result to the large language model, wherein the tool execution request of the large language model is determined based on the retrieval result of the tool retrieval module; wherein the vector database, the tool retrieval module, and the tool execution module are all independent of the large language model. The beneficial effects are at least as follows: 1. Simplified context occupancy: The tool retrieval module completes the tool retrieval task, and the tool execution module completes the tool execution task. That is, the large language model only needs to process the tool retrieval request (query) and the tool execution request (call), without processing the description information of each MCP tool. In other words, regardless of the number of MCP tools stored in the MCP tool repository, the context occupancy of the large language model remains constant; 2. Improved retrieval efficiency: The complexity of vector similarity retrieval is O(log N), which is far better than the O(N) of linear search. Furthermore, vector similarity retrieval supports semantic-level fuzzy matching, improving the accuracy of tool discovery; 3. Optimized resource utilization: The large language model is loaded on demand, avoiding useless context occupancy, reducing model inference time and computational resource consumption, and reducing system memory and bandwidth requirements; 4. System stability and reliability: Reduces the illusions and errors caused by excessively long context in the large language model.
[0005] As a preferred solution for a large-scale language model-based massive MCP tool invocation system using an AI image processing platform, the vector database includes: an information extraction module, a vector encoding module, and a vector storage module. The information extraction module is configured to extract description information of each MCP tool stored in the MCP tool repository. The vector encoding module is configured to perform vector encoding on the description information of each MCP tool extracted by the information extraction module. The vector storage module is configured to store the vector-encoded description information of each MCP tool encoded by the vector encoding module. The beneficial effect is at least that it provides a specific solution for the vector database.
[0006] As a preferred solution for a large-scale language model-based MCP tool invocation system using an AI image processing platform, the vector encoding module is further configured to: use a pre-trained language model to convert the extracted descriptive information of each MCP tool into a high-dimensional vector representation. The beneficial effect is at least that it provides a specific scheme for the vector encoding module.
[0007] As a preferred solution for a large-scale language model-based massive MCP tool retrieval system using an AI image processing platform, the tool retrieval module is further configured to: if the tool query request of the large language model is a query string based on natural language, then the tool query request of the large language model is vector-encoded, and then vector similarity retrieval is performed in the vector database based on the tool retrieval request of the large language model. The beneficial effect is at least that: the vector encoding of the tool query request of the large language model is completed by the tool retrieval module, reducing the processing burden of the large language model.
[0008] As a preferred solution for a large-scale language model-based MCP tool invocation system using an AI image processing platform, the MCP tool repository is configured to support linear expansion of the number of tools; the vector database is further configured to vector-encode and store the description information of the expanded MCP tools after the number of tools has expanded linearly. The beneficial effect is at least that it supports linear expansion of the number of tools.
[0009] As a preferred solution for a large-scale language model-based MCP tool invocation system using an AI image processing platform, the MCP tool repository is configured to support hot tool updates and version management. The vector database is further configured to, after hot tool updates and version management, vectorize and store the description information of the hot-updated and version-managed MCP tools. The beneficial effect is at least that it supports hot tool updates and version management.
[0010] Another technical solution of the present invention: a method for calling a large-scale MCP tool system based on an AI image processing platform, comprising: the tool retrieval module performing a vector similarity search in the vector database according to the tool retrieval request of the large-scale language model and returning the search results to the large-scale language model, wherein the tool retrieval request of the large-scale language model is determined based on a user request; and the tool execution module dynamically executing the corresponding MCP tool in the MCP tool repository according to the tool execution request of the large-scale language model and returning the execution result to the large-scale language model, wherein the tool execution request of the large-scale language model is determined based on the search results of the tool retrieval module. The beneficial effects are at least as follows: 1. Simplified context occupancy: The tool retrieval module completes the tool retrieval task, and the tool execution module completes the tool execution task. That is, the large language model only needs to process the tool retrieval request (query) and the tool execution request (call), without processing the description information of each MCP tool. In other words, regardless of the number of MCP tools stored in the MCP tool repository, the context occupancy of the large language model remains constant; 2. Improved retrieval efficiency: The complexity of vector similarity retrieval is O(log N), which is far better than the O(N) of linear search. Furthermore, vector similarity retrieval supports semantic-level fuzzy matching, improving the accuracy of tool discovery; 3. Optimized resource utilization: The large language model is loaded on demand, avoiding useless context occupancy, reducing model inference time and computational resource consumption, and reducing system memory and bandwidth requirements; 4. System stability and reliability: Reduces the illusions and errors caused by excessively long context in the large language model.
[0011] In addition to the technical problems solved by the present invention, the technical features constituting the technical solutions, and the beneficial effects brought about by the technical features of these technical solutions as described above, other technical problems that the present invention can solve, other technical features contained in the technical solutions, and the beneficial effects brought about by these technical features will be further described in detail with reference to the accompanying drawings. Attached Figure Description
[0012] Figure 1 This is a flowchart of the calling method for large-scale language models and massive MCP tools based on existing AI image processing platforms.
[0013] Figure 2 This is an architecture diagram of the existing large-scale language model massive MCP tool calling system based on an AI image processing platform.
[0014] Figure 3 This is a flowchart of the existing method for calling a large-scale language model and massive MCP tool based on an AI image processing platform. Detailed Implementation
[0015] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. It should be noted that these descriptions of embodiments are intended to aid in understanding the invention and do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0016] See Figure 2 The figure illustrates a large-scale language model-based massive MCP tool invocation system based on an AI image processing platform. This system includes an MCP tool repository, a vector database, a large language model, and pre-processor tools. The pre-processor tools include a tool retrieval module and a tool execution module. Furthermore, the vector database, the tool retrieval module, and the tool execution module are all independent of the large language model.
[0017] The MCP tool repository is configured to store each of the MCP tools (Tool 1: Image Recognition, Tool 2: Image Enhancement, ..., Tool N: Image Generation). In a specific implementation, the description information of each MCP tool occupies 500-1000 tokens. In other embodiments, the description information of each MCP tool occupies more or fewer tokens. In a specific implementation, the number of MCP tools is 1000. In other embodiments, the number of MCP tools is more or fewer.
[0018] The vector database is configured to: vector-encode and store the description information of each MCP tool stored in the MCP tool repository. During the initialization of the AI image processing platform, the vector database performs batch vector encoding on the description information of each MCP tool and stores it.
[0019] The vector database includes an information extraction module, a vector encoding module, and a vector storage module. The information extraction module is configured to extract description information from each MCP tool stored in the MCP tool repository. Specifically, the description information of each MCP tool includes: tool name, tool function, input parameter schema, and output format schema. The vector encoding module is configured to perform vector encoding on the description information of each MCP tool extracted by the information extraction module. Specifically, a pre-trained language model, such as Bidirectional Encoder Representations from Transformers or Sentence Transformers, is used to convert the extracted description information of each MCP tool into a high-dimensional vector representation. The vector storage module is configured to store the vector-encoded description information of each MCP tool by the vector encoding module.
[0020] The large language model is configured to: determine a tool retrieval request (query) to be sent to the tool retrieval module based on a user request; and determine a tool execution request (call) to be sent to the tool execution module based on the retrieval results of the tool retrieval module. Compared to the prior art, the large language model only needs to process the tool retrieval request (query) and the tool execution request (call), without processing the description information of each MCP tool. That is, regardless of the increase in the number of MCP tools, the context usage of the large language model remains constant. Testing shows that the context usage of the large language model is only 1-2 thousand tokens (compared to 500,000-1,000,000 tokens in the prior art).
[0021] The tool retrieval module is configured to perform vector similarity retrieval in the vector database based on the tool retrieval request (query) of the large language model and return the retrieval results to the large language model. The complexity of the vector similarity retrieval is O(log N), which is far superior to the O(N) of linear search in the background technology. Tests have shown that the vector similarity retrieval can improve retrieval efficiency by 10-100 times. In specific implementation, the tool query request of the large language model is a query string based on natural language. The tool retrieval module is further configured to perform vector encoding on the tool query request of the large language model, and then perform vector similarity retrieval in the vector database based on the tool retrieval request of the large language model.
[0022] The tool execution module is configured to dynamically load the corresponding MCP tool in the MCP tool repository according to the tool execution request (call) of the large language model and return the execution result to the large language model.
[0023] In practice, the vector database and the front-end agent tool are connected via API. The front-end agent tool and the large language model are connected via the MCP protocol.
[0024] In specific implementation, the MCP tool repository is configured to support linear expansion of the number of tools. Correspondingly, the vector database is further configured to vector-encode and store the description information of the expanded MCP tools after the number of tools expands linearly. During this process, the AI image processing platform does not need to be restarted.
[0025] In specific implementation, the MCP tool repository is configured to support hot updates and version management of tools. Correspondingly, the vector database is further configured to: after hot updates and version management, encode and store the description information of the hot-updated and version-managed MCP tools. During this process, the AI image processing platform does not need to be restarted.
[0026] See Figure 3 The figure illustrates a method for invoking a large-scale language model-based massive MCP tool system using an AI image processing platform. The method for invoking the large-scale language model-based massive MCP tool system includes: The tool retrieval module performs a vector similarity search in the vector database based on the tool retrieval request (query) of the large language model and returns the search results to the large language model. The tool retrieval request of the large language model is determined based on a user request; and... The tool execution module dynamically executes the corresponding MCP tool in the MCP tool repository based on the tool execution request (call) of the large language model and returns the execution result to the large language model. The tool execution request (call) of the large language model is determined based on the search results of the tool retrieval module.
[0027] The large-scale language model massive MCP tool calling system and method has at least the following beneficial effects: 1. Simplified context occupancy: The tool retrieval module completes the tool retrieval task, and the tool execution module completes the tool execution task. That is, the large-scale language model only needs to process the tool retrieval request (query) and the tool execution request (call), without processing the description information of each MCP tool. In other words, regardless of the number of MCP tools stored in the MCP tool repository, the context occupancy of the large-scale language model remains constant; 2. Improved retrieval efficiency: The complexity of vector similarity retrieval is O(log N), which is far better than the O(N) of linear search. Furthermore, vector similarity retrieval supports semantic-level fuzzy matching, improving the accuracy of tool discovery; 3. Optimized resource utilization: The large-scale language model is loaded on demand, avoiding useless context occupancy, reducing model inference time and computational resource consumption, and reducing system memory and bandwidth requirements; 4. System stability and reliability: Reduces the illusions and errors caused by excessively long context in the large-scale language model.
[0028] The above description merely illustrates embodiments of the present invention and is quite specific and detailed; however, it should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.
Claims
1. A large-scale language model-based massive MCP tool invocation system based on an AI image processing platform, characterized in that, include: A vector database, configured to: vector-encode and store description information of each MCP tool stored in the MCP tool repository; A tool retrieval module is configured to: perform a vector similarity search in the vector database based on the tool retrieval request of the large language model and return the search results to the large language model, wherein the tool retrieval request of the large language model is determined based on a user request; and... The tool execution module is configured to: dynamically execute the corresponding MCP tool in the MCP tool repository according to the tool execution request of the large language model and return the execution result to the large language model, wherein the tool execution request of the large language model is determined based on the retrieval result of the tool retrieval module; The vector database, the tool retrieval module, and the tool execution module are all independent of the large language model.
2. The large-scale language model massive MCP tool calling system based on an AI image processing platform according to claim 1, characterized in that, The vector database includes: an information extraction module, a vector encoding module, and a vector storage module; the information extraction module is configured to: extract information from the description information of each MCP tool stored in the MCP tool repository; the vector encoding module is configured to: perform vector encoding on the description information of each MCP tool extracted by the information extraction module; and the vector storage module is configured to: store the vector-encoded description information of each MCP tool in the vector encoding module.
3. The large-scale language model massive MCP tool calling system based on an AI image processing platform according to claim 2, characterized in that, The vector encoding module is further configured to convert the extracted descriptive information of each MCP tool into a high-dimensional vector representation using a pre-trained language model.
4. The large-scale language model massive MCP tool calling system based on an AI image processing platform according to claim 1, characterized in that, The tool retrieval module is further configured to: if the tool query request of the large language model is a query string based on natural language, then the tool query request of the large language model is vector-encoded, and then vector similarity retrieval is performed in the vector database according to the tool retrieval request of the large language model.
5. The large-scale language model massive MCP tool calling system based on an AI image processing platform according to claim 1, characterized in that, The MCP tool repository is configured to support linear expansion of the number of tools; the vector database is further configured to vector-encode and store the description information of the expanded MCP tools after the number of tools has expanded linearly.
6. The large-scale language model massive MCP tool calling system based on an AI image processing platform according to claim 1, characterized in that, The MCP tool repository is configured to support tool hot updates and version management; the vector database is further configured to: after tool hot updates and version management, to vector-encode and store the description information of the MCP tools that are hot-updated and version-managed.
7. A method for calling a large-scale language model massive MCP tool based on an AI image processing platform, as described in any one of claims 1 to 6, characterized in that, include: The tool retrieval module performs a vector similarity search in the vector database based on the tool retrieval request of the large language model and returns the search results to the large language model, wherein the tool retrieval request of the large language model is determined based on a user request; and, The tool execution module dynamically executes the corresponding MCP tool in the MCP tool repository according to the tool execution request of the large language model and returns the execution result to the large language model. The tool execution request of the large language model is determined based on the retrieval result of the tool retrieval module.
