mcp-meilisearch 1.4.25 → 1.4.26

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.
@@ -1 +1 @@
1
- {"version":3,"file":"system-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/system-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,SAmNpD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"system-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/system-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;;;GAIG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,SAyNpD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -13,7 +13,11 @@ import { createErrorResponse } from "../../utils/error-handler.js";
13
13
  */
14
14
  export const registerSystemTools = (server) => {
15
15
  // Get Meilisearch version
16
- server.tool("get-version", "Get the version of the Meilisearch instance", {}, { category: "meilisearch" }, async () => {
16
+ server.registerTool("get-version", {
17
+ description: "Get the version of the Meilisearch instance",
18
+ inputSchema: {},
19
+ _meta: { category: "meilisearch" },
20
+ }, async () => {
17
21
  try {
18
22
  const response = await apiClient.get("/version");
19
23
  return {
@@ -26,8 +30,11 @@ export const registerSystemTools = (server) => {
26
30
  return createErrorResponse(error);
27
31
  }
28
32
  });
29
- // Get Meilisearch health status
30
- server.tool("get-health", "Get the health status of the Meilisearch instance", {}, { category: "meilisearch" }, async () => {
33
+ server.registerTool("get-health", {
34
+ description: "Get the health status of the Meilisearch instance",
35
+ inputSchema: {},
36
+ _meta: { category: "meilisearch" },
37
+ }, async () => {
31
38
  try {
32
39
  const response = await apiClient.get("/health");
33
40
  return {
@@ -40,8 +47,11 @@ export const registerSystemTools = (server) => {
40
47
  return createErrorResponse(error);
41
48
  }
42
49
  });
43
- // Get Meilisearch server stats
44
- server.tool("get-stats", "Get statistics about the Meilisearch server", {}, { category: "meilisearch" }, async () => {
50
+ server.registerTool("get-stats", {
51
+ description: "Get statistics about the Meilisearch server",
52
+ inputSchema: {},
53
+ _meta: { category: "meilisearch" },
54
+ }, async () => {
45
55
  try {
46
56
  const response = await apiClient.get("/");
47
57
  return {
@@ -54,41 +64,44 @@ export const registerSystemTools = (server) => {
54
64
  return createErrorResponse(error);
55
65
  }
56
66
  });
57
- // Get all tasks (with optional filtering)
58
- server.tool("get-tasks", "Get information about tasks with optional filtering", {
59
- limit: z
60
- .number()
61
- .min(0)
62
- .optional()
63
- .describe("Maximum number of tasks to return"),
64
- from: z
65
- .number()
66
- .min(0)
67
- .optional()
68
- .describe("Task uid from which to start fetching"),
69
- status: z
70
- .enum(["enqueued", "processing", "succeeded", "failed", "canceled"])
71
- .optional()
72
- .describe("Status of tasks to return"),
73
- type: z
74
- .enum([
75
- "indexCreation",
76
- "indexUpdate",
77
- "indexDeletion",
78
- "documentAddition",
79
- "documentUpdate",
80
- "documentDeletion",
81
- "settingsUpdate",
82
- "dumpCreation",
83
- "taskCancelation",
84
- ])
85
- .optional()
86
- .describe("Type of tasks to return"),
87
- indexUids: z
88
- .array(z.string())
89
- .optional()
90
- .describe("UIDs of the indexes on which tasks were performed"),
91
- }, { category: "meilisearch" }, async ({ limit, from, status, type, indexUids }) => {
67
+ server.registerTool("get-tasks", {
68
+ description: "Get information about tasks with optional filtering",
69
+ inputSchema: {
70
+ limit: z
71
+ .number()
72
+ .min(0)
73
+ .optional()
74
+ .describe("Maximum number of tasks to return"),
75
+ from: z
76
+ .number()
77
+ .min(0)
78
+ .optional()
79
+ .describe("Task uid from which to start fetching"),
80
+ status: z
81
+ .enum(["enqueued", "processing", "succeeded", "failed", "canceled"])
82
+ .optional()
83
+ .describe("Status of tasks to return"),
84
+ type: z
85
+ .enum([
86
+ "indexCreation",
87
+ "indexUpdate",
88
+ "indexDeletion",
89
+ "documentAddition",
90
+ "documentUpdate",
91
+ "documentDeletion",
92
+ "settingsUpdate",
93
+ "dumpCreation",
94
+ "taskCancelation",
95
+ ])
96
+ .optional()
97
+ .describe("Type of tasks to return"),
98
+ indexUids: z
99
+ .array(z.string())
100
+ .optional()
101
+ .describe("UIDs of the indexes on which tasks were performed"),
102
+ },
103
+ _meta: { category: "meilisearch" },
104
+ }, async ({ limit, from, status, type, indexUids }) => {
92
105
  try {
93
106
  const params = {};
94
107
  if (limit !== undefined)
@@ -112,51 +125,54 @@ export const registerSystemTools = (server) => {
112
125
  return createErrorResponse(error);
113
126
  }
114
127
  });
115
- // Delete tasks
116
- server.tool("delete-tasks", "Delete tasks based on provided filters", {
117
- statuses: z
118
- .array(z.enum(["succeeded", "failed", "canceled"]))
119
- .optional()
120
- .describe("Statuses of tasks to delete"),
121
- types: z
122
- .array(z.enum([
123
- "indexCreation",
124
- "indexUpdate",
125
- "indexDeletion",
126
- "documentAddition",
127
- "documentUpdate",
128
- "documentDeletion",
129
- "settingsUpdate",
130
- "dumpCreation",
131
- "taskCancelation",
132
- ]))
133
- .optional()
134
- .describe("Types of tasks to delete"),
135
- indexUids: z
136
- .array(z.string())
137
- .optional()
138
- .describe("UIDs of the indexes on which tasks to delete were performed"),
139
- uids: z
140
- .array(z.number())
141
- .optional()
142
- .describe("UIDs of the tasks to delete"),
143
- canceledBy: z
144
- .array(z.number())
145
- .optional()
146
- .describe("UIDs of the tasks that canceled tasks to delete"),
147
- beforeUid: z
148
- .number()
149
- .optional()
150
- .describe("Delete tasks whose uid is before this value"),
151
- beforeStartedAt: z
152
- .string()
153
- .optional()
154
- .describe("Delete tasks that started processing before this date (ISO 8601 format)"),
155
- beforeFinishedAt: z
156
- .string()
157
- .optional()
158
- .describe("Delete tasks that finished processing before this date (ISO 8601 format)"),
159
- }, { category: "meilisearch" }, async ({ statuses, types, indexUids, uids, canceledBy, beforeUid, beforeStartedAt, beforeFinishedAt, }) => {
128
+ server.registerTool("delete-tasks", {
129
+ description: "Delete tasks based on provided filters",
130
+ inputSchema: {
131
+ statuses: z
132
+ .array(z.enum(["succeeded", "failed", "canceled"]))
133
+ .optional()
134
+ .describe("Statuses of tasks to delete"),
135
+ types: z
136
+ .array(z.enum([
137
+ "indexCreation",
138
+ "indexUpdate",
139
+ "indexDeletion",
140
+ "documentAddition",
141
+ "documentUpdate",
142
+ "documentDeletion",
143
+ "settingsUpdate",
144
+ "dumpCreation",
145
+ "taskCancelation",
146
+ ]))
147
+ .optional()
148
+ .describe("Types of tasks to delete"),
149
+ indexUids: z
150
+ .array(z.string())
151
+ .optional()
152
+ .describe("UIDs of the indexes on which tasks to delete were performed"),
153
+ uids: z
154
+ .array(z.number())
155
+ .optional()
156
+ .describe("UIDs of the tasks to delete"),
157
+ canceledBy: z
158
+ .array(z.number())
159
+ .optional()
160
+ .describe("UIDs of the tasks that canceled tasks to delete"),
161
+ beforeUid: z
162
+ .number()
163
+ .optional()
164
+ .describe("Delete tasks whose uid is before this value"),
165
+ beforeStartedAt: z
166
+ .string()
167
+ .optional()
168
+ .describe("Delete tasks that started processing before this date (ISO 8601 format)"),
169
+ beforeFinishedAt: z
170
+ .string()
171
+ .optional()
172
+ .describe("Delete tasks that finished processing before this date (ISO 8601 format)"),
173
+ },
174
+ _meta: { category: "meilisearch" },
175
+ }, async ({ statuses, types, indexUids, uids, canceledBy, beforeUid, beforeStartedAt, beforeFinishedAt, }) => {
160
176
  try {
161
177
  const body = {};
162
178
  if (statuses && statuses.length > 0)
@@ -1 +1 @@
1
- {"version":3,"file":"task-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/task-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmCpE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,SA6NlD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"task-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/task-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmCpE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,SAuOlD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -8,44 +8,54 @@ import { createErrorResponse } from "../../utils/error-handler.js";
8
8
  */
9
9
  export const registerTaskTools = (server) => {
10
10
  // List all tasks
11
- server.tool("list-tasks", "List all tasks in the Meilisearch instance", {
12
- limit: z
13
- .number()
14
- .min(0)
15
- .optional()
16
- .describe("Maximum number of tasks to return"),
17
- from: z
18
- .number()
19
- .min(0)
20
- .optional()
21
- .describe("Task uid from which to start fetching"),
22
- statuses: z
23
- .array(z.enum(["enqueued", "processing", "succeeded", "failed", "canceled"]))
24
- .optional()
25
- .describe("Statuses of tasks to return"),
26
- types: z
27
- .array(z.enum([
28
- "indexCreation",
29
- "indexUpdate",
30
- "indexDeletion",
31
- "documentAddition",
32
- "documentUpdate",
33
- "documentDeletion",
34
- "settingsUpdate",
35
- "dumpCreation",
36
- "taskCancelation",
37
- ]))
38
- .optional()
39
- .describe("Types of tasks to return"),
40
- indexUids: z
41
- .array(z.string())
42
- .optional()
43
- .describe("UIDs of the indexes on which tasks were performed"),
44
- uids: z
45
- .array(z.number())
46
- .optional()
47
- .describe("UIDs of specific tasks to return"),
48
- }, { category: "meilisearch" }, async ({ limit, from, statuses, types, indexUids, uids, }) => {
11
+ server.registerTool("list-tasks", {
12
+ description: "List all tasks in the Meilisearch instance",
13
+ inputSchema: {
14
+ limit: z
15
+ .number()
16
+ .min(0)
17
+ .optional()
18
+ .describe("Maximum number of tasks to return"),
19
+ from: z
20
+ .number()
21
+ .min(0)
22
+ .optional()
23
+ .describe("Task uid from which to start fetching"),
24
+ statuses: z
25
+ .array(z.enum([
26
+ "enqueued",
27
+ "processing",
28
+ "succeeded",
29
+ "failed",
30
+ "canceled",
31
+ ]))
32
+ .optional()
33
+ .describe("Statuses of tasks to return"),
34
+ types: z
35
+ .array(z.enum([
36
+ "indexCreation",
37
+ "indexUpdate",
38
+ "indexDeletion",
39
+ "documentAddition",
40
+ "documentUpdate",
41
+ "documentDeletion",
42
+ "settingsUpdate",
43
+ "dumpCreation",
44
+ "taskCancelation",
45
+ ]))
46
+ .optional()
47
+ .describe("Types of tasks to return"),
48
+ indexUids: z
49
+ .array(z.string())
50
+ .optional()
51
+ .describe("UIDs of the indexes on which tasks were performed"),
52
+ uids: z
53
+ .array(z.number())
54
+ .optional()
55
+ .describe("UIDs of specific tasks to return"),
56
+ },
57
+ _meta: { category: "meilisearch" },
58
+ }, async ({ limit, from, statuses, types, indexUids, uids, }) => {
49
59
  try {
50
60
  const params = {};
51
61
  if (limit !== undefined)
@@ -71,10 +81,13 @@ export const registerTaskTools = (server) => {
71
81
  return createErrorResponse(error);
72
82
  }
73
83
  });
74
- // Get a specific task
75
- server.tool("get-task", "Get information about a specific task", {
76
- taskUid: z.number().describe("Unique identifier of the task"),
77
- }, { category: "meilisearch" }, async ({ taskUid }) => {
84
+ server.registerTool("get-task", {
85
+ description: "Get information about a specific task",
86
+ inputSchema: {
87
+ taskUid: z.number().describe("Unique identifier of the task"),
88
+ },
89
+ _meta: { category: "meilisearch" },
90
+ }, async ({ taskUid }) => {
78
91
  try {
79
92
  const response = await apiClient.get(`/tasks/${taskUid}`);
80
93
  return {
@@ -87,35 +100,38 @@ export const registerTaskTools = (server) => {
87
100
  return createErrorResponse(error);
88
101
  }
89
102
  });
90
- // Cancel tasks
91
- server.tool("cancel-tasks", "Cancel tasks based on provided filters", {
92
- statuses: z
93
- .array(z.enum(["enqueued", "processing"]))
94
- .optional()
95
- .describe("Statuses of tasks to cancel"),
96
- types: z
97
- .array(z.enum([
98
- "indexCreation",
99
- "indexUpdate",
100
- "indexDeletion",
101
- "documentAddition",
102
- "documentUpdate",
103
- "documentDeletion",
104
- "settingsUpdate",
105
- "dumpCreation",
106
- "taskCancelation",
107
- ]))
108
- .optional()
109
- .describe("Types of tasks to cancel"),
110
- indexUids: z
111
- .array(z.string())
112
- .optional()
113
- .describe("UIDs of the indexes on which tasks to cancel were performed"),
114
- uids: z
115
- .array(z.number())
116
- .optional()
117
- .describe("UIDs of the tasks to cancel"),
118
- }, { category: "meilisearch" }, async ({ statuses, types, indexUids, uids }) => {
103
+ server.registerTool("cancel-tasks", {
104
+ description: "Cancel tasks based on provided filters",
105
+ inputSchema: {
106
+ statuses: z
107
+ .array(z.enum(["enqueued", "processing"]))
108
+ .optional()
109
+ .describe("Statuses of tasks to cancel"),
110
+ types: z
111
+ .array(z.enum([
112
+ "indexCreation",
113
+ "indexUpdate",
114
+ "indexDeletion",
115
+ "documentAddition",
116
+ "documentUpdate",
117
+ "documentDeletion",
118
+ "settingsUpdate",
119
+ "dumpCreation",
120
+ "taskCancelation",
121
+ ]))
122
+ .optional()
123
+ .describe("Types of tasks to cancel"),
124
+ indexUids: z
125
+ .array(z.string())
126
+ .optional()
127
+ .describe("UIDs of the indexes on which tasks to cancel were performed"),
128
+ uids: z
129
+ .array(z.number())
130
+ .optional()
131
+ .describe("UIDs of the tasks to cancel"),
132
+ },
133
+ _meta: { category: "meilisearch" },
134
+ }, async ({ statuses, types, indexUids, uids }) => {
119
135
  try {
120
136
  const body = {};
121
137
  if (statuses && statuses.length > 0)
@@ -137,34 +153,36 @@ export const registerTaskTools = (server) => {
137
153
  return createErrorResponse(error);
138
154
  }
139
155
  });
140
- // Wait for a task to complete
141
- server.tool("wait-for-task", "Wait for a specific task to complete", {
142
- taskUid: z.number().describe("Unique identifier of the task to wait for"),
143
- timeoutMs: z
144
- .number()
145
- .min(0)
146
- .optional()
147
- .describe("Maximum time to wait in milliseconds (default: 5000)"),
148
- intervalMs: z
149
- .number()
150
- .min(100)
151
- .optional()
152
- .describe("Polling interval in milliseconds (default: 500)"),
153
- }, { category: "meilisearch" }, async ({ taskUid, timeoutMs = 5000, intervalMs = 500, }) => {
156
+ server.registerTool("wait-for-task", {
157
+ description: "Wait for a specific task to complete",
158
+ inputSchema: {
159
+ taskUid: z
160
+ .number()
161
+ .describe("Unique identifier of the task to wait for"),
162
+ timeoutMs: z
163
+ .number()
164
+ .min(0)
165
+ .optional()
166
+ .describe("Maximum time to wait in milliseconds (default: 5000)"),
167
+ intervalMs: z
168
+ .number()
169
+ .min(100)
170
+ .optional()
171
+ .describe("Polling interval in milliseconds (default: 500)"),
172
+ },
173
+ _meta: { category: "meilisearch" },
174
+ }, async ({ taskUid, timeoutMs = 5000, intervalMs = 500, }) => {
154
175
  try {
155
176
  const startTime = Date.now();
156
177
  let taskCompleted = false;
157
178
  let taskData = null;
158
179
  while (!taskCompleted && Date.now() - startTime < timeoutMs) {
159
- // Fetch the current task status
160
180
  const response = await apiClient.get(`/tasks/${taskUid}`);
161
181
  taskData = response.data;
162
- // Check if the task has completed
163
182
  if (["succeeded", "failed", "canceled"].includes(response.statusText)) {
164
183
  taskCompleted = true;
165
184
  }
166
185
  else {
167
- // Wait for the polling interval
168
186
  await new Promise((resolve) => setTimeout(resolve, intervalMs));
169
187
  }
170
188
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vector-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/vector-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,SAyQpD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"vector-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/meilisearch/vector-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,SA2QpD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}