ezEngine Release 26.9
Loading...
Searching...
No Matches
ezMcpEngineAppTool Class Reference

The game process' half of the shared app_* tools, plus taking a screenshot. More...

#include <McpEngineAppTool.h>

Inheritance diagram for ezMcpEngineAppTool:

Public Member Functions

virtual void OnDeactivate () override
 Called once, before the provider is destroyed.
 
virtual void GetSupportedTools (ezDynamicArray< ezMcpToolDesc > &out_tools) const override
 Appends the description of every tool that this provider implements.
 
virtual void Execute (ezStringView sToolName, const ezVariantDictionary &arguments, ezMcpToolResult &out_result) override
 Executes one of the tools returned by GetSupportedTools().
 
- Public Member Functions inherited from ezMcpToolProvider
virtual void OnActivate ()
 Called once, right after the provider was instantiated. Use it to hook into the editor.
 
- 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.
 

Protected Member Functions

virtual ezStringView GetHostNoun () const override
 What this process is, e.g. "editor" or "game". Used in the tool descriptions, so that an agent talking to two servers at once can tell which one it is addressing.
 
virtual ezStringView GetRelaunchHint () const override
 How to start another process like this one, appended to app_quit's description.
 
virtual ezStringView GetBuildTimestamp () const override
 When the binary serving MCP was compiled, reported by app_info as 'buildTimestamp'.
 
virtual void AddHostInfo (ezMcpJsonWriter &ref_writer) override
 Anything host specific that app_info should report, added to the same object.
 
virtual void RequestQuit (bool bDiscardChanges) override
 Actually shuts the process down.
 
- Protected Member Functions inherited from ezMcpAppTool
virtual ezResult CanQuit (bool bDiscardChanges)
 Whether quitting is allowed right now. Return EZ_FAILURE to refuse.
 
virtual void AddQuitRefusalInfo (ezMcpJsonWriter &ref_writer)
 Explains a refusal from CanQuit(). Writes into the result object, after "quitting": false.
 
virtual void AddQuitInfo (ezMcpJsonWriter &ref_writer)
 Anything worth reporting about a quit that is going ahead, e.g. what got discarded.
 

Additional Inherited Members

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

Detailed Description

The game process' half of the shared app_* tools, plus taking a screenshot.

The process level questions - port, executable, command line, process id - are answered by the base class, so an agent driving both an editor and the game it runs asks them the same way in both. What is added here is what only a rendering, frame-stepping process can answer.

Member Function Documentation

◆ AddHostInfo()

void ezMcpEngineAppTool::AddHostInfo ( ezMcpJsonWriter ref_writer)
overrideprotectedvirtual

Anything host specific that app_info should report, added to the same object.

Reimplemented from ezMcpAppTool.

◆ Execute()

void ezMcpEngineAppTool::Execute ( ezStringView  sToolName,
const ezVariantDictionary arguments,
ezMcpToolResult out_result 
)
overridevirtual

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.

Reimplemented from ezMcpAppTool.

◆ GetBuildTimestamp()

ezStringView ezMcpEngineAppTool::GetBuildTimestamp ( ) const
overrideprotectedvirtual

When the binary serving MCP was compiled, reported by app_info as 'buildTimestamp'.

Exists because a stale binary is indistinguishable from a missing feature: an agent working from a tools/list produced by a build from a few days ago reports tools as absent, and nothing in the protocol reveals the mismatch. Comparing this against when the source was last changed does.

The default is when the Mcp library itself was built. A host whose own plugin changes more often than the library should override this with its own DATE " " TIME - the tool list comes from the plugin, so that is the binary whose age actually explains a missing tool.

Reimplemented from ezMcpAppTool.

◆ GetHostNoun()

virtual ezStringView ezMcpEngineAppTool::GetHostNoun ( ) const
inlineoverrideprotectedvirtual

What this process is, e.g. "editor" or "game". Used in the tool descriptions, so that an agent talking to two servers at once can tell which one it is addressing.

Implements ezMcpAppTool.

◆ GetRelaunchHint()

ezStringView ezMcpEngineAppTool::GetRelaunchHint ( ) const
overrideprotectedvirtual

How to start another process like this one, appended to app_quit's description.

Everything an agent needs has to be in the tool list - it has no repo access and no prior session - so this is where 'which executable, which arguments' gets said.

Implements ezMcpAppTool.

◆ GetSupportedTools()

void ezMcpEngineAppTool::GetSupportedTools ( ezDynamicArray< ezMcpToolDesc > &  out_tools) const
overridevirtual

Appends the description of every tool that this provider implements.

Reimplemented from ezMcpAppTool.

◆ OnDeactivate()

void ezMcpEngineAppTool::OnDeactivate ( )
overridevirtual

Called once, before the provider is destroyed.

Reimplemented from ezMcpToolProvider.

◆ RequestQuit()

void ezMcpEngineAppTool::RequestQuit ( bool  bDiscardChanges)
overrideprotectedvirtual

Actually shuts the process down.

Must defer the shutdown past the end of this call. The response has not reached the socket yet, so quitting synchronously drops it and leaves the caller waiting on a connection that closes with no answer - which is indistinguishable from a crash.

Implements ezMcpAppTool.


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