get-synonyms
Retrieve configured synonyms for a Meilisearch index to enhance search relevance by expanding query terms with equivalent words.
Instructions
Get the synonyms setting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Implementation Reference
- src/tools/settings-tools.ts:155-164 (handler)Handler function that performs a GET request to the Meilisearch API for the synonyms settings (/indexes/{indexUid}/settings/synonyms) and returns the JSON-formatted response or an error.async ({ indexUid }) => { try { const response = await apiClient.get(`/indexes/${indexUid}/settings/${endpoint}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
- src/tools/settings-tools.ts:152-154 (schema)Input schema using Zod: requires `indexUid` as a string, the unique identifier of the Meilisearch index.{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:120-124 (registration)Configuration object in the `specificSettingsTools` array that specifies the tool name, API endpoint ('synonyms'), and description, used in the dynamic registration loop.{ name: "get-synonyms", endpoint: "synonyms", description: "Get the synonyms setting", },
- src/tools/settings-tools.ts:147-166 (registration)Dynamic registration loop using `server.tool()` for all specific settings tools, including get-synonyms, providing name, description, schema, and shared handler.// Create a tool for each specific setting specificSettingsTools.forEach(({ name, endpoint, description }) => { server.tool( name, description, { indexUid: z.string().describe("Unique identifier of the index"), }, async ({ indexUid }) => { try { const response = await apiClient.get(`/indexes/${indexUid}/settings/${endpoint}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } ); });
- src/index.ts:67-67 (registration)Top-level invocation of `registerSettingsTools(server)` in the main MCP server setup, which registers the get-synonyms tool.registerSettingsTools(server);