godot-agent-tools-mcp 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.mjs +18 -3
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CallToolRequestSchema,
|
|
9
9
|
ListToolsRequestSchema,
|
|
10
10
|
ListResourcesRequestSchema,
|
|
11
|
+
ListResourceTemplatesRequestSchema,
|
|
11
12
|
ReadResourceRequestSchema,
|
|
12
13
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
13
14
|
import net from "node:net";
|
|
@@ -1309,7 +1310,7 @@ class GodotClient {
|
|
|
1309
1310
|
const client = new GodotClient(HOST);
|
|
1310
1311
|
|
|
1311
1312
|
const server = new Server(
|
|
1312
|
-
{ name: "godot-agent-tools", version: "0.3.
|
|
1313
|
+
{ name: "godot-agent-tools", version: "0.3.1" },
|
|
1313
1314
|
{ capabilities: { tools: {}, resources: {} } }
|
|
1314
1315
|
);
|
|
1315
1316
|
|
|
@@ -1382,9 +1383,14 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
1382
1383
|
// session_list / session_activate are shim-local — they manage the MCP shim's
|
|
1383
1384
|
// own routing state and don't forward to any Godot process.
|
|
1384
1385
|
if (tool.method === "__local__.session_list") {
|
|
1385
|
-
const
|
|
1386
|
+
const all = listSessions();
|
|
1387
|
+
// Default target is the most-recently-started session (all[0]). Compare by
|
|
1388
|
+
// pid — listSessions() returns freshly-parsed objects each call, so object
|
|
1389
|
+
// identity (s === listSessions()[0]) would never hold.
|
|
1390
|
+
const defaultPid = all.length > 0 ? all[0].pid : null;
|
|
1391
|
+
const sessions = all.map((s) => ({
|
|
1386
1392
|
...s,
|
|
1387
|
-
active: activeSessionPid != null ? s.pid === activeSessionPid : s ===
|
|
1393
|
+
active: activeSessionPid != null ? s.pid === activeSessionPid : s.pid === defaultPid,
|
|
1388
1394
|
}));
|
|
1389
1395
|
return {
|
|
1390
1396
|
content: [{ type: "text", text: JSON.stringify({ sessions, count: sessions.length, active_pid: activeSessionPid }, null, 2) }],
|
|
@@ -1431,6 +1437,15 @@ server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
|
1431
1437
|
})),
|
|
1432
1438
|
}));
|
|
1433
1439
|
|
|
1440
|
+
// resources/templates/list — this server exposes only fixed-URI resources, not
|
|
1441
|
+
// URI templates. But MCP clients (e.g. VS Code's Continue plugin) probe this
|
|
1442
|
+
// method during connection setup; without a handler the SDK answers -32601
|
|
1443
|
+
// "Method not found", which Continue surfaces as a scary "Error loading resource
|
|
1444
|
+
// templates" prompt. Answer with an empty template list so the probe succeeds.
|
|
1445
|
+
server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({
|
|
1446
|
+
resourceTemplates: [],
|
|
1447
|
+
}));
|
|
1448
|
+
|
|
1434
1449
|
server.setRequestHandler(ReadResourceRequestSchema, async (req) => {
|
|
1435
1450
|
const resource = RESOURCE_BY_URI[req.params.uri];
|
|
1436
1451
|
if (!resource) {
|