sbox-mcp-server 1.12.0 → 1.13.0

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.
@@ -24,9 +24,8 @@ export function registerComponentTools(server, bridge) {
24
24
  };
25
25
  });
26
26
  // ── get_all_properties ───────────────────────────────────────────
27
- server.tool("get_all_properties", "Dump all public properties of a component as JSON names, types, and current values", {
27
+ server.tool("get_all_properties", "Dump all public properties of every component on a GameObject as JSON -- names, types, and current values", {
28
28
  id: z.string().describe("GUID of the GameObject"),
29
- component: z.string().describe("Component type name"),
30
29
  }, async (params) => {
31
30
  const res = await bridge.send("get_all_properties", params);
32
31
  if (!res.success) {
@@ -378,5 +378,59 @@ export function registerGameplayTools(server, bridge) {
378
378
  }
379
379
  return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
380
380
  });
381
+ // -- create_leaderboard_panel ------------------------------------------
382
+ server.tool("create_leaderboard_panel", "Generate a Razor PanelComponent that fetches and displays a Sandbox.Services leaderboard derived from a stat name. Produces TWO files: {name}.razor and {name}.razor.scss. The panel auto-refreshes every 30 s, shows rank/displayName/value rows, handles loading state, and includes a BuildHash() override (razor-lint clean). Must be hosted under a ScreenPanel or WorldPanel. Stats must be configured for the project ident on sbox.game. Uses Leaderboards.Get(statName) + board.Refresh() -- the exact API from ServicesQueryHandler.", {
383
+ name: z.string().optional().describe("Class name for the panel component. Defaults to 'LeaderboardPanel'"),
384
+ directory: z.string().optional().describe("Subdirectory for the generated files. Defaults to 'Code/UI'"),
385
+ statName: z.string().optional().describe("Sandbox.Services stat name the leaderboard is derived from. Defaults to 'score'"),
386
+ title: z.string().optional().describe("Display title shown at the top of the panel. Defaults to 'Leaderboard'"),
387
+ maxRows: z.number().int().optional().describe("Maximum leaderboard rows to fetch and display. Defaults to 10"),
388
+ }, async (params) => {
389
+ const res = await bridge.send("create_leaderboard_panel", params);
390
+ if (!res.success) {
391
+ return { content: [{ type: "text", text: `Error: ${res.error}` }] };
392
+ }
393
+ return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
394
+ });
395
+ // -- create_inventory --------------------------------------------------
396
+ server.tool("create_inventory", "Generate a slot-based inventory component using parallel List<string> ItemIds / List<int> Counts (serialization-safe, inspector-editable). Includes TryAdd (stack-first, partial-add rejected), TryRemove, CountOf, Move (swap or merge same-id slots), and Clear. Static OnChanged event fires after every successful mutation. Host-authoritative usage note: mutate on the host in multiplayer, replicate via your own [Sync]/RPC. Pairs with create_pickup.", {
397
+ name: z.string().optional().describe("Class name. Defaults to 'Inventory'"),
398
+ directory: z.string().optional().describe("Subdirectory for the .cs file. Defaults to 'Code'"),
399
+ capacity: z.number().int().optional().describe("Total slot count. Defaults to 24"),
400
+ maxStack: z.number().int().optional().describe("Maximum items per slot (stack cap). Defaults to 99"),
401
+ targetId: z.string().optional().describe("GUID of an existing GameObject to attach to (hotload first)"),
402
+ }, async (params) => {
403
+ const res = await bridge.send("create_inventory", params);
404
+ if (!res.success) {
405
+ return { content: [{ type: "text", text: `Error: ${res.error}` }] };
406
+ }
407
+ return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
408
+ });
409
+ // -- create_stat_modifier_system ---------------------------------------
410
+ server.tool("create_stat_modifier_system", "Generate an enum-keyed stat modifier system with three modifier layers: SET (highest-priority-wins hard override), ADD (summed bonuses), MULT (multiplied factors applied last). Modifier storage uses parallel private Lists of primitive types (serialization-safe). RemoveModifiersFrom(source) cleans up all mods from a buff/debuff source by reference. Static OnStatChanged(stat, value) event fires after every add/remove. Mined from RPG/buff/debuff patterns across shipped s&box games.", {
411
+ name: z.string().optional().describe("Class name prefix -- generates {name}Stat enum + {name} Component. Defaults to 'StatSystem'"),
412
+ directory: z.string().optional().describe("Subdirectory for the .cs file. Defaults to 'Code'"),
413
+ stats: z.union([z.array(z.string()), z.string()]).optional().describe("Stat names as a JSON array or comma-separated string. Defaults to 'Health,Speed,Damage'"),
414
+ targetId: z.string().optional().describe("GUID of an existing GameObject to attach to (hotload first)"),
415
+ }, async (params) => {
416
+ const res = await bridge.send("create_stat_modifier_system", params);
417
+ if (!res.success) {
418
+ return { content: [{ type: "text", text: `Error: ${res.error}` }] };
419
+ }
420
+ return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
421
+ });
422
+ // -- create_placement_mode ---------------------------------------------
423
+ server.tool("create_placement_mode", "Generate a ghost-preview + commit placement component (single class). StartPlacing() clones GhostPrefab as a NetworkMode.Never preview with colliders disabled and ModelRenderers tinted semi-transparent. Each frame while placing: ray from Scene.Camera.GetMouseRay(), IgnoreGameObjectHierarchy(ghost), snap hit position to GridSize (0 = freeform), move ghost. On Input.Pressed('attack1') TryPlace() re-validates distance and commits a real clone. StopPlacing() destroys the ghost. Static OnPlaced(GameObject, Vector3) event. Includes a multiplayer RPC note. API grounded in building-placement cookbook (enifun.shop_manager pattern).", {
424
+ name: z.string().optional().describe("Class name. Defaults to 'PlacementMode'"),
425
+ directory: z.string().optional().describe("Subdirectory for the .cs file. Defaults to 'Code'"),
426
+ gridSize: z.number().optional().describe("Snap grid size in world units (0 = freeform placement). Defaults to 0"),
427
+ targetId: z.string().optional().describe("GUID of an existing GameObject to attach to (hotload first)"),
428
+ }, async (params) => {
429
+ const res = await bridge.send("create_placement_mode", params);
430
+ if (!res.success) {
431
+ return { content: [{ type: "text", text: `Error: ${res.error}` }] };
432
+ }
433
+ return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
434
+ });
381
435
  }
382
436
  //# sourceMappingURL=gameplay.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbox-mcp-server",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "MCP Server for s&box game engine — enables Claude to build games through conversation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",