ezEngine Release 26.9
Loading...
Searching...
No Matches
ezMcpToolProvider Class Referenceabstract

Base class for everything that the MCP server exposes to AI agents. More...

#include <McpTool.h>

Inheritance diagram for ezMcpToolProvider:

Public Member Functions

virtual void OnActivate ()
 Called once, right after the provider was instantiated. Use it to hook into the editor.
 
virtual void OnDeactivate ()
 Called once, before the provider is destroyed.
 
virtual void GetSupportedTools (ezDynamicArray< ezMcpToolDesc > &out_tools) const =0
 Appends the description of every tool that this provider implements.
 
virtual void Execute (ezStringView sToolName, const ezVariantDictionary &arguments, ezMcpToolResult &out_result)=0
 Executes one of the tools returned by GetSupportedTools().
 
- Public Member Functions inherited from ezReflectedClass
virtual const ezRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const ezRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
EZ_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Additional Inherited Members

- Static Public Member Functions inherited from ezNoBase
static const ezRTTIGetStaticRTTI ()
 

Detailed Description

Base class for everything that the MCP server exposes to AI agents.

One provider offers one or more tools, which is why they are grouped: 'log_write' and 'log_read' share a ring buffer, so they belong to the same object.

Providers are found through reflection, so any plugin can add its own simply by deriving from this class - there is no list to register with. The plugin only has to link against the Mcp library, which works on both sides: an editor plugin adds editor tools, a runtime plugin adds tools to the game process. See ezMcpLogTool for the smallest complete example.

Everything happens on the main thread, so implementations may touch the host directly.

Member Function Documentation

◆ Execute()

virtual void ezMcpToolProvider::Execute ( ezStringView  sToolName,
const ezVariantDictionary arguments,
ezMcpToolResult out_result 
)
pure virtual

Executes one of the tools returned by GetSupportedTools().

Parameters
sToolNameThe tool to run. A provider with a single tool may ignore this.
argumentsThe 'arguments' object of the call. Missing and mistyped values are normal - the client is an AI and will get this wrong. Validate and report through out_result.

Implemented in ezMcpActionTool, ezMcpAssetTool, ezMcpCppTool, ezMcpDocumentTool, ezMcpObjectTool, ezMcpProjectTool, ezMcpSelectionTool, ezMcpAppTool, ezMcpCVarTool, ezMcpLogTool, ezMcpRttiTool, ezMcpEngineAppTool, ezMcpGameTool, and ezMcpInputTool.

◆ GetSupportedTools()

virtual void ezMcpToolProvider::GetSupportedTools ( ezDynamicArray< ezMcpToolDesc > &  out_tools) const
pure virtual

◆ OnActivate()

virtual void ezMcpToolProvider::OnActivate ( )
inlinevirtual

Called once, right after the provider was instantiated. Use it to hook into the editor.

Reimplemented in ezMcpAssetTool, ezMcpLogTool, and ezMcpInputTool.

◆ OnDeactivate()

virtual void ezMcpToolProvider::OnDeactivate ( )
inlinevirtual

Called once, before the provider is destroyed.

Reimplemented in ezMcpAssetTool, ezMcpLogTool, ezMcpEngineAppTool, and ezMcpInputTool.


The documentation for this class was generated from the following file: