Interaction agent method, apparatus and device for editor extension and storage medium

By using an event delegation mechanism and a custom bounding box set, the problem of limited interaction channels between the MCP tool and the editor was solved, enabling the MCP tool to effectively acquire and flexibly invoke editor interaction events, thereby enhancing interaction capabilities and version compatibility.

CN123178117APending Publication Date: 2026-11-27广州三七极创网络科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611224572.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-13
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

The limited interaction channels between the MCP tool and the editor prevent it from effectively acquiring editor interaction events and flexibly calling the editor's underlying interfaces, resulting in the inability to implement WYSIWYG editing interaction functions and point selection detection of non-mesh renderer nodes.

Method used

The event delegate mechanism is used to obtain editor interaction events, generate standard events and pass them to the MCP tool, establish a two-way message conversion channel, use a custom bounding box set for collision detection, achieve accurate picking of non-mesh renderer nodes, and convert MCP request messages and API request messages through preset mapping relationships.

Benefits of technology

The MCP tool enables efficient acquisition and flexible invocation of editor interaction events, enhancing interactive capabilities, reducing the technical threshold and maintenance costs for extended development, and improving version compatibility and maintainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178117A_ABST
    Figure CN123178117A_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses an interactive agent method, device and equipment for editor extension and a storage medium, and the method comprises the following steps: delivering an interactive event generated by an editor to an MCP tool to generate an MCP request message based on the interactive event through the MCP tool; acquiring the MCP request message, converting the MCP request message into an API request message matched with an application program interface of the editor according to a preset first mapping relationship, and delivering the API request message to the editor to generate an API response message based on the API request message through the editor; acquiring the API response message, converting the API response message into an MCP response message according to a preset second mapping relationship, and delivering the MCP response message to the MCP tool. The application solves the problem that the interactive channel between the MCP tool and the editor is limited, and realizes effective acquisition of the interactive event of the editor by the MCP tool and flexible calling of the underlying interface of the editor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to interactive proxy methods, apparatus, devices, and storage media for editor extensions. Background Technology

[0002] Game engine editors (such as the Cocos editor) provide developers with the ability to customize the editing interface and workflow through editor extension mechanisms. Developers can extend the editor's functionality by creating custom plugins, components, and scene editor tools. Developers can also extend functionality by programmatically calling the application programming interfaces (APIs) provided by the editor, hard-integrating the logic code of functions with the editor's underlying interface. With the development of MCP (Model Context Protocol) tools, technologies have emerged that integrate MCP tools into editors. This technology bridges external AI agents with the editor's functionality through predefined function calls.

[0003] In existing technologies, the game view of the editor is covered by an engine view component. This engine view component does not provide the MCP tool with a complete application programming interface (API) and messaging mechanism. This prevents the MCP tool from listening to interactive events such as mouse clicks, movements, and scroll wheel zooms in the scene editor, and also prevents it from customizing the editor's raycasting system to achieve point selection detection of non-mesh renderer nodes. Consequently, the MCP tool struggles to achieve WYSIWYG editing interaction. Furthermore, existing editor feature extensions rely on extension tools directly calling the editor's API or encapsulating the API through predefined functions. This lack of a protocol adaptation layer independent of specific API implementations results in deep coupling between the MCP tool's implementation and the version and protocol format of the editor's underlying API, hindering its flexible adaptation capabilities. In summary, the limited interaction channels between the MCP tool and the editor's internal structure prevent the MCP tool from effectively acquiring editor interaction events and flexibly calling the editor's underlying interfaces. Summary of the Invention

[0004] This application provides an interaction proxy method, apparatus, device, and storage medium for editor extensions to address the technical problem in related technologies where the interaction channel between the MCP tool and the editor is limited, preventing the MCP tool from effectively acquiring editor interaction events and flexibly calling the editor's underlying interfaces. This application uses an event proxy mechanism to acquire interaction events generated by the editor, generate standard events, and then transmit them to the MCP tool. This enables the MCP tool to generate MCP request messages based on the standard events. Simultaneously, a preset first mapping relationship is used to convert the MCP request messages into API request messages matching the editor's application programming interface (API) and transmit them to the corresponding editor. A preset second mapping relationship is also used to convert the API response messages returned by the API into MCP response messages and return them to the MCP tool. This establishes a bidirectional message conversion channel between the MCP tool and the editor's underlying interfaces, enabling the MCP tool to effectively acquire editor interaction events and flexibly call the editor's underlying interfaces.

[0005] In a first aspect, embodiments of this application provide an interaction proxy method for editor extensions, including: The interactive events generated by the editor are passed to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events; The MCP request message is obtained, and the MCP request message is converted into an API request message that matches the application interface of the editor according to a preset first mapping relationship. The API request message is then passed to the editor so that the editor can generate an API response message based on the API request message. The API response message is obtained, and the API response message is converted into an MCP response message according to a preset second mapping relationship. The MCP response message is then transmitted to the MCP tool.

[0006] Optionally, passing the interactive events generated by the editor to the MCP tool includes: Ray detection is performed on the interaction event to obtain the scene node information corresponding to the interaction event; Based on the event parameters of the interaction event and the scene node information, a standard event is generated; The standard event is passed to the MCP tool.

[0007] Optionally, the step of performing raycasting on the interaction event to obtain the scene node information corresponding to the interaction event includes: Obtain a preset set of custom bounding boxes, wherein each custom bounding box in the set corresponds to a scene node in the editor; Obtain the interaction position parameters corresponding to the interaction event; The interaction position parameters are respectively compared with each custom bounding box in the set of custom bounding boxes to obtain the matched custom bounding boxes; Obtain the node information of the scene node corresponding to the hit custom bounding box, and obtain the scene node information.

[0008] Optionally, passing the standard event to the MCP tool includes: Based on the event type of the standard event, determine the target MCP tool corresponding to the event type; The standard events are dispatched to the target MCP tool.

[0009] Optionally, converting the MCP request message into an API request message matching the application programming interface of the editor according to a preset first mapping relationship includes: The MCP request message is parsed to extract the MCP protocol fields and their corresponding first field values ​​contained in the MCP request message. Based on the first mapping relationship, the MCP protocol field and the first field value are respectively mapped to the target field and the second field value that match the application interface; The target field and the value of the second field are encapsulated to obtain the API request message.

[0010] Optionally, converting the API response message into an MCP response message according to a preset second mapping relationship includes: The API response message is parsed to extract the API response fields contained in the API response message and their corresponding first response field values; According to the second mapping relationship, the API response field and the first response field value are respectively mapped to the corresponding MCP response field and the second response field value; The MCP response field and the value of the second response field are encapsulated to obtain the MCP response message.

[0011] Optionally, before passing the interactive events generated by the editor to the MCP tool, the method further includes: Register an event delegate on the engine view component of the editor; When the editor generates the interaction event and passes it to the engine view component, the interaction event is obtained through the event delegate.

[0012] In a second aspect, embodiments of this application provide an interactive proxy device for editor extensions, comprising: The transmission module is used to transmit interactive events generated by the editor to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events; The acquisition module is used to acquire the MCP request message; The conversion module is used to convert the MCP request message into an API request message that matches the application programming interface of the editor according to a preset first mapping relationship. The transmission module is also used to transmit the API request message to the editor, so that the editor can generate an API response message based on the API request message; The acquisition module is also used to acquire the API response message; The conversion module is also used to convert the API response message into an MCP response message according to a preset second mapping relationship; The transmission module is also used to transmit the MCP response message to the MCP tool.

[0013] In a third aspect, embodiments of this application provide an electronic device, including: a memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the interactive proxy method for editor extensions as described in the first aspect.

[0014] In a fourth aspect, embodiments of this application provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the interactive proxy method for editor extensions as described in the first aspect.

[0015] This application establishes a standardized bidirectional interaction channel between the MCP tool and the editor by constructing an interaction proxy mechanism independent of the editor's underlying API. This solves the technical problem in existing technologies where the interaction channel between the MCP tool and the editor is limited, preventing the MCP tool from effectively acquiring editor interaction events and flexibly calling the editor's underlying interfaces. Specifically, by registering an event proxy on the editor's engine view component and performing raycasting and standardization on the captured interaction events, the original interaction events are converted into standard events carrying scene node information. This enables the MCP tool to effectively acquire events such as mouse clicks, movements, and wheel zooms that were originally blocked by the engine view component, providing a prerequisite for achieving WYSIWYG editing interaction functionality. Simultaneously, by introducing a custom bounding box set and performing collision detection between the interaction position parameters and the custom bounding box, accurate picking of non-mesh renderer nodes or custom selection areas is achieved, enriching the interaction scenarios of the MCP tool. Furthermore, this application utilizes pre-defined first and second mapping relationships to perform bidirectional message conversion on MCP request messages and API response messages, involving protocol field parsing, mapping, and re-encapsulation. This configurable mapping relationship replaces the hard-coded call method between the MCP tool and the editor API in existing technologies, decoupling the implementation of the MCP tool from the underlying editor API version. When the editor API changes, only the mapping configuration needs to be adjusted without modifying the tool code, significantly improving the tool's version compatibility and maintainability. This application effectively enhances the interactive capabilities and development efficiency of the MCP tool, while reducing the technical threshold and maintenance costs for extended development. Attached Figure Description

[0016] Figure 1 This is a flowchart of the interactive proxy method for editor extension provided in the embodiments of this application; Figure 2 This is a flowchart illustrating a method for transmitting interactive events generated by an editor to an MCP tool, as provided in an embodiment of this application. Figure 3 This is a flowchart of a method for performing ray detection on interactive events to obtain scene node information corresponding to the interactive events, as provided in an embodiment of this application. Figure 4 This is a schematic diagram of the structure of the interactive proxy device for editor extension provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in detail below with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. Furthermore, it should be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but additional steps not included in the drawings may also be present. The above processes can correspond to methods, functions, procedures, subroutines, subroutines, etc.

[0018] Figure 1 This is a flowchart of the interactive proxy method for editor extension provided in the embodiments of this application, see reference. Figure 1 The interaction delegate methods used for editor extensions include: Step S101: Pass the interactive events generated by the editor to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events.

[0019] The editor can be an integrated development environment provided by the game development engine for creating and editing game scenes, nodes, and components. For example, the editor can be the Cocos Creator editor.

[0020] Interaction events can be events generated when a user performs an operation in the scene editing area of ​​the editor. For example, the interaction event can be a mouse click event, a mouse move event, a scroll wheel zoom event, or a keyboard input event.

[0021] Among them, the MCP tool can be a tool implemented based on the Model Context Protocol. This MCP tool can receive interactive events and generate MCP request messages that conform to the MCP protocol specification based on the interactive events.

[0022] The MCP request message can be a data message that conforms to the MCP protocol specification and is generated by the MCP tool based on interactive events. The MCP request message contains MCP protocol fields and their corresponding field values, and is used to request the application programming interface of the editor to perform the corresponding editing operation.

[0023] In this context, "transmission" refers to the process of sending standard events from the event processing middleware to the MCP tool. This can be achieved through inter-process communication mechanisms or callback mechanisms within the same computing device. For example, it can involve calling the event callback interface of a registered MCP tool via the event dispatcher, passing the standard event as a callback parameter, or pushing the standard event as a message to the message queue of the MCP tool's process via local network communication. The event processing middleware establishes an event transformation and transmission channel between the editor's native event system and the MCP tool. It can be an intermediate processing layer located above the editor's engine view component and below the MCP tool. It is responsible for capturing interactive events generated by the editor through the event delegate, performing raycasting and standardization on these events to obtain standard events, and then dispatching these standard events to the corresponding MCP tools via the event dispatcher. For instance, it can sequentially perform coordinate transformation, custom bounding box collision detection, and encapsulation of event parameters and scene node information on raw mouse events captured from the engine view component, ultimately generating standard events recognizable by the MCP tool.

[0024] Figure 2 This is a flowchart illustrating a method for passing interactive events generated by the editor to the MCP tool, as provided in an embodiment of this application. (Refer to...) Figure 2 The method for passing interactive events generated by the editor to the MCP tool includes: Step S201: Perform ray detection on the interaction event to obtain the scene node information corresponding to the interaction event.

[0025] Ray detection is used to determine the object that an interactive event points to in the scene editing area. It can be a detection mechanism that determines the hit object by emitting a ray from the interactive position and detecting whether the ray intersects with the bounding box or geometry of an object in the scene. For example, ray intersection detection can be performed based on the engine's default mesh renderer geometry or collision detection can be performed based on a custom bounding box.

[0026] Scene node information is used to characterize the attributes of scene nodes hit by ray detection. It can be the identification information, location information or hierarchy information of the scene node, such as node name, node type, the node's position coordinates in the world coordinate system or the node's path information in the scene hierarchy tree.

[0027] Figure 3 This is a flowchart of a method for performing ray detection on interactive events to obtain scene node information corresponding to the interactive events, as provided in an embodiment of this application. (Refer to...) Figure 3 The method for performing raycasting on interactive events to obtain scene node information corresponding to the interactive events includes: Step S301: Obtain a preset set of custom bounding boxes, wherein each custom bounding box in the set corresponds to a scene node in the editor.

[0028] The custom bounding box set is used to store and manage one or more custom bounding boxes pre-configured for scene nodes. It can be a data structure containing multiple custom bounding boxes, each of which corresponds to a scene node in the editor scene.

[0029] The custom bounding box is used to define the spatial range in which scene nodes can be hit in raycasting. It can be the detection area of ​​the geometry independent of the engine's default mesh renderer. It can be customized by the developer according to the interaction requirements of the scene nodes. For example, it can be a rectangular bounding box configured for UI nodes that do not have a mesh renderer or an enlarged bounding box configured for small-sized model nodes that need to expand the selection range.

