@fre4x/grok 1.0.51 → 1.0.52

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 +53 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44480,15 +44480,21 @@ async function handleToolCall(name, args, client = xaiClient) {
44480
44480
  );
44481
44481
  let extraText = "";
44482
44482
  if (output_dir) {
44483
- const fname = `grok-x-search-${Date.now()}.json`;
44484
- const fpath = await saveFile(
44485
- output_dir,
44486
- fname,
44487
- JSON.stringify(output, null, 2)
44488
- );
44489
- extraText = `
44483
+ try {
44484
+ const fname = `grok-x-search-${Date.now()}.json`;
44485
+ const fpath = await saveFile(
44486
+ output_dir,
44487
+ fname,
44488
+ JSON.stringify(output, null, 2)
44489
+ );
44490
+ extraText = `
44490
44491
 
44491
44492
  \u2705 Results saved to: ${fpath}`;
44493
+ } catch (error48) {
44494
+ extraText = `
44495
+
44496
+ \u26A0\uFE0F Failed to save results: ${error48.message}`;
44497
+ }
44492
44498
  }
44493
44499
  return toolResult(renderXSearch(output) + extraText, output);
44494
44500
  }
@@ -44517,15 +44523,21 @@ async function handleToolCall(name, args, client = xaiClient) {
44517
44523
  );
44518
44524
  let extraText = "";
44519
44525
  if (output_dir) {
44520
- const fname = `grok-web-search-${Date.now()}.json`;
44521
- const fpath = await saveFile(
44522
- output_dir,
44523
- fname,
44524
- JSON.stringify(output, null, 2)
44525
- );
44526
- extraText = `
44526
+ try {
44527
+ const fname = `grok-web-search-${Date.now()}.json`;
44528
+ const fpath = await saveFile(
44529
+ output_dir,
44530
+ fname,
44531
+ JSON.stringify(output, null, 2)
44532
+ );
44533
+ extraText = `
44527
44534
 
44528
44535
  \u2705 Results saved to: ${fpath}`;
44536
+ } catch (error48) {
44537
+ extraText = `
44538
+
44539
+ \u26A0\uFE0F Failed to save results: ${error48.message}`;
44540
+ }
44529
44541
  }
44530
44542
  return toolResult(renderWebSearch(output) + extraText, output);
44531
44543
  }
@@ -44556,19 +44568,25 @@ async function handleToolCall(name, args, client = xaiClient) {
44556
44568
  const mediaContent = mediaResults.map((r) => r.content);
44557
44569
  let extraText = "";
44558
44570
  if (output_dir && mediaResults.length > 0) {
44559
- const savedPaths = await Promise.all(
44560
- mediaResults.map(
44561
- (res, i) => saveFile(
44562
- output_dir,
44563
- `imagine-${Date.now()}-${i + 1}.png`,
44564
- res.buffer
44571
+ try {
44572
+ const savedPaths = await Promise.all(
44573
+ mediaResults.map(
44574
+ (res, i) => saveFile(
44575
+ output_dir,
44576
+ `imagine-${Date.now()}-${i + 1}.png`,
44577
+ res.buffer
44578
+ )
44565
44579
  )
44566
- )
44567
- );
44568
- extraText = `
44580
+ );
44581
+ extraText = `
44569
44582
 
44570
44583
  \u2705 Images saved to:
44571
44584
  ${savedPaths.join("\n")}`;
44585
+ } catch (error48) {
44586
+ extraText = `
44587
+
44588
+ \u26A0\uFE0F Failed to save images: ${error48.message}`;
44589
+ }
44572
44590
  }
44573
44591
  return toolResult(
44574
44592
  renderImagine(output) + extraText,
@@ -44614,14 +44632,20 @@ ${savedPaths.join("\n")}`;
44614
44632
  if (mediaRes) {
44615
44633
  mediaContent = [mediaRes.content];
44616
44634
  if (output_dir) {
44617
- const fpath = await saveFile(
44618
- output_dir,
44619
- `video-${Date.now()}.mp4`,
44620
- mediaRes.buffer
44621
- );
44622
- extraText = `
44635
+ try {
44636
+ const fpath = await saveFile(
44637
+ output_dir,
44638
+ `video-${Date.now()}.mp4`,
44639
+ mediaRes.buffer
44640
+ );
44641
+ extraText = `
44623
44642
 
44624
44643
  \u2705 Video saved to: ${fpath}`;
44644
+ } catch (error48) {
44645
+ extraText = `
44646
+
44647
+ \u26A0\uFE0F Failed to save video: ${error48.message}`;
44648
+ }
44625
44649
  }
44626
44650
  }
44627
44651
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/grok",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "An MCP server for xAI (Grok) with search and generation capabilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",