@fre4x/grok 1.1.0-beta.3 → 1.1.0-beta.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.
- package/README.md +6 -6
- package/dist/index.js +78 -49
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,15 +10,15 @@ xAI's Grok is more than an LLM. It's a real-time sensor for the global conscious
|
|
|
10
10
|
|
|
11
11
|
| Tool | Capability |
|
|
12
12
|
|------|------------|
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
13
|
+
| `search_x` | Search X posts and threads with optional date and handle filters |
|
|
14
|
+
| `search_web` | Search the public web with optional domain filters |
|
|
15
|
+
| `generate_image` | Generate high-quality images from text prompts |
|
|
16
|
+
| `generate_video` | Start an asynchronous video generation task |
|
|
17
|
+
| `get_video_status` | Check the status of a video generation task |
|
|
18
18
|
|
|
19
19
|
Search tools support `limit` and `offset` pagination and return normalized results with citations.
|
|
20
20
|
|
|
21
|
-
`
|
|
21
|
+
`search_x` accepts `allowed_x_handles`, `excluded_x_handles`, `from_date`, `to_date`, `enable_image_understanding`, and `enable_video_understanding`. `search_web` accepts `allowed_domains`, `excluded_domains`, and `enable_image_understanding`. Include and exclude filters are mutually exclusive per tool, and web domain filters follow xAI's max-5 constraint.
|
|
22
22
|
|
|
23
23
|
Image generation responses include direct MCP `image` content blocks when media can be embedded. Video responses include direct MCP embedded `resource` blobs because MCP does not define a dedicated `video` content block.
|
|
24
24
|
|
package/dist/index.js
CHANGED
|
@@ -36556,7 +36556,7 @@ function object2(shape, params) {
|
|
|
36556
36556
|
return new ZodMiniObject(def);
|
|
36557
36557
|
}
|
|
36558
36558
|
|
|
36559
|
-
//
|
|
36559
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
36560
36560
|
function isZ4Schema(s) {
|
|
36561
36561
|
const schema = s;
|
|
36562
36562
|
return !!schema._zod;
|
|
@@ -36700,7 +36700,7 @@ function getLiteralValue(schema) {
|
|
|
36700
36700
|
return void 0;
|
|
36701
36701
|
}
|
|
36702
36702
|
|
|
36703
|
-
//
|
|
36703
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
36704
36704
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
36705
36705
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
36706
36706
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -36710,10 +36710,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
|
36710
36710
|
var CursorSchema = string2();
|
|
36711
36711
|
var TaskCreationParamsSchema = looseObject({
|
|
36712
36712
|
/**
|
|
36713
|
-
*
|
|
36714
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
36713
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
36715
36714
|
*/
|
|
36716
|
-
ttl:
|
|
36715
|
+
ttl: number2().optional(),
|
|
36717
36716
|
/**
|
|
36718
36717
|
* Time in milliseconds to wait between task status requests.
|
|
36719
36718
|
*/
|
|
@@ -37013,7 +37012,11 @@ var ClientCapabilitiesSchema = object({
|
|
|
37013
37012
|
/**
|
|
37014
37013
|
* Present if the client supports task creation.
|
|
37015
37014
|
*/
|
|
37016
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
37015
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
37016
|
+
/**
|
|
37017
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
37018
|
+
*/
|
|
37019
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
37017
37020
|
});
|
|
37018
37021
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
37019
37022
|
/**
|
|
@@ -37074,7 +37077,11 @@ var ServerCapabilitiesSchema = object({
|
|
|
37074
37077
|
/**
|
|
37075
37078
|
* Present if the server supports task creation.
|
|
37076
37079
|
*/
|
|
37077
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
37080
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
37081
|
+
/**
|
|
37082
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
37083
|
+
*/
|
|
37084
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
37078
37085
|
});
|
|
37079
37086
|
var InitializeResultSchema = ResultSchema.extend({
|
|
37080
37087
|
/**
|
|
@@ -37266,6 +37273,12 @@ var ResourceSchema = object({
|
|
|
37266
37273
|
* The MIME type of this resource, if known.
|
|
37267
37274
|
*/
|
|
37268
37275
|
mimeType: optional(string2()),
|
|
37276
|
+
/**
|
|
37277
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
37278
|
+
*
|
|
37279
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
37280
|
+
*/
|
|
37281
|
+
size: optional(number2()),
|
|
37269
37282
|
/**
|
|
37270
37283
|
* Optional annotations for the client.
|
|
37271
37284
|
*/
|
|
@@ -38218,7 +38231,7 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
38218
38231
|
}
|
|
38219
38232
|
};
|
|
38220
38233
|
|
|
38221
|
-
//
|
|
38234
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
38222
38235
|
function isTerminal(status) {
|
|
38223
38236
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
38224
38237
|
}
|
|
@@ -39507,7 +39520,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
39507
39520
|
return combined;
|
|
39508
39521
|
};
|
|
39509
39522
|
|
|
39510
|
-
//
|
|
39523
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
39511
39524
|
function mapMiniTarget(t) {
|
|
39512
39525
|
if (!t)
|
|
39513
39526
|
return "draft-7";
|
|
@@ -39549,7 +39562,7 @@ function parseWithCompat(schema, data) {
|
|
|
39549
39562
|
return result.data;
|
|
39550
39563
|
}
|
|
39551
39564
|
|
|
39552
|
-
//
|
|
39565
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
39553
39566
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
39554
39567
|
var Protocol = class {
|
|
39555
39568
|
constructor(_options) {
|
|
@@ -39761,6 +39774,10 @@ var Protocol = class {
|
|
|
39761
39774
|
this._progressHandlers.clear();
|
|
39762
39775
|
this._taskProgressTokens.clear();
|
|
39763
39776
|
this._pendingDebouncedNotifications.clear();
|
|
39777
|
+
for (const info of this._timeoutInfo.values()) {
|
|
39778
|
+
clearTimeout(info.timeoutId);
|
|
39779
|
+
}
|
|
39780
|
+
this._timeoutInfo.clear();
|
|
39764
39781
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
39765
39782
|
controller.abort();
|
|
39766
39783
|
}
|
|
@@ -39891,7 +39908,9 @@ var Protocol = class {
|
|
|
39891
39908
|
await capturedTransport?.send(errorResponse);
|
|
39892
39909
|
}
|
|
39893
39910
|
}).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
|
|
39894
|
-
this._requestHandlerAbortControllers.
|
|
39911
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
39912
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
39913
|
+
}
|
|
39895
39914
|
});
|
|
39896
39915
|
}
|
|
39897
39916
|
_onprogress(notification) {
|
|
@@ -40497,7 +40516,7 @@ function mergeCapabilities(base, additional) {
|
|
|
40497
40516
|
return result;
|
|
40498
40517
|
}
|
|
40499
40518
|
|
|
40500
|
-
//
|
|
40519
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
40501
40520
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
40502
40521
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
40503
40522
|
function createDefaultAjvInstance() {
|
|
@@ -40565,7 +40584,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
40565
40584
|
}
|
|
40566
40585
|
};
|
|
40567
40586
|
|
|
40568
|
-
//
|
|
40587
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
40569
40588
|
var ExperimentalServerTasks = class {
|
|
40570
40589
|
constructor(_server) {
|
|
40571
40590
|
this._server = _server;
|
|
@@ -40778,7 +40797,7 @@ var ExperimentalServerTasks = class {
|
|
|
40778
40797
|
}
|
|
40779
40798
|
};
|
|
40780
40799
|
|
|
40781
|
-
//
|
|
40800
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
40782
40801
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
40783
40802
|
if (!requests) {
|
|
40784
40803
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -40813,7 +40832,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
40813
40832
|
}
|
|
40814
40833
|
}
|
|
40815
40834
|
|
|
40816
|
-
//
|
|
40835
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
40817
40836
|
var Server = class extends Protocol {
|
|
40818
40837
|
/**
|
|
40819
40838
|
* Initializes this server with the given name and version information.
|
|
@@ -41193,7 +41212,7 @@ var Server = class extends Protocol {
|
|
|
41193
41212
|
}
|
|
41194
41213
|
};
|
|
41195
41214
|
|
|
41196
|
-
//
|
|
41215
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
41197
41216
|
var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
|
|
41198
41217
|
function isCompletable(schema) {
|
|
41199
41218
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
@@ -41207,7 +41226,7 @@ var McpZodTypeKind;
|
|
|
41207
41226
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
41208
41227
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
41209
41228
|
|
|
41210
|
-
//
|
|
41229
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
41211
41230
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
41212
41231
|
function validateToolName(name) {
|
|
41213
41232
|
const warnings = [];
|
|
@@ -41265,7 +41284,7 @@ function validateAndWarnToolName(name) {
|
|
|
41265
41284
|
return result.isValid;
|
|
41266
41285
|
}
|
|
41267
41286
|
|
|
41268
|
-
//
|
|
41287
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
41269
41288
|
var ExperimentalMcpServerTasks = class {
|
|
41270
41289
|
constructor(_mcpServer) {
|
|
41271
41290
|
this._mcpServer = _mcpServer;
|
|
@@ -41280,7 +41299,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
41280
41299
|
}
|
|
41281
41300
|
};
|
|
41282
41301
|
|
|
41283
|
-
//
|
|
41302
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
41284
41303
|
var McpServer = class {
|
|
41285
41304
|
constructor(serverInfo, options) {
|
|
41286
41305
|
this._registeredResources = {};
|
|
@@ -41904,6 +41923,9 @@ var McpServer = class {
|
|
|
41904
41923
|
annotations = rest.shift();
|
|
41905
41924
|
}
|
|
41906
41925
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
41926
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
41927
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
41928
|
+
}
|
|
41907
41929
|
annotations = rest.shift();
|
|
41908
41930
|
}
|
|
41909
41931
|
}
|
|
@@ -42022,6 +42044,9 @@ function getZodSchemaObject(schema) {
|
|
|
42022
42044
|
if (isZodRawShapeCompat(schema)) {
|
|
42023
42045
|
return objectFromShape(schema);
|
|
42024
42046
|
}
|
|
42047
|
+
if (!isZodSchemaInstance(schema)) {
|
|
42048
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
42049
|
+
}
|
|
42025
42050
|
return schema;
|
|
42026
42051
|
}
|
|
42027
42052
|
function promptArgumentsFromSchema(schema) {
|
|
@@ -42066,10 +42091,10 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
42066
42091
|
}
|
|
42067
42092
|
};
|
|
42068
42093
|
|
|
42069
|
-
//
|
|
42094
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
42070
42095
|
import process3 from "node:process";
|
|
42071
42096
|
|
|
42072
|
-
//
|
|
42097
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
42073
42098
|
var ReadBuffer = class {
|
|
42074
42099
|
append(chunk) {
|
|
42075
42100
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
@@ -42097,7 +42122,7 @@ function serializeMessage(message) {
|
|
|
42097
42122
|
return JSON.stringify(message) + "\n";
|
|
42098
42123
|
}
|
|
42099
42124
|
|
|
42100
|
-
//
|
|
42125
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
42101
42126
|
var StdioServerTransport = class {
|
|
42102
42127
|
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
42103
42128
|
this._stdin = _stdin;
|
|
@@ -45941,7 +45966,7 @@ import https2 from "node:https";
|
|
|
45941
45966
|
// src/mock.ts
|
|
45942
45967
|
var IS_MOCK = process.env.MOCK === "true" || process.env.GROK_MOCK === "true";
|
|
45943
45968
|
var MOCK_FIXTURES = {
|
|
45944
|
-
|
|
45969
|
+
search_x: {
|
|
45945
45970
|
id: "mock_resp_1",
|
|
45946
45971
|
model: "grok-4-1-fast-reasoning",
|
|
45947
45972
|
output: [
|
|
@@ -45990,7 +46015,7 @@ var MOCK_FIXTURES = {
|
|
|
45990
46015
|
}
|
|
45991
46016
|
]
|
|
45992
46017
|
},
|
|
45993
|
-
|
|
46018
|
+
search_web: {
|
|
45994
46019
|
id: "mock_resp_2",
|
|
45995
46020
|
model: "grok-4-1-fast-reasoning",
|
|
45996
46021
|
output: [
|
|
@@ -46035,7 +46060,7 @@ var MOCK_FIXTURES = {
|
|
|
46035
46060
|
}
|
|
46036
46061
|
]
|
|
46037
46062
|
},
|
|
46038
|
-
|
|
46063
|
+
generate_image: {
|
|
46039
46064
|
data: [
|
|
46040
46065
|
{
|
|
46041
46066
|
url: "https://api.x.ai/v1/images/mock_image_123.png",
|
|
@@ -46043,11 +46068,11 @@ var MOCK_FIXTURES = {
|
|
|
46043
46068
|
}
|
|
46044
46069
|
]
|
|
46045
46070
|
},
|
|
46046
|
-
|
|
46071
|
+
generate_video: {
|
|
46047
46072
|
request_id: "vid_mock_987",
|
|
46048
46073
|
status: "processing"
|
|
46049
46074
|
},
|
|
46050
|
-
|
|
46075
|
+
get_video_status: {
|
|
46051
46076
|
request_id: "vid_mock_987",
|
|
46052
46077
|
status: "completed",
|
|
46053
46078
|
video_url: "https://api.x.ai/v1/videos/mock_video_987.mp4"
|
|
@@ -46140,11 +46165,11 @@ var server = new McpServer({
|
|
|
46140
46165
|
version: PACKAGE_VERSION
|
|
46141
46166
|
});
|
|
46142
46167
|
var TOOL_DEFINITIONS = [
|
|
46143
|
-
{ name: "
|
|
46144
|
-
{ name: "
|
|
46145
|
-
{ name: "
|
|
46146
|
-
{ name: "
|
|
46147
|
-
{ name: "
|
|
46168
|
+
{ name: "search_x" },
|
|
46169
|
+
{ name: "search_web" },
|
|
46170
|
+
{ name: "generate_image" },
|
|
46171
|
+
{ name: "generate_video" },
|
|
46172
|
+
{ name: "get_video_status" }
|
|
46148
46173
|
];
|
|
46149
46174
|
function getValidationResult(error48) {
|
|
46150
46175
|
const issue2 = error48.issues[0];
|
|
@@ -46178,7 +46203,7 @@ async function handleGrokSearchX(params, client = xaiClient) {
|
|
|
46178
46203
|
);
|
|
46179
46204
|
}
|
|
46180
46205
|
const cacheKey = JSON.stringify({
|
|
46181
|
-
tool: "
|
|
46206
|
+
tool: "search_x",
|
|
46182
46207
|
query,
|
|
46183
46208
|
allowed_x_handles,
|
|
46184
46209
|
excluded_x_handles,
|
|
@@ -46191,7 +46216,7 @@ async function handleGrokSearchX(params, client = xaiClient) {
|
|
|
46191
46216
|
cacheKey,
|
|
46192
46217
|
SEARCH_CACHE_TTL,
|
|
46193
46218
|
async () => {
|
|
46194
|
-
if (IS_MOCK) return MOCK_FIXTURES.
|
|
46219
|
+
if (IS_MOCK) return MOCK_FIXTURES.search_x;
|
|
46195
46220
|
const { data } = await client.post("/responses", {
|
|
46196
46221
|
model: GROK_SEARCH_MODEL,
|
|
46197
46222
|
input: [{ role: "user", content: query }],
|
|
@@ -46265,7 +46290,7 @@ async function handleGrokSearchWeb(params, client = xaiClient) {
|
|
|
46265
46290
|
);
|
|
46266
46291
|
}
|
|
46267
46292
|
const cacheKey = JSON.stringify({
|
|
46268
|
-
tool: "
|
|
46293
|
+
tool: "search_web",
|
|
46269
46294
|
query,
|
|
46270
46295
|
allowed_domains,
|
|
46271
46296
|
excluded_domains,
|
|
@@ -46275,7 +46300,7 @@ async function handleGrokSearchWeb(params, client = xaiClient) {
|
|
|
46275
46300
|
cacheKey,
|
|
46276
46301
|
SEARCH_CACHE_TTL,
|
|
46277
46302
|
async () => {
|
|
46278
|
-
if (IS_MOCK) return MOCK_FIXTURES.
|
|
46303
|
+
if (IS_MOCK) return MOCK_FIXTURES.search_web;
|
|
46279
46304
|
const { data } = await client.post("/responses", {
|
|
46280
46305
|
model: GROK_SEARCH_MODEL,
|
|
46281
46306
|
input: [
|
|
@@ -46336,7 +46361,7 @@ async function handleGrokSearchWeb(params, client = xaiClient) {
|
|
|
46336
46361
|
async function handleGrokImagine(params, client = xaiClient) {
|
|
46337
46362
|
const { prompt, aspect_ratio, output_dir } = params;
|
|
46338
46363
|
try {
|
|
46339
|
-
const rawResponse = IS_MOCK ? MOCK_FIXTURES.
|
|
46364
|
+
const rawResponse = IS_MOCK ? MOCK_FIXTURES.generate_image : (await client.post("/images/generations", {
|
|
46340
46365
|
model: GROK_IMAGE_MODEL,
|
|
46341
46366
|
prompt,
|
|
46342
46367
|
aspect_ratio,
|
|
@@ -46367,6 +46392,9 @@ async function handleGrokImagine(params, client = xaiClient) {
|
|
|
46367
46392
|
)
|
|
46368
46393
|
)
|
|
46369
46394
|
);
|
|
46395
|
+
output.images.forEach((image, index) => {
|
|
46396
|
+
image.savedPath = savedPaths[index];
|
|
46397
|
+
});
|
|
46370
46398
|
extraText = `
|
|
46371
46399
|
|
|
46372
46400
|
\u2705 Images saved to:
|
|
@@ -46395,7 +46423,7 @@ ${savedPaths.join("\n")}`;
|
|
|
46395
46423
|
async function handleGrokAnimate(params, client = xaiClient) {
|
|
46396
46424
|
const { prompt, image_url, aspect_ratio } = params;
|
|
46397
46425
|
try {
|
|
46398
|
-
const rawResponse = IS_MOCK ? MOCK_FIXTURES.
|
|
46426
|
+
const rawResponse = IS_MOCK ? MOCK_FIXTURES.generate_video : (await client.post("/videos/generations", {
|
|
46399
46427
|
model: GROK_VIDEO_MODEL,
|
|
46400
46428
|
prompt,
|
|
46401
46429
|
image_url,
|
|
@@ -46421,7 +46449,7 @@ async function handleGrokAnimate(params, client = xaiClient) {
|
|
|
46421
46449
|
async function handleGrokVideoStatus(params, client = xaiClient) {
|
|
46422
46450
|
const { request_id, output_dir } = params;
|
|
46423
46451
|
try {
|
|
46424
|
-
const rawResponse = IS_MOCK ? MOCK_FIXTURES.
|
|
46452
|
+
const rawResponse = IS_MOCK ? MOCK_FIXTURES.get_video_status : (await client.get(`/videos/${request_id}`)).data;
|
|
46425
46453
|
const output = normalizeVideoStatusResponse(rawResponse, request_id);
|
|
46426
46454
|
let mediaContent = [];
|
|
46427
46455
|
let extraText = "";
|
|
@@ -46439,6 +46467,7 @@ async function handleGrokVideoStatus(params, client = xaiClient) {
|
|
|
46439
46467
|
`video-${Date.now()}.mp4`,
|
|
46440
46468
|
mediaRes.buffer
|
|
46441
46469
|
);
|
|
46470
|
+
output.savedPath = fpath;
|
|
46442
46471
|
extraText = `
|
|
46443
46472
|
|
|
46444
46473
|
\u2705 Video saved to: ${fpath}`;
|
|
@@ -46467,23 +46496,23 @@ async function handleGrokVideoStatus(params, client = xaiClient) {
|
|
|
46467
46496
|
}
|
|
46468
46497
|
async function handleToolCall(name, args, client = xaiClient) {
|
|
46469
46498
|
switch (name) {
|
|
46470
|
-
case "
|
|
46499
|
+
case "search_x": {
|
|
46471
46500
|
const parsed = xSearchSchema.safeParse(args);
|
|
46472
46501
|
return parsed.success ? handleGrokSearchX(parsed.data, client) : getValidationResult(parsed.error);
|
|
46473
46502
|
}
|
|
46474
|
-
case "
|
|
46503
|
+
case "search_web": {
|
|
46475
46504
|
const parsed = webSearchSchema.safeParse(args);
|
|
46476
46505
|
return parsed.success ? handleGrokSearchWeb(parsed.data, client) : getValidationResult(parsed.error);
|
|
46477
46506
|
}
|
|
46478
|
-
case "
|
|
46507
|
+
case "generate_image": {
|
|
46479
46508
|
const parsed = imagineSchema.safeParse(args);
|
|
46480
46509
|
return parsed.success ? handleGrokImagine(parsed.data, client) : getValidationResult(parsed.error);
|
|
46481
46510
|
}
|
|
46482
|
-
case "
|
|
46511
|
+
case "generate_video": {
|
|
46483
46512
|
const parsed = animateSchema.safeParse(args);
|
|
46484
46513
|
return parsed.success ? handleGrokAnimate(parsed.data, client) : getValidationResult(parsed.error);
|
|
46485
46514
|
}
|
|
46486
|
-
case "
|
|
46515
|
+
case "get_video_status": {
|
|
46487
46516
|
const parsed = videoStatusSchema.safeParse(args);
|
|
46488
46517
|
return parsed.success ? handleGrokVideoStatus(parsed.data, client) : getValidationResult(parsed.error);
|
|
46489
46518
|
}
|
|
@@ -46492,31 +46521,31 @@ async function handleToolCall(name, args, client = xaiClient) {
|
|
|
46492
46521
|
}
|
|
46493
46522
|
}
|
|
46494
46523
|
server.tool(
|
|
46495
|
-
"
|
|
46524
|
+
"search_x",
|
|
46496
46525
|
"Search X posts and threads via Grok.",
|
|
46497
46526
|
xSearchSchema.shape,
|
|
46498
46527
|
async (args) => handleGrokSearchX(args)
|
|
46499
46528
|
);
|
|
46500
46529
|
server.tool(
|
|
46501
|
-
"
|
|
46530
|
+
"search_web",
|
|
46502
46531
|
"Search the public web via Grok.",
|
|
46503
46532
|
webSearchSchema.shape,
|
|
46504
46533
|
async (args) => handleGrokSearchWeb(args)
|
|
46505
46534
|
);
|
|
46506
46535
|
server.tool(
|
|
46507
|
-
"
|
|
46536
|
+
"generate_image",
|
|
46508
46537
|
"Generate images from a text prompt.",
|
|
46509
46538
|
imagineSchema.shape,
|
|
46510
46539
|
async (args) => handleGrokImagine(args)
|
|
46511
46540
|
);
|
|
46512
46541
|
server.tool(
|
|
46513
|
-
"
|
|
46542
|
+
"generate_video",
|
|
46514
46543
|
"Start a Grok video generation task.",
|
|
46515
46544
|
animateSchema.shape,
|
|
46516
46545
|
async (args) => handleGrokAnimate(args)
|
|
46517
46546
|
);
|
|
46518
46547
|
server.tool(
|
|
46519
|
-
"
|
|
46548
|
+
"get_video_status",
|
|
46520
46549
|
"Check a Grok video task status.",
|
|
46521
46550
|
videoStatusSchema.shape,
|
|
46522
46551
|
async (args) => handleGrokVideoStatus(args)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fre4x/grok",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.4",
|
|
4
4
|
"description": "An MCP server for xAI (Grok) with search and generation capabilities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "fritzprix",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
37
37
|
"axios": "^1.13.5",
|
|
38
38
|
"zod": "^4.3.6"
|
|
39
39
|
},
|