Skip to content

Commit 8bd1a20

Browse files
committed
DPL MCP: expose the version in the MCP
This allows your favourite LLM to spot missing recompilations.
1 parent a4bd6bc commit 8bd1a20

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Framework/Core/scripts/dpl-mcp-server/dpl_mcp_server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ async def connect(port: int = 0, pid: int = 0, name: str = "") -> str:
190190
_workflows[wf_name] = conn
191191

192192
devices = conn.snapshot.get("devices", [])
193+
version = conn.snapshot.get("version", "unknown")
193194
return (
194195
f"Connected to workflow '{wf_name}' on port {port} "
195-
f"({len(devices)} device(s))."
196+
f"({len(devices)} device(s), version: {version})."
196197
)
197198

198199

@@ -232,9 +233,10 @@ async def connect_hyperloop(url: str, name: str = "", token: str = "") -> str:
232233
_workflows[wf_name] = conn
233234

234235
devices = conn.snapshot.get("devices", [])
236+
version = conn.snapshot.get("version", "unknown")
235237
return (
236238
f"Connected to Hyperloop workflow '{wf_name}' via {ws_url} "
237-
f"({len(devices)} device(s))."
239+
f"({len(devices)} device(s), version: {version})."
238240
)
239241

240242

Framework/Core/src/StatusWebSocketHandler.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "Framework/DeviceStateEnums.h"
2424
#include "Framework/LogParsingHelpers.h"
2525
#include "Framework/Signpost.h"
26+
#include "O2Version.h"
2627
#include <algorithm>
2728
#include <cstdio>
2829
#include <string>
@@ -286,7 +287,9 @@ void StatusWebSocketHandler::sendSnapshot()
286287

287288
std::string out;
288289
out.reserve(512 + specs.size() * 128);
289-
out += R"({"type":"snapshot","devices":[)";
290+
out += R"({"type":"snapshot","version":")";
291+
out += jsonEscape(o2::gitRevision());
292+
out += R"(","devices":[)";
290293
for (size_t di = 0; di < specs.size(); ++di) {
291294
if (di > 0) {
292295
out += ',';

0 commit comments

Comments
 (0)