McpProjectTools.h header
#include <ew/app/McpProjectTools.h>
Namespace ew::app
McpChangeLog struct
struct ew::app::McpChangeLog
What this MCP session has changed so far, newest last – the honest transcript behind the get_recent_changes tool (docs/MCP_SERVER.md §3). Mutating tools append one entry per successful change (runMcpMutation does it for them).
Members
QStringList ew::app::McpChangeLog::entries
One line per applied change, in the order they happened.
Functions
BundleEnvironment ew::app::mcpBundleEnvironment(const QString &bundlePath)
The bundle environment for the MCP server's own working-copy namespace: identical to Workspace::defaultBundleEnvironment except working copies live under "workingcopies-mcp", so a bundle opened by both the desktop app and this server NEVER shares a working copy – each process repacks the .ewriter file atomically and sees the other's edits through the external-change reconcile (docs/MCP_SERVER.md §1).
void ew::app::registerMcpCoreTools(McpServer &server, Workspace &workspace, McpChangeLog &log)
Registers the cross-cutting project tools every Easy Writer MCP session gets (docs/MCP_SERVER.md §3): save_project (explicit save), undo_last (undoes the most recent change – one tool call = one undo step – and saves), and get_recent_changes (what this session changed so far). workspace and log must outlive server.
McpToolResult ew::app::runMcpMutation(Workspace &workspace, McpChangeLog &log, const QString &label, const std::function< McpToolResult()> &body)
Runs one mutating tool body as a single undo group named label, then saves the project (every MCP mutation persists immediately so a concurrently open desktop app sees it promptly). On success the outcome text is appended to log. A body that fails after pushing commands is rolled back (the partial group is undone), so a tool either applies wholly or not at all – handlers should still validate before pushing (the conversion engines' pattern); the rollback is the safety net, not the plan. A successful body whose save then fails reports ok == false with the change still applied in memory and undoable.