[0030] Scene nodes can be the basic building blocks of an editor scene, representing game objects, component containers, or organizational hierarchies within the scene. Optionally, scene nodes can be model nodes, camera nodes, light nodes, or empty nodes that serve as child node containers.

[0031] Optionally, retrieve a preset set of custom bounding boxes, including: The configuration entry provided by the MCP tool manager pre-establishes the correspondence between each scene node and a custom bounding box, and stores this correspondence in the form of key-value pairs in the mapping configuration library. When performing ray detection, it iterates through all the custom bounding boxes and their associated scene node identifiers stored in the mapping configuration library, and encapsulates the read custom bounding boxes and their corresponding scene node identifiers into a custom bounding box set for use in the subsequent collision detection stage.

[0032] The MCP tool manager is used to centrally manage and configure MCP tools and their mapping relationships. It can be a management module integrated into the editor, responsible for configuring the mapping relationship between MCP tools and the editor application interface, managing the registration and publication of MCP tools, and providing a visual configuration interface for developers to set parameters for each MCP tool. For example, the MCP tool manager can configure the first mapping relationship and the second mapping relationship, and publish the configured MCP tools to the tool list visible to the MCP client.

[0033] The configuration entry is used to provide developers with an interface for setting parameters and mapping relationships for the MCP tool. It can be a visual configuration interface or configuration interface provided by the MCP tool manager, which allows developers to predefine the correspondence between each scene node and a custom bounding box through this configuration entry. For example, through the bounding box configuration panel in the MCP tool manager interface, developers can set the bounding box type, size parameters and position offset for the target scene node.

[0034] For example, developers can set the bounding box type and bounding box parameters for target scene nodes through the configuration interface of the MCP tool manager. For instance, they can configure a rectangular bounding box with a size of 100×100 pixels, centered at the node's location, for an empty node without a mesh renderer. This configuration data is stored in the mapping configuration library with the node identifier as the key and the bounding box parameters as the value. During raycasting, all configured bounding box records are read from the mapping configuration library to generate a custom bounding box set containing multiple sets of bounding box-node correspondences.

[0035] Step S302: Obtain the interaction position parameters corresponding to the interaction event.

[0036] The interaction position parameter is used to characterize the location of the interaction event in the scene editing area. It can be the position coordinate data after coordinate system transformation, such as the two-dimensional coordinate position of the mouse in the current editor view coordinate system or the corresponding position in the scene world coordinate system after coordinate transformation.

[0037] Optionally, obtaining the interaction position parameters corresponding to the interaction event includes: After the event delegate captures the interaction event, it extracts the interaction position information in the screen coordinate system from the raw event data of the interaction event; based on the viewport size, camera projection matrix and viewport transformation parameters of the current scene view of the editor, it converts the screen coordinates into the position parameters corresponding to the current scene editing area. These position parameters can be three-dimensional coordinates in the scene world coordinate system or two-dimensional coordinates in the view coordinate system.

[0038] For example, for a mouse click event, the clientX and clientY coordinates of the mouse in the browser window are read from the event object of the event. Then, based on the offset and scaling ratio of the engine-view component in the editor interface, the browser coordinates are converted into relative coordinates within the scene view. For cases where ray detection is required in the 3D scene, the view coordinates are further back-projected into the scene world coordinate system by combining the current camera view matrix and projection matrix of the scene editor, so as to obtain the interaction position parameters corresponding to the interaction event in the scene world coordinate system.

[0039] Step S303: Perform collision detection between the interaction position parameters and each custom bounding box in the custom bounding box set to obtain the matched custom bounding boxes.

[0040] Collision detection is used to determine whether the interaction position is within the space defined by the custom bounding box. It can be a detection process that compares the interaction position parameters with the position range of each custom bounding box to determine whether there is an intersection relationship. For example, the interaction position coordinates can be compared with the boundary coordinate range of the rectangular bounding box, or the interaction position coordinates can be converted into rays and then intersected with the geometry of the bounding box.

[0041] Among them, "hit" is used to represent the intersection relationship between the interaction position and the custom bounding box. It can be the detection result returned by collision detection that confirms that the interaction position falls within the range of a certain custom bounding box, such as detecting that the mouse click position is within the coordinate range of the custom bounding box associated with a certain scene node.

[0042] Optionally, collision detection is performed between the interaction position parameters and each custom bounding box in the set of custom bounding boxes to obtain the matched custom bounding boxes, including: Iterate through each custom bounding box in the set of custom bounding boxes, and compare the interaction position parameter with the spatial range of the custom bounding box. When the interaction position parameter is detected to fall within the range of a custom bounding box, the custom bounding box is identified as the hit custom bounding box, and the iteration ends. If no hit is found after iterating through all custom bounding boxes, it is determined that there is no hit result for this collision detection.

[0043] For example, for a rectangular bounding box, the two-dimensional coordinates of the interaction position are compared with the coordinates of the top, bottom, left, and right boundaries of the rectangular bounding box. If the X value of the coordinate is between the left and right boundaries and the Y value is between the top and bottom boundaries, then the interaction position is considered to have hit the rectangular bounding box. For a spherical bounding box, the Euclidean distance between the three-dimensional coordinates of the interaction position and the center point of the bounding box is calculated. If the distance is less than or equal to the radius of the spherical bounding box, then it is considered to have hit the box. For a cubic bounding box, the three-dimensional coordinates of the interaction position are compared with the minimum and maximum values ​​of the bounding box in the X, Y, and Z axes. If all three axes are within the corresponding range, then it is considered to have hit the box.

[0044] Step S304: Obtain the node information of the scene node corresponding to the hit custom bounding box, and obtain the scene node information.

[0045] Optionally, obtain the node information of the scene node corresponding to the hit custom bounding box, including: Based on the custom bounding boxes hit during the collision detection phase, the scene node identifier associated with the custom bounding box is searched in the set of custom bounding boxes. Based on the scene node identifier, the corresponding scene node object is obtained from the scene hierarchy tree of the editor, and the node information is extracted from the scene node object. The node information can be the node name, node type, node unique identifier, the node's position coordinates in the current scene, or the node's path information in the scene hierarchy tree.

[0046] For example, after determining the matched custom bounding box, the node identifier corresponding to the bounding box is read from the mapping configuration library. The corresponding scene node is located in the scene hierarchy tree based on the node identifier through the node search interface provided by the editor. Then, the node name retrieval interface, type retrieval interface, and position retrieval interface are called respectively to extract the node name, node type, and position coordinates of the scene node. The extracted information is then encapsulated into structured scene node information and returned for use in subsequent standard event generation.

[0047] The node lookup interface is used to retrieve the corresponding scene node in the editor's scene hierarchy tree based on the node identifier. It can be a programming interface provided by the editor's application programming interface that returns a reference to the corresponding scene node with the node identifier as input parameter, such as the editor's findNodeById or getNodeByUuid node lookup methods. By passing in the unique identifier of the scene node, the reference of the node can be obtained, and then the node's name, type, position and other attribute information can be read.

