robloxstudio-mcp 2.7.0-next.2 → 2.7.0-next.4

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2496,55 +2496,70 @@ ${code}`
2496
2496
  }]
2497
2497
  };
2498
2498
  }
2499
+ async resolveImageId(decalAssetId) {
2500
+ try {
2501
+ const resp = await fetch(`https://economy.roblox.com/v2/assets/${decalAssetId}/details`);
2502
+ if (!resp.ok)
2503
+ return decalAssetId;
2504
+ const details = await resp.json();
2505
+ if (details.TextureId)
2506
+ return String(details.TextureId);
2507
+ } catch {
2508
+ }
2509
+ return decalAssetId;
2510
+ }
2499
2511
  async uploadDecal(filePath, displayName, description, userId, groupId) {
2500
2512
  if (!fs.existsSync(filePath)) {
2501
2513
  throw new Error(`File not found: ${filePath}`);
2502
2514
  }
2503
2515
  const fileContent = fs.readFileSync(filePath);
2504
2516
  const fileName = path.basename(filePath);
2517
+ const resolvedGroupId = groupId || process.env.ROBLOX_CREATOR_GROUP_ID;
2518
+ const resolvedUserId = userId || process.env.ROBLOX_CREATOR_USER_ID;
2519
+ if (this.openCloudClient.hasApiKey() && (resolvedUserId || resolvedGroupId)) {
2520
+ const creator = {};
2521
+ if (resolvedGroupId) {
2522
+ creator.groupId = resolvedGroupId;
2523
+ } else {
2524
+ creator.userId = resolvedUserId;
2525
+ }
2526
+ const result = await this.openCloudClient.createAsset({
2527
+ assetType: "Decal",
2528
+ displayName,
2529
+ description: description || "",
2530
+ creationContext: { creator }
2531
+ }, fileContent, fileName);
2532
+ const decalId = result.response?.assetId;
2533
+ const imageId = decalId ? await this.resolveImageId(decalId) : void 0;
2534
+ return {
2535
+ content: [{
2536
+ type: "text",
2537
+ text: JSON.stringify({
2538
+ ...result,
2539
+ imageId
2540
+ })
2541
+ }]
2542
+ };
2543
+ }
2505
2544
  if (this.cookieClient.hasCookie()) {
2506
- const result2 = await this.cookieClient.uploadDecal(fileContent, displayName, description || "");
2545
+ const result = await this.cookieClient.uploadDecal(fileContent, displayName, description || "");
2507
2546
  return {
2508
2547
  content: [{
2509
2548
  type: "text",
2510
2549
  text: JSON.stringify({
2511
2550
  done: true,
2512
2551
  response: {
2513
- assetId: String(result2.assetId),
2552
+ assetId: String(result.assetId),
2514
2553
  displayName,
2515
2554
  assetType: "Decal",
2516
- backingAssetId: String(result2.backingAssetId)
2555
+ backingAssetId: String(result.backingAssetId),
2556
+ imageId: String(result.backingAssetId)
2517
2557
  }
2518
2558
  })
2519
2559
  }]
2520
2560
  };
2521
2561
  }
2522
- if (!this.openCloudClient.hasApiKey()) {
2523
- throw new Error("No auth configured for asset upload. Set ROBLOSECURITY env var (recommended) or ROBLOX_OPEN_CLOUD_API_KEY.");
2524
- }
2525
- const resolvedGroupId = groupId || process.env.ROBLOX_CREATOR_GROUP_ID;
2526
- const resolvedUserId = userId || process.env.ROBLOX_CREATOR_USER_ID;
2527
- if (!resolvedUserId && !resolvedGroupId) {
2528
- throw new Error("Creator identity required for Open Cloud upload. Set ROBLOX_CREATOR_USER_ID or ROBLOX_CREATOR_GROUP_ID, or pass userId/groupId as parameters. Alternatively, set ROBLOSECURITY to use cookie auth instead.");
2529
- }
2530
- const creator = {};
2531
- if (resolvedGroupId) {
2532
- creator.groupId = resolvedGroupId;
2533
- } else {
2534
- creator.userId = resolvedUserId;
2535
- }
2536
- const result = await this.openCloudClient.createAsset({
2537
- assetType: "Decal",
2538
- displayName,
2539
- description: description || "",
2540
- creationContext: { creator }
2541
- }, fileContent, fileName);
2542
- return {
2543
- content: [{
2544
- type: "text",
2545
- text: JSON.stringify(result)
2546
- }]
2547
- };
2562
+ throw new Error("No auth configured for asset upload. Set ROBLOX_OPEN_CLOUD_API_KEY + ROBLOX_CREATOR_USER_ID (recommended) or ROBLOSECURITY env var.");
2548
2563
  }
2549
2564
  async uploadAsset(filePath, assetType, displayName, description, userId, groupId) {
2550
2565
  if (!fs.existsSync(filePath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robloxstudio-mcp",
3
- "version": "2.7.0-next.2",
3
+ "version": "2.7.0-next.4",
4
4
  "description": "MCP Server for Roblox Studio Integration - Access Studio data, scripts, and objects through AI tools",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",