update-embedders
Configure embedders for vector search in Meilisearch indexes to enable semantic search capabilities.
Instructions
Configure embedders for vector search
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index | |
| embedders | Yes | JSON object containing embedder configurations |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"embedders": {
"description": "JSON object containing embedder configurations",
"type": "string"
},
"indexUid": {
"description": "Unique identifier of the index",
"type": "string"
}
},
"required": [
"indexUid",
"embedders"
],
"type": "object"
}
Implementation Reference
- src/tools/vector-tools.ts:64-84 (handler)The handler function that implements the core logic of the 'update-embedders' tool. It parses the input embedders JSON, validates it as an object, and performs a PATCH request to update the embedders configuration for the specified index in Meilisearch.async ({ indexUid, embedders }) => { try { // Parse the embedders string to ensure it's valid JSON const parsedEmbedders = JSON.parse(embedders); // Ensure embedders is an object if (typeof parsedEmbedders !== 'object' || parsedEmbedders === null || Array.isArray(parsedEmbedders)) { return { isError: true, content: [{ type: "text", text: "Embedders must be a JSON object" }], }; } const response = await apiClient.patch(`/indexes/${indexUid}/settings/embedders`, parsedEmbedders); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
- src/tools/vector-tools.ts:61-62 (schema)Zod schema defining the input parameters for the 'update-embedders' tool: indexUid (string) and embedders (string representing JSON object).indexUid: z.string().describe("Unique identifier of the index"), embedders: z.string().describe("JSON object containing embedder configurations"),
- src/tools/vector-tools.ts:57-85 (registration)The server.tool() call that registers the 'update-embedders' tool with the MCP server, specifying name, description, input schema, and handler function.server.tool( "update-embedders", "Configure embedders for vector search", { indexUid: z.string().describe("Unique identifier of the index"), embedders: z.string().describe("JSON object containing embedder configurations"), }, async ({ indexUid, embedders }) => { try { // Parse the embedders string to ensure it's valid JSON const parsedEmbedders = JSON.parse(embedders); // Ensure embedders is an object if (typeof parsedEmbedders !== 'object' || parsedEmbedders === null || Array.isArray(parsedEmbedders)) { return { isError: true, content: [{ type: "text", text: "Embedders must be a JSON object" }], }; } const response = await apiClient.patch(`/indexes/${indexUid}/settings/embedders`, parsedEmbedders); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );
- src/index.ts:68-68 (registration)Top-level registration call that invokes registerVectorTools to add vector tools, including 'update-embedders', to the main MCP server instance.registerVectorTools(server);