[0048] Step S202: Generate a standard event based on the event parameters of the interactive event and the scene node information.

[0049] Standard events are used to provide a unified format for describing interactive behaviors for the MCP tool. They can be standardized event objects generated by encapsulating the event parameters of the original interactive events and the scene node information obtained by ray detection according to a preset data structure. For example, an event data package is generated by integrating the click coordinates, event type and the node name and node type of the hit scene node of the mouse click event.

[0050] Optionally, based on the event parameters of the interaction event and the scene node information, a standard event is generated, including: Event parameters are extracted from the raw event data of the interaction event. These event parameters include the event type, the coordinates of the interaction location, and the auxiliary state information when the event is triggered. The extracted event parameters are combined and encapsulated with the scene node information obtained by ray detection in step S201 according to the preset standard event data structure to generate a standard event in a unified format for the MCP tool to recognize and process.

[0051] Among them, auxiliary status information is used to characterize the status data of auxiliary operations that occur simultaneously with the main operation when the interactive event is triggered. It can be the function key pressed by the user when the interactive event is triggered or the information of the activated auxiliary mode, such as the status indicator of whether the Ctrl key or Shift key on the keyboard is pressed at the same time when the mouse is clicked, or the information of the current editing mode of the editor when the scroll wheel is operated.

[0052] For example, for a mouse click event, extract the event type as mouse click, the interaction position coordinates as two-dimensional coordinates in the current view coordinate system, and the auxiliary state information as the state of the function key pressed when the click is made from the original mouse event; encapsulate the above event parameters together with the node name, node type and node identifier in the scene node information to generate a standard event object in the format {eventType: "click", position: {x, y}, nodeInfo: {name, type, id}, modifiers: {ctrl, shift}}.

[0053] Step S203: Pass the standard event to the MCP tool.

[0054] In one implementation, passing the standard event to the MCP tool includes: Step S2031: Determine the target MCP tool corresponding to the event type based on the event type of the standard event.

[0055] Among them, the event type is used to distinguish the interaction category to which the standard event belongs. It can be a type identifier determined according to the operation category of the original interaction event, such as mouse click type, mouse movement type, scroll wheel zoom type, or keyboard input type. Different MCP tools can register to listen to specific event types according to their functional requirements.

[0056] Optionally, based on the event type of the standard event, a target MCP tool corresponding to the event type is determined, including: During the registration phase, each MCP tool declares the event types it needs to listen to to the tool registry. The tool registry establishes a mapping table between event types and MCP tools, using the event type as the index and the list of MCP tools registered for that event type as the value. Upon receiving a standard event, the tool registry retrieves the corresponding list of MCP tools using the event type of that standard event as the lookup key, and identifies the retrieved MCP tool as the target MCP tool. When an event type corresponds to multiple target MCP tools, the allocation order is determined according to the registration priority or registration order of each MCP tool.

[0057] The registration phase is used to characterize the initialization process of the MCP tool declaring its event listening types and registering callback interfaces. It can be the process after the MCP tool is loaded into the editor, where the MCP tool submits a list of event types it needs to listen to and the corresponding event handling interfaces to the tool registry. For example, when the MCP tool is initialized, it calls the registration method of the tool registry and submits the event types mouse click and mouse move along with their event handling callback functions. The tool registry records and establishes the corresponding relationship.

[0058] The tool registry is used to manage and maintain the correspondence between event types and MCP tools. It can be a registration management module that stores a mapping table. The mapping table uses the event type as the index key and the list of MCP tools registered for that event type as the index value, so that the event dispatcher can query the corresponding target MCP tool when it receives a standard event. For example, a hash table structure can be used to store the mapping relationship between event types and references to MCP tools that listen for that event type.

[0059] For example, tool A registers to listen for mouse click and mouse move events, tool B registers to listen for mouse click and scroll wheel zoom events, and tool C registers to listen for keyboard input events. The tool registry then creates a mapping table as follows: {Mouse click: [Tool A, Tool B], Mouse move: [Tool A], Scroll wheel zoom: [Tool B], Keyboard input: [Tool C]}. When the event dispatcher receives a standard event of type "mouse click," it looks up the corresponding target MCP tools, Tool A and Tool B, in the mapping table.

[0060] Step S2032: Dispatch the standard event to the target MCP tool.

[0061] The dispatch function is used to characterize the process of accurately sending standard events to the corresponding target MCP tools. It can be a processing mechanism that routes standard events to MCP tools that have registered the event type based on the correspondence between event types and target MCP tools. For example, the event dispatcher queries the event types registered by each MCP tool in the tool registry and dispatches the click-type standard event to the target MCP tool that has registered the event type, without having to broadcast the event to all MCP tools.

[0062] Optionally, dispatching the standard events to the target MCP tool includes: After identifying the target MCP tool, the event dispatcher sends the standard event as a parameter to the event handling interface of the target MCP tool. Specifically, the event dispatcher can use a synchronous callback method, directly calling the callback handling function provided by the target MCP tool during registration, passing the standard event as a parameter to the callback handling function. The target MCP tool responds synchronously in the callback handling function and generates the corresponding MCP request message. Alternatively, the event dispatcher can use an asynchronous message method, pushing the standard event as a message to the message queue of the target MCP tool. The target MCP tool then asynchronously retrieves the standard event from its message queue and processes it.

[0063] The event dispatcher is used to route standard events to the corresponding target MCP tools. It can be an event routing module located in the middle layer of event processing. The event dispatcher receives standard events output from the event converter, queries the tool registry to determine the target MCP tool corresponding to the event type, and then sends the standard events to the event processing interface of each target MCP tool. For example, it retrieves the list of target MCP tools in the tool registry based on the event type field in the standard event, and calls the corresponding callback method of each tool in the list in sequence.

[0064] The event handling interface is used by the MCP tool to receive standard events and trigger subsequent processing logic. It can be a callback function or a message receiving channel provided by the MCP tool when registering with the tool registry, so that the event dispatcher can send standard events to the corresponding MCP tool through the event handling interface, such as the onEvent callback function exposed by the MCP tool or the asynchronous message queue used by the MCP tool to receive events.

[0065] For example, when a target MCP tool uses synchronous callbacks for event listening, the event dispatcher iterates through the list of target MCP tools, sequentially calling the onEvent callback function of each target MCP tool, passing the standard event object as a callback parameter. Each target MCP tool then generates the corresponding MCP request message in its onEvent function based on the event type and scene node information. When a target MCP tool uses asynchronous messaging, the event dispatcher serializes the standard event and writes it to the message channel corresponding to the target MCP tool. The target MCP tool then reads and deserializes the event from the message channel in its worker thread before performing subsequent processing.

[0066] In one implementation, generating an MCP request message based on the interaction event includes: Upon receiving a standard event, the MCP tool parses the event, extracting the event type, interaction location parameters, and scene node information. Based on the extracted event type, it determines the corresponding editing operation category; based on the extracted scene node information, it determines the target scene node for the editing operation; and based on the interaction location parameters, it determines the specific operation parameters for the editing operation. Following the MCP protocol specification, it encapsulates the editing operation category, target scene node, and operation parameters into corresponding MCP protocol fields and their values, generating an MCP request message.

