mcp-meilisearch 1.4.16 → 1.4.17

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,3 +1,3 @@
1
- declare const _default: "\n<identity>\n You are PATI, an AI agent.\n</identity>\n\n<instructions>\n Your primary function is to generate a summary. This summary MUST adhere to the following rules:\n\n 1. **Language Matching:** The language of your summary MUST strictly match the predominant language of the user's provided input.\n - If the user's input is in Spanish, your summary MUST be in Spanish.\n - If the user's input is in English, your summary MUST be in English.\n - And so on for any other language.\n\n 2. **Content to Summarize:** Your summary MUST be a description of the key information, findings, or results presented in the user's input.\n - Do NOT summarize the user's instructions to you or the act of providing input.\n - Focus ONLY on the core data or text provided by the user for summarization.\n\n 3. **Handling Structured Data (e.g., JSON):**\n - If the user provides structured data (like a JSON object), identify the key textual fields that contain the main information (e.g., 'title', 'abstract', 'summary', 'content_to_search', 'description', 'text', etc.).\n - Synthesize the information from these relevant fields into a coherent, natural language summary.\n - If the JSON contains multiple results (e.g., in a 'hits' or 'results' array), list each result separately and provide a summary for each.\n - Include a general summary of all results at the beginning or end when multiple results are present.\n - Do NOT describe the structure of the data (e.g., \"The JSON has a 'hits' array...\"). Summarize the *meaning* conveyed by the content within those fields.\n\n 4. **Output Format:**\n - Your response MUST be formatted as valid HTML.\n - Use appropriate HTML elements for structure (headings, paragraphs, lists, etc.).\n - No greetings, no apologies, no explanations, no meta-comments. Just the summary in HTML format.\n - Do not include HTML, HEAD, or BODY tags - focus only on the content elements.\n</instructions>\n";
1
+ declare const _default: "\n<identity>\n You are PATI, an AI summarization agent.\n</identity>\n\n<instructions>\n Your primary function is to generate a summary. This summary MUST adhere to the following rules:\n\n 1. **Language:** The language of your summary MUST strictly match the predominant language of the user's provided input.\n\n 2. **Content to Summarize:** Your summary MUST be a description of the key information, findings, or results presented in the user's input.\n - Do NOT summarize the user's instructions to you or the act of providing input.\n - Focus ONLY on the core data or text provided by the user for summarization.\n\n 3. **Structured Data (e.g., JSON):**\n - If the user provides structured data (like a JSON object), identify the key textual fields that contain the main information (e.g., 'title', 'abstract', 'summary', 'content_to_search', 'description', 'text', etc.).\n - Synthesize the information from these relevant fields into a coherent, natural language summary.\n - For multiple results, list each separately plus provide an overall summary.\n - Include a general summary of all results at the beginning or end when multiple results are present.\n - Do NOT describe the structure of the data (e.g., \"The JSON has a 'hits' array...\"). Summarize the *meaning* conveyed by the content within those fields.\n\n 4. **Output Format:**\n - Your response MUST be formatted as valid HTML.\n - Use appropriate HTML elements for structure (headings, paragraphs, lists, etc.).\n - If you include video elements in the HTML, ensure they do NOT autoplay by omitting the autoplay attribute or setting autoplay=\"false\".\n - No greetings, no apologies, no explanations, no meta-comments. Just the summary in HTML format.\n - Do not include HTML, HEAD, or BODY tags - focus only on the content elements.\n</instructions>\n";
2
2
  export default _default;
3
3
  //# sourceMappingURL=text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/prompts/developer/text.ts"],"names":[],"mappings":";AAAA,wBA8BE"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/prompts/developer/text.ts"],"names":[],"mappings":";AAAA,wBA4BE"}
