mcp-meilisearch 1.3.10 → 1.4.1

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 CHANGED
@@ -106,7 +106,16 @@ console.log(`Results: ${JSON.stringify(result.data)}`);
106
106
 
107
107
  #### AI Inference Client Methods
108
108
 
109
- - `callToolWithAI(query: string, specificTools?: string[])`: Process a user query with AI inference, optionally limiting to specific tools.
109
+ #### `callToolWithAI(query, options)`
110
+
111
+ Processes a user query through AI to determine and execute the most appropriate tool.
112
+
113
+ **Parameters:**
114
+
115
+ - `query`: String - The user's query or request to be processed
116
+ - `options`: Object (Optional) - Configuration options
117
+ - `specificTools`: String[] (Optional) - Restricts tool selection to this list of tool names
118
+ - `justReasoning`: Boolean (Optional) - When set to `true`, returns only the AI's reasoning without executing the selected tool
110
119
 
111
120
  ### Starting the Server
112
121
 
@@ -304,7 +313,7 @@ The MCP server exposes various tools that allow you to interact with Meilisearch
304
313
 
305
314
  - **Description**: Perform multiple searches in one request.
306
315
  - **Parameters**:
307
- - `searches` (string, required): JSON array of search queries, each with indexUid and q fields.
316
+ - `queries` (string, required): JSON array of search queries, each containing the same parameters as the `search` tool.
308
317
 
309
318
  #### global-search
310
319
 
package/dist/client.d.ts CHANGED
@@ -46,6 +46,7 @@ export declare class MCPClient {
46
46
  * Parses and processes the response from the server
47
47
  * @param name The name of the tool to call
48
48
  * @param args Optional arguments to pass to the tool
49
+ * @throws Error if the tool call fails
49
50
  * @returns Object containing success status and either data or error message
50
51
  */
51
52
  callTool(name: string, args?: Record<string, any>): Promise<{
@@ -56,10 +57,16 @@ export declare class MCPClient {
56
57
  /**
57
58
  * Process a user query through the AI to determine which tool to use
58
59
  * @param query The user's query
59
- * @param specificTools Optional array of specific tools to consider
60
+ * @param options Options for the AI processing
61
+ * @param options.specificTools Optional array of specific tool names to consider
62
+ * @param options.justReasoning If true, only returns the reasoning without calling the tool
63
+ * @throws Error if AI inference fails
60
64
  * @returns The result of calling the selected tool, or an error
61
65
  */
62
- callToolWithAI(query: string, specificTools?: string[]): Promise<{
66
+ callToolWithAI(query: string, options?: {
67
+ specificTools?: string[];
68
+ justReasoning?: boolean;
69
+ }): Promise<{
63
70
  success: boolean;
64
71
  data?: any;
65
72
  error?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,qBAAa,SAAS;IACpB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAS;IAE7B;;;OAGG;IACH,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC,EAAE,CAAM;IAET,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,oBAAoB,CAEZ;gBAEJ,UAAU,EAAE,MAAM;IAI9B;;;OAGG;IACH,sBAAsB,CACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI;IAKzE;;;;;OAKG;IACG,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAOhE;;;;OAIG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAuBzC,SAAS;IA0BvB,OAAO,CAAC,kBAAkB;IAW1B;;;;;;OAMG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,IAA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SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAuBzC,SAAS;IA0BvB,OAAO,CAAC,kBAAkB;IAW1B;;;;;;;OAOG;IACG,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IA2CF;;;;;;;;OAQG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAO,GAClE,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IA6CF,OAAO,CAAC,cAAc;IAKtB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAK/B"}
package/dist/client.js CHANGED
@@ -100,6 +100,7 @@ export class MCPClient {
100
100
  * Parses and processes the response from the server
101
101
  * @param name The name of the tool to call
102
102
  * @param args Optional arguments to pass to the tool
103
+ * @throws Error if the tool call fails
103
104
  * @returns Object containing success status and either data or error message
104
105
  */
105
106
  async callTool(name, args) {
@@ -143,10 +144,14 @@ export class MCPClient {
143
144
  /**
144
145
  * Process a user query through the AI to determine which tool to use
145
146
  * @param query The user's query
146
- * @param specificTools Optional array of specific tools to consider
147
+ * @param options Options for the AI processing
148
+ * @param options.specificTools Optional array of specific tool names to consider
149
+ * @param options.justReasoning If true, only returns the reasoning without calling the tool
150
+ * @throws Error if AI inference fails
147
151
  * @returns The result of calling the selected tool, or an error
148
152
  */
149
- async callToolWithAI(query, specificTools) {
153
+ async callToolWithAI(query, options = {}) {
154
+ const { specificTools, justReasoning } = options;
150
155
  try {
151
156
  const result = await this.callTool("process-ai-query", {
152
157
  query,
@@ -161,6 +166,13 @@ export class MCPClient {
161
166
  error: "AI could not determine which tool to use for this query",
162
167
  };
163
168
  }
169
+ if (justReasoning) {
170
+ return {
171
+ reasoning,
172
+ success: true,
173
+ toolUsed: toolName,
174
+ };
175
+ }
164
176
  const toolResult = await this.callTool(toolName, parameters);
165
177
  return {
166
178
  ...toolResult,
@@ -93,7 +93,7 @@ export const registerSearchTools = (server) => {
93
93
  server.tool("multi-search", "Perform multiple searches in one request", {
94
94
  queries: z
95
95
  .array(z.object(SearchParamsSchema))
96
- .describe("JSON array of search queries, each with indexUid and q fields as required. Other fields of the SearchParams are optional."),
96
+ .describe("JSON array of search queries, each containing the same parameters as the `search` tool"),
97
97
  }, { category: "meilisearch" }, async ({ queries }) => {
98
98
  try {
99
99
  // Ensure queries is an array
@@ -130,7 +130,7 @@ export const registerSearchTools = (server) => {
130
130
  return createErrorResponse(error);
131
131
  }
132
132
  });
133
- server.tool("global-search", "Search for a term across all available Meilisearch indexes and return combined results.", {
133
+ server.tool("global-search", "Search for a term across all available Meilisearch indexes and return combined results", {
134
134
  q: z.string().describe("Search query"),
135
135
  limit: z
136
136
  .number()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-meilisearch",
3
- "version": "1.3.10",
3
+ "version": "1.4.1",
4
4
  "description": "Model Context Protocol (MCP) implementation for Meilisearch",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",