[0067] Optionally, after receiving a standard event, the MCP tool parses the standard event and extracts the event type, interaction location parameters, and scene node information contained in the standard event, including: The MCP tool reads the event type field, interaction location field, and node information field from the preset data structure of the standard event, obtaining the corresponding event type value, interaction location coordinate value, and scene node information value, respectively. The MCP tool internally has a pre-defined mapping relationship between event types and editing operation categories, as well as a correspondence rule between editing operation categories and MCP protocol fields. Based on this mapping relationship and correspondence rule, the MCP tool converts the extracted standard event information into a structured MCP request message.

[0068] For example, suppose the MCP tool receives a standard event of mouse click, with the event type value "click" and the interaction position coordinates being three-dimensional coordinates in the scene's world coordinate system. The scene node information includes the node name "Enemy_Spawner" and the node type being an empty node. Based on a preset mapping relationship between event types and editing operation categories, the MCP tool maps the mouse click to the editing operation category of node attribute modification. According to the correspondence rules between editing operation categories and MCP protocol fields, it determines that the MCP request message must include an operation type field, an operation object field, and an operation parameter field. It encapsulates the node attribute modification as the value of the operation type field into the MCP request message, encapsulates the node identifier from the scene node information as the value of the operation object field into the MCP request message, and encapsulates the interaction position coordinates and event type value as the values ​​of the operation parameter field into the MCP request message. Finally, it generates a structured MCP request message to request the editor's application programming interface to perform the corresponding attribute modification operation on the target scene node.

[0069] In one implementation, prior to passing the interactive events generated by the editor to the MCP tool, the method further includes: Step S1001: Register an event delegate on the engine view component of the editor.

[0070] The engine view component is used to handle the rendering and display of the scene editing area in the editor and to receive events. It can be a component provided by the editor to present the game scene view. The engine view component is located above the scene editing area of ​​the editor. Interactive events are captured by the event delegates registered on it after being passed to the engine view component.

[0071] Registration is used to characterize the process of establishing an association between the event delegate and the engine view component. This can be achieved by adding an event listener to the engine view component, enabling the event delegate to intercept interactive events received by the engine view component, such as calling the listener interface of the engine view component, or binding the event handling method of the event delegate to the corresponding mouse or keyboard event of the engine view component.

[0072] Optionally, register an event delegate on the editor's engine view component, including: When the editor starts or the MCP tool service initializes, an event delegate instance is created, and each event handling method of the event delegate instance is bound to the corresponding native event listener interface on the engine view component. Specifically, through the event listener interface exposed by the engine view component, the mouse event handling methods, keyboard event handling methods, and scroll wheel event handling methods in the event delegate are registered sequentially as the listener callback functions for the corresponding events of the engine view component. This allows the engine view component to automatically pass the event object to the corresponding handling method in the event delegate when the user triggers an interactive event within the viewport of the engine view component.

[0073] For example, during the Cocos editor's Extension loading phase, an event proxy object is instantiated, and the addEventListener method or on method of the engine view component is called to register the event proxy's handleMouseDown method as a listener for the engine view component's mousedown event, thereby completing the registration of the event proxy on the engine view component.

[0074] Step S1002: When the editor generates the interaction event and passes it to the engine view component, the interaction event is obtained through the event delegate.

[0075] The event proxy is used to establish an event bridge between events within the editor and the MCP tool. It can be an event interception and forwarding module registered on the engine view component. The event proxy can capture the raw interactive events received by the engine view component, perform coordinate transformation and standardization on the events, and then pass the processed standard events to the corresponding MCP tool. For example, by listening to mouse press events, mouse move events, and scroll wheel zoom events on the engine view component, the raw events are captured, converted into standard events containing scene node information, and then distributed.

[0076] Optionally, when the editor generates the interaction event and passes it to the engine view component, the interaction event is obtained through the event delegate, including: When a user triggers an interactive action in the scene editing area, the editor passes the generated interactive event to the engine view component. The engine view component, based on the registered event listener relationships, passes the event object of the interactive event to the corresponding handling method in the event delegate. Upon receiving the event object, the event delegate extracts the raw event data from it, including the event type, interaction location coordinates, and auxiliary state information at the time of event triggering, thus obtaining the raw interactive event data content. The event delegate can also, according to configuration, decide whether to prevent the interactive event from propagating to the engine view component's default behavior handler, thereby shielding the editor's default interactive behavior and giving the MCP tool complete control over the interactive event.

[0077] For example, when a user clicks the mouse in the scene editing area, the click event generated by the editor is first passed to the engine view component. The engine view component calls the handleMouseDown method of the previously registered event delegate, passing the event object of the click event as a parameter. The event delegate reads the coordinates of the mouse click position in the browser window, the identifier of the pressed mouse button, and the state of the function key from the event object to complete the acquisition of the original interaction event. If the event delegate determines that the editor's default selection behavior needs to be blocked based on the configuration, it calls the preventDefault method on the event object to prevent the event from continuing to propagate to the default behavior handler of the engine view component. Subsequently, the MCP tool decides how to respond to the interaction event.

[0078] Step S102: Obtain the MCP request message, convert the MCP request message into an API request message that matches the application programming interface of the editor according to the preset first mapping relationship, and pass the API request message to the editor so that the editor can generate an API response message based on the API request message.

[0079] The first mapping relationship is used to define the conversion rules between MCP request messages and API request messages. It can be pre-configured data describing the correspondence between MCP protocol fields and the call fields of the editor application interface, such as a mapping configuration file stored in JSON format. This mapping configuration file records the correspondence between MCP protocol field names and application interface field names, data type conversion rules, and protocol encapsulation format.

[0080] Among them, the application programming interface (API) is used to provide the functional entry point of the editor for external calls. It can be a programming interface exposed by the editor that can be called to perform editing operations, such as the interface for creating and deleting nodes, the interface for reading and modifying node attributes, or the interface for querying and updating scene data.

[0081] Among them, matching is used to characterize the compatibility relationship between the API request message and the editor's application interface. It can be that the converted API request message conforms to the calling specification of the application interface in terms of protocol format, field structure and data type, so that the application interface can correctly parse and execute the editing operation indicated by the API request message.

[0082] The API request message is used to request the editor to perform a specified editing operation. It can be a request data message that conforms to the editor application interface call specification after protocol parsing, field mapping and re-encapsulation. The API request message contains the target field and the second field value that match the application interface.

[0083] The API response message is used to load the result data after the editor performs the editing operation based on the API request message. It can be a response data message returned by the editor through the application interface. The API response message contains API response fields and their corresponding response field values, which are used to reflect the execution status of the editing operation or return the operation result.

[0084] In one implementation, converting the MCP request message into an API request message matching the editor's application programming interface according to a preset first mapping relationship includes: Step S1021: Perform protocol parsing on the MCP request message and extract the MCP protocol fields and their corresponding first field values ​​contained in the MCP request message.