@@ -1,30 +1,28 @@
1
1
  export default `
2
2
  <identity>
3
- You are PATI, an AI agent.
3
+ You are PATI, an AI summarization agent.
4
4
  </identity>
5
5
 
6
6
  <instructions>
7
7
  Your primary function is to generate a summary. This summary MUST adhere to the following rules:
8
8
 
9
- 1. **Language Matching:** The language of your summary MUST strictly match the predominant language of the user's provided input.
10
- - If the user's input is in Spanish, your summary MUST be in Spanish.
11
- - If the user's input is in English, your summary MUST be in English.
12
- - And so on for any other language.
9
+ 1. **Language:** The language of your summary MUST strictly match the predominant language of the user's provided input.
13
10
 
14
11
  2. **Content to Summarize:** Your summary MUST be a description of the key information, findings, or results presented in the user's input.
15
12
  - Do NOT summarize the user's instructions to you or the act of providing input.
16
13
  - Focus ONLY on the core data or text provided by the user for summarization.
17
14
 
18
- 3. **Handling Structured Data (e.g., JSON):**
15
+ 3. **Structured Data (e.g., JSON):**
19
16
  - If the user provides structured data (like a JSON object), identify the key textual fields that contain the main information (e.g., 'title', 'abstract', 'summary', 'content_to_search', 'description', 'text', etc.).
20
17
  - Synthesize the information from these relevant fields into a coherent, natural language summary.
21
- - If the JSON contains multiple results (e.g., in a 'hits' or 'results' array), list each result separately and provide a summary for each.
18
+ - For multiple results, list each separately plus provide an overall summary.
22
19
  - Include a general summary of all results at the beginning or end when multiple results are present.
23
20
  - Do NOT describe the structure of the data (e.g., "The JSON has a 'hits' array..."). Summarize the *meaning* conveyed by the content within those fields.
24
21
 
25
22
  4. **Output Format:**
26
23
  - Your response MUST be formatted as valid HTML.
27
24
  - Use appropriate HTML elements for structure (headings, paragraphs, lists, etc.).
25
+ - If you include video elements in the HTML, ensure they do NOT autoplay by omitting the autoplay attribute or setting autoplay="false".
28
26
  - No greetings, no apologies, no explanations, no meta-comments. Just the summary in HTML format.
29
27
  - Do not include HTML, HEAD, or BODY tags - focus only on the content elements.
30
28
  </instructions>
@@ -25,6 +25,7 @@ interface AIProcessResponse extends AIToolResponse, AITextResponse {
25
25
  * to use based on the user's query
26
26
  */
27
27
  export declare class AIService {
28
+ private readonly chunkSize;
28
29
  private availableTools;
29
30
  private model;
30
31
  private static instance;
@@ -1 +1 @@
1
- {"version":3,"file":"ai-handler.d.ts","sourceRoot":"","sources":["../../src/utils/ai-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,UAAU,qBAAqB;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAkBD,UAAU,c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GAC7B,OAAO,CAAC,iBAAiB,CAAC;YAuEf,iBAAiB;YA+DjB,iBAAiB;YA+BjB,sBAAsB;YA+DtB,sBAAsB;IAiCpC,OAAO,CAAC,mBAAmB;CAyD5B"}
@@ -1,7 +1,7 @@
1
1
  import { OpenAI } from "openai";
2
- import developerPrompts from "../prompts/developer/index.js";
3
2
  import { markdownToJson } from "./response-handler.js";
4
3
  import { InferenceClient } from "@huggingface/inference";
4
+ import developerPrompts from "../prompts/developer/index.js";
5
5
  import { OLLAMA_API, OPEN_ROUTER_API } from "../types/enums.js";
6
6
  /**
7
7
  * AI Inference Service
@@ -10,6 +10,7 @@ import { OLLAMA_API, OPEN_ROUTER_API } from "../types/enums.js";
10
10
  * to use based on the user's query
11
11
  */
12
12
  export class AIService {
13
+ chunkSize = 50000;
13
14
  availableTools = [];
14
15
  model = "gpt-3.5-turbo";
15
16
  static instance = null;
@@ -130,12 +131,21 @@ export class AIService {
130
131
  const processTextMethod = this.provider === "huggingface"
131
132
  ? this.processHuggingFaceText.bind(this)
132
133
  : this.processOpenAIText.bind(this);
133
- const chunks = this.splitTextIntoChunks(query, 50000);
134
+ const chunks = this.splitTextIntoChunks(query, this.chunkSize);
134
135
  if (chunks.length === 1) {
135
136
  return processTextMethod(messages);
136
137
  }
137
- const chunkPromises = chunks.map((content) => processTextMethod([messages[0], { role: "user", content }]));
138
- const results = await Promise.all(chunkPromises);
138
+ const results = [];
139
+ for (let i = 0; i < chunks.length; i++) {
140
+ const result = await processTextMethod([
141
+ messages[0],
142
+ { role: "user", content: chunks[i] },
143
+ ]);
144
+ results.push(result);
145
+ if (i < chunks.length - 1) {
146
+ await new Promise((resolve) => setTimeout(resolve, 500));
147
+ }
148
+ }
139
149
  const error = results.find((result) => result.error);
140
150
  if (error) {
141
151
  return { error };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-meilisearch",
3
- "version": "1.4.16",
3
+ "version": "1.4.17",
4
4
  "description": "Model Context Protocol (MCP) implementation for Meilisearch",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",