[0085] Protocol parsing is used to extract structured information from MCP request messages. It can be a process of disassembling message data layer by layer according to the MCP protocol specification in order to identify and extract each field and its corresponding value in the message. For example, according to a preset protocol format template, the message header, protocol fields and field values ​​are read and separated in sequence.

[0086] The MCP protocol field is used to identify the data items carried in the MCP request message. It can be a field name defined according to the MCP protocol specification, used to describe the operation type, operation object or operation parameters requested by the request message, such as a field used to indicate the node to create the operation or a field used to specify the target node of the operation.

[0087] The first field value is used to carry the specific data content corresponding to the MCP protocol field. It can be the field value associated with the MCP protocol field, used to identify the specific operation object or the actual value of the operation parameter targeted by the request message, such as the node type value corresponding to the node creation operation or the attribute name and attribute value corresponding to the node attribute modification operation.

[0088] Optionally, the MCP request message is parsed to extract the MCP protocol fields and their corresponding first field values ​​contained in the MCP request message, including: According to the message format defined in the MCP protocol specification, the MCP request message is parsed in layers. First, the message header information is read to determine the protocol version and message length. Then, based on the field layout rules corresponding to the message length and protocol version, each MCP protocol field in the message is located and read sequentially, and the field name of each MCP protocol field is identified. Finally, the field values ​​associated with each MCP protocol field are extracted to obtain a set of key-value pairs between each group of MCP protocol fields and the first field value.

[0089] For example, for an MCP request message requesting modification of scene node attributes, the access layer tool executor reads the header information of the message to determine that the message uses MCP protocol version 1.0 and the message body length is 256 bytes. According to the field layout specified by this protocol version, the operation type field (operation), the operation object field (target_node), and the operation parameter field (parameters) are read from the message in sequence, and the first field value corresponding to each field is extracted: the field value corresponding to the operation type field is attribute modification, the field value corresponding to the operation object field is the node identifier node_001, and the field value corresponding to the operation parameter field is the JSON format parameter string {"position": [10, 20, 30]}. The above MCP protocol fields and the first field values ​​are organized into structured parsed data in key-value pairs for use in subsequent mapping steps.

[0090] The access layer tool executor is used to perform message conversion and forwarding between the MCP tool and the editor. It can be a communication intermediary module located between the MCP tool management layer and the editor's application programming interface (API). It is responsible for receiving MCP request messages generated by the MCP tool, converting the MCP request messages into API request messages according to a preset first mapping relationship and forwarding them to the editor, and receiving API response messages returned by the editor. It converts the API response messages into MCP response messages according to a preset second mapping relationship and returns them to the MCP tool. For example, after performing protocol parsing, field mapping, and re-encapsulation on the MCP request messages in sequence, the generated API request messages are forwarded to the editor through the editor's application programming interface (API) call. After receiving the API response messages, it performs parsing, field mapping, and encapsulation, and returns the generated MCP response messages to the corresponding MCP tool.

[0091] Step S1022: Based on the first mapping relationship, map the MCP protocol field and the first field value to the target field and the second field value that match the application interface, respectively.

[0092] The mapping is used to characterize the process of converting fields and values ​​in MCP messages into corresponding fields and values ​​in API messages. It can be a processing mechanism that finds the corresponding fields of MCP protocol fields in the application interface and performs field value format conversion according to the corresponding rules recorded in the first mapping relationship. For example, the location field in the MCP protocol is mapped to the node coordinate field in the application interface, and the string format coordinate value is converted into the vector format coordinate value.

[0093] The target field is used to identify the data item carried in the transformed API request message. It can be a field name that matches the editor's application interface. The target field has a correspondence defined by the first mapping relationship with the MCP protocol field, such as mapping the operation object name in the MCP protocol field to the node identifier field in the application interface.

[0094] The second field value is used to carry the specific data content corresponding to the target field. It can be a data value that conforms to the application interface call specification after the data type conversion or format adaptation of the first field value, such as the coordinate value in the world coordinate system obtained after the first field value is converted by the coordinate system.

[0095] Optionally, based on the first mapping relationship, the MCP protocol field and the first field value are respectively mapped to a target field and a second field value that match the application interface, including: Using the MCP protocol fields extracted during the protocol parsing phase as query keys, the corresponding mapping rules are retrieved from the first mapping relationship to obtain the target field name and data type conversion rule corresponding to each MCP protocol field. For each pair of MCP protocol fields and first field values, the MCP protocol field is replaced with the target field name specified in the mapping rule. Simultaneously, according to the data type conversion rule, the corresponding data type conversion operation is performed on the first field value, and the converted field value is used as the second field value. If no mapping rule corresponding to a certain MCP protocol field is found in the first mapping relationship, the MCP protocol field and its corresponding first field value are retained unchanged, or processed according to the preset default conversion rule.

[0096] For example, the first mapping configuration, stored in JSON format, records a mapping rule as {"operation": {"target": "api_method", "type_convert": "string_to_enum"}}. The access layer tool executor, based on this mapping rule, maps the MCP protocol field 'operation' to the target field 'api_method', and modifies its corresponding first field value attribute to the enumeration value 'SET_PROPERTY' according to the string-to-enumeration conversion rule, using it as the second field value.

[0097] Step S1023: Encapsulate the target field and the second field value to obtain the API request message.

[0098] Encapsulation refers to the process of combining mapped fields and values ​​into a complete message that conforms to the target protocol format. It can be the process of organizing and packaging the target fields and second field values ​​according to the protocol format required by the editor's application interface. For example, the mapped target fields and their corresponding second field values ​​can be assembled according to a preset message structure template, and necessary message header information can be added to generate an API request message that can be directly called by the editor's application interface.

[0099] Optionally, the target field and the value of the second field are encapsulated to obtain the API request message, including: Following the protocol format required by the editor's application programming interface (API), all mapped target fields and their corresponding second field values ​​are organized and packaged. Specifically, first, the calling protocol type and message encapsulation template of the target API are determined. This encapsulation template defines the message structure of the API request message, including the message header format, field order, and field separation method. Then, according to the encapsulation template, the values ​​of each group of target fields and second fields are sequentially filled into the corresponding positions in the message body, and a message header containing message length, interface identifier, and version information is generated. Finally, the message header is concatenated with the message body to generate a complete API request message.

[0100] For example, the API request message required by the Cocos editor for setting node properties uses JSON format, with the message structure template being {"method": "<method name>", "args": {"nodeId": "<node identifier>"}}. The access layer tool executor fills the mapped target field api_method and its second field value SET_PROPERTY into the method field, and fills the target field node_id and its second field value into the nodeId field to generate a complete JSON format API request message, which can be directly parsed and invoked by the editor's application interface.

[0101] Step S103: Obtain the API response message, convert the API response message into an MCP response message according to the preset second mapping relationship, and transmit the MCP response message to the MCP tool.

[0102] The second mapping relationship is used to define the conversion rules between API response messages and MCP response messages. It can be pre-configured data describing the correspondence between response fields of the editor application interface and MCP response fields, such as a response mapping configuration file stored in JSON format. This response mapping configuration file records the correspondence between API response field names and MCP response field names, response status code conversion rules, and semantic processing rules.

[0103] The MCP response message is used to return the processing result of the editing operation to the MCP tool. It can be a data message that conforms to the MCP protocol specification after semantic transformation of the API response message based on the second mapping relationship. The MCP response message is easy for the MCP tool to understand and process directly in terms of format and content.

[0104] In one implementation, converting the API response message into an MCP response message according to a preset second mapping relationship includes: Step S1031: Parse the API response message and extract the API response fields contained in the API response message and their corresponding first response field values.

[0105] Parsing is used to extract structured information from API response messages. It can be a process of disassembling API response messages according to the response format specifications of the editor application interface in order to identify and extract each response field and its corresponding response field value. For example, after identifying the format of the API response message, the response status field, the return data field and the specific value of each field are read in sequence.

[0106] Among them, the API response field is used to identify the response data item carried in the API response message. It can be a field name defined according to the response format of the editor application interface, used to describe the execution status of the editing operation or the returned data, such as a status code field used to indicate whether the operation was successful or not, or a field used to return the current attribute information of the operated node.

[0107] The first response field value is used to carry the specific response data content corresponding to the API response field. It can be a field value associated with the API response field, used to represent the actual execution result of the editing operation or the specific data returned, such as the success identifier value corresponding to the status code field or the node coordinate data corresponding to the attribute information field.

[0108] Optionally, the API response message is parsed to extract the API response fields and their corresponding first response field values ​​contained in the API response message, including: The API response messages are structured and parsed according to the response format specifications of the editor application interface. First, the parsing method is determined based on the format type of the API response message; then, each API response field in the response message is read sequentially, and the field name of each API response field is identified; finally, the response field values ​​associated with each API response field are extracted, resulting in a set of key-value pairs between each group of API response fields and the first response field value.

[0109] For example, the API response message returned by the editor is in JSON format, with the content {"status": 0, "data": {"nodeId": "node_001", "position": [10, 20, 30]}, "message": "success"}. The access layer tool executor parses this JSON format API response message, extracting the API response field status and its corresponding first response field value 0, the API response field data and its corresponding first response field value {"nodeId":"node_001", "position":[10,20,30]}, and the API response field message and its corresponding first response field value success, for use in subsequent mapping steps.

[0110] Step S1032: According to the second mapping relationship, map the API response field and the first response field value to the corresponding MCP response field and the second response field value, respectively.

[0111] The MCP response field is used to identify the response data items carried in the converted MCP response message. It can be a field name that conforms to the MCP protocol specification. The MCP response field and the API response field have a correspondence defined by the second mapping relationship, such as mapping the status code field in the API response field to the operation result field in the MCP response message.

[0112] The second response field value is used to carry the specific response data content corresponding to the MCP response field. It can be a data value that is easy for the MCP tool to understand after semantic conversion or format adaptation of the first response field value, such as converting the numeric status code of the editor into a string that the MCP tool can recognize.

[0113] Optionally, according to the second mapping relationship, the API response field and the first response field value are mapped to the corresponding MCP response field and the second response field value, respectively, including: Using the API response fields extracted during the response parsing phase as query keys, the corresponding mapping rules are retrieved from the second mapping relationship to obtain the MCP response field name and response field value conversion rule corresponding to the API response field. For each pair of API response fields and first response field values, the API response field is replaced with the MCP response field name specified in the mapping rule; simultaneously, according to the response field value conversion rule, the first response field value is subjected to corresponding semantic conversion or format adaptation operations, and the converted response field value is used as the second response field value.

[0114] For example, the second mapping configuration, stored in JSON format, records a mapping rule as {"status":{"target": "result", "value_convert": "code_to_semantic"}}. The access layer tool executor, based on this mapping rule, maps the API response field `status` to the MCP response field `result`. Then, according to the conversion rule from numeric status codes to semantic results, it converts the first response field value of 0 to the semantic string "Operation successful" as the second response field value. Other API response fields not configured in the mapping rule are directly converted according to the preset default conversion rule.

[0115] Step S1033: Encapsulate the MCP response field and the value of the second response field to obtain the MCP response message.

[0116] Optionally, the MCP response field and the value of the second response field are encapsulated to obtain the MCP response message, including: According to the response message format defined in the MCP protocol specification, all mapped MCP response fields and their corresponding second response field values ​​are organized and packaged. Specifically, first, the response message encapsulation template specified in the MCP protocol specification is determined. This encapsulation template defines the message structure of the MCP response message, including the message header format and the order of the message body fields. Then, according to the encapsulation template, the values ​​of each group of MCP response fields and the second response field are sequentially filled into the corresponding positions in the message body, and a message header containing the protocol version, message length, and response identifier is generated. Finally, the message header is concatenated with the message body to generate a complete MCP response message, which is returned to the MCP tool.

[0117] For example, the access layer tool executor successfully processes the mapped MCP response field result and its second response field value, fills them into the corresponding positions in the message body according to the response message format required by the MCP protocol specification, and generates a message header containing the protocol version and response identifier. After concatenation, a complete MCP response message is obtained, and the access layer tool executor returns the MCP response message to the MCP tool.

[0118] Figure 4 This is a schematic diagram of the structure of an interactive proxy device for editor extension provided in an embodiment of this application. (Reference) Figure 4 The interactive proxy device for editor extensions includes: The transmission module 41 is used to transmit the interactive events generated by the editor to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events. Acquisition module 42 is used to acquire the MCP request message; The conversion module 43 is used to convert the MCP request message into an API request message that matches the application programming interface of the editor according to a preset first mapping relationship. The transmission module 41 is further configured to transmit the API request message to the editor, so that the editor can generate an API response message based on the API request message; The acquisition module 42 is also used to acquire the API response message; The conversion module 43 is also used to convert the API response message into an MCP response message according to a preset second mapping relationship; The transmission module 41 is also used to transmit the MCP response message to the MCP tool.

[0119] In one embodiment, the transmission module 41 is configured to: Ray detection is performed on the interaction event to obtain the scene node information corresponding to the interaction event; Based on the event parameters of the interaction event and the scene node information, a standard event is generated; The standard event is passed to the MCP tool.

[0120] In one embodiment, the transmission module 41 is further configured to: Obtain a preset set of custom bounding boxes, wherein each custom bounding box in the set corresponds to a scene node in the editor; Obtain the interaction position parameters corresponding to the interaction event; The interaction position parameters are respectively compared with each custom bounding box in the set of custom bounding boxes to obtain the matched custom bounding boxes; Obtain the node information of the scene node corresponding to the hit custom bounding box, and obtain the scene node information.

[0121] In one embodiment, the transmission module 41 is further configured to: Based on the event type of the standard event, determine the target MCP tool corresponding to the event type; The standard events are dispatched to the target MCP tool.

[0122] In one embodiment, the conversion module 43 is configured to: The MCP request message is parsed to extract the MCP protocol fields and their corresponding first field values ​​contained in the MCP request message. Based on the first mapping relationship, the MCP protocol field and the first field value are respectively mapped to the target field and the second field value that match the application interface; The target field and the value of the second field are encapsulated to obtain the API request message.

[0123] In one embodiment, the conversion module 43 is further configured to: The API response message is parsed to extract the API response fields contained in the API response message and their corresponding first response field values; According to the second mapping relationship, the API response field and the first response field value are respectively mapped to the corresponding MCP response field and the second response field value; The MCP response field and the value of the second response field are encapsulated to obtain the MCP response message.

[0124] In one embodiment, the interactive proxy device for editor extensions further includes: Registration module 44 is used to register an event delegate on the engine view component of the editor; The acquisition module 42 is further configured to acquire the interaction event through the event delegate when the editor generates the interaction event and passes it to the engine view component.

[0125] It is worth noting that in the above embodiments of the interactive proxy device for editor extension, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this application.

[0126] This application also provides an electronic device that can integrate the interactive proxy device for editor extension provided in this application. Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. (Reference) Figure 5 The electronic device includes: an input device 53, an output device 54, a memory 52, and one or more processors 51; the memory 52 is used to store one or more programs; when one or more programs are executed by one or more processors 51, the one or more processors 51 implement the interactive proxy method for editor extension as provided in the above embodiments. The input device 53, output device 54, memory 52, and processor 51 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.

[0127] The memory 52 serves as a readable storage medium for a computing device and can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the interactive proxy method for editor extensions provided in any embodiment of this application (e.g., the transmission module 41, acquisition module 42, and conversion module 43 in the interactive proxy device for editor extensions). The memory 52 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory 52 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 52 may further include memory remotely located relative to the processor 51, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0128] Input device 53 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 54 may include display devices such as a display screen.

[0129] The processor 51 executes various functional applications and data processing of the device by running software programs, instructions, and modules stored in the memory 52, thereby implementing the interactive proxy method for editor extension described above.

[0130] The interactive proxy device, apparatus, and computer for editor extensions provided above can be used to execute the interactive proxy method for editor extensions provided in any of the above embodiments, and have corresponding functions and beneficial effects.

[0131] This application embodiment also provides a storage medium storing computer-executable instructions, which, when executed by a computer processor, are used to perform the interactive proxy method for editor extension as provided in the above embodiment. The interactive proxy method for editor extension includes: The interactive events generated by the editor are passed to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events; The MCP request message is obtained, and the MCP request message is converted into an API request message that matches the application interface of the editor according to a preset first mapping relationship. The API request message is then passed to the editor so that the editor can generate an API response message based on the API request message. The API response message is obtained, and the API response message is converted into an MCP response message according to a preset second mapping relationship. The MCP response message is then transmitted to the MCP tool.

[0132] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0133] Of course, the storage medium for storing computer-executable instructions provided in the embodiments of this application is not limited to the interactive proxy method for editor extension provided above, but can also execute related operations in the interactive proxy method for editor extension provided in any embodiment of this application.

[0134] The interactive proxy device, equipment, and storage medium for editor extension provided in the above embodiments can execute the interactive proxy method for editor extension provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the interactive proxy method for editor extension provided in any embodiment of this application.

[0135] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments provided herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.

Claims

1. An interaction proxy method for editor extensions, characterized in that, include: The interactive events generated by the editor are passed to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events; The MCP request message is obtained, and the MCP request message is converted into an API request message that matches the application interface of the editor according to a preset first mapping relationship. The API request message is then passed to the editor so that the editor can generate an API response message based on the API request message. The API response message is obtained, and the API response message is converted into an MCP response message according to a preset second mapping relationship. The MCP response message is then transmitted to the MCP tool.

2. The interactive proxy method for editor extension according to claim 1, characterized in that, The step of passing interactive events generated by the editor to the MCP tool includes: Ray detection is performed on the interaction event to obtain the scene node information corresponding to the interaction event; Based on the event parameters of the interaction event and the scene node information, a standard event is generated; The standard event is passed to the MCP tool.

3. The interaction proxy method for editor extension according to claim 2, characterized in that, The step of performing raycasting on the interaction event to obtain the scene node information corresponding to the interaction event includes: Obtain a preset set of custom bounding boxes, wherein each custom bounding box in the set corresponds to a scene node in the editor; Obtain the interaction position parameters corresponding to the interaction event; The interaction position parameters are respectively compared with each custom bounding box in the set of custom bounding boxes to obtain the matched custom bounding boxes; Obtain the node information of the scene node corresponding to the hit custom bounding box, and obtain the scene node information.

4. The interaction proxy method for editor extension according to claim 2, characterized in that, The step of passing the standard event to the MCP tool includes: Based on the event type of the standard event, determine the target MCP tool corresponding to the event type; The standard events are dispatched to the target MCP tool.

5. The interaction proxy method for editor extension according to claim 1, characterized in that, The step of converting the MCP request message into an API request message that matches the application programming interface of the editor according to a preset first mapping relationship includes: The MCP request message is parsed to extract the MCP protocol fields and their corresponding first field values ​​contained in the MCP request message. Based on the first mapping relationship, the MCP protocol field and the first field value are respectively mapped to the target field and the second field value that match the application interface; The target field and the value of the second field are encapsulated to obtain the API request message.

6. The interaction proxy method for editor extension according to claim 1, characterized in that, The step of converting the API response message into an MCP response message according to a preset second mapping relationship includes: The API response message is parsed to extract the API response fields contained in the API response message and their corresponding first response field values; According to the second mapping relationship, the API response field and the first response field value are respectively mapped to the corresponding MCP response field and the second response field value; The MCP response field and the value of the second response field are encapsulated to obtain the MCP response message.

7. The interaction proxy method for editor extension according to claim 1, characterized in that, Before passing the interactive events generated by the editor to the MCP tool, the following is also included: Register an event delegate on the engine view component of the editor; When the editor generates the interaction event and passes it to the engine view component, the interaction event is obtained through the event delegate.

8. An interactive proxy device for editor extensions, characterized in that, include: The transmission module is used to transmit interactive events generated by the editor to the MCP tool, so that the MCP tool can generate an MCP request message based on the interactive events; The acquisition module is used to acquire the MCP request message; The conversion module is used to convert the MCP request message into an API request message that matches the application programming interface of the editor according to a preset first mapping relationship. The transmission module is also used to transmit the API request message to the editor, so that the editor can generate an API response message based on the API request message; The acquisition module is also used to acquire the API response message; The conversion module is also used to convert the API response message into an MCP response message according to a preset second mapping relationship; The transmission module is also used to transmit the MCP response message to the MCP tool.

9. An electronic device, characterized in that, include: Memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the interactive proxy method for editor extensions as described in any one of claims 1-7.

10. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the interactive proxy method for editor extensions as described in any one of claims 1-7.