Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

update-index

Modify a Meilisearch index by changing its primary key to organize data more effectively for search operations.

Instructions

Update a Meilisearch index (currently only supports updating the primary key)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
primaryKeyYesNew primary key for the index

Implementation Reference

  • The core handler function for the 'update-index' tool. It performs a PATCH request to the Meilisearch API to update the primary key of the specified index and returns the JSON response or an error message.
    async ({ indexUid, primaryKey }: UpdateIndexParams) => {
      try {
        const response = await apiClient.patch(`/indexes/${indexUid}`, {
          primaryKey,
        });
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod input schema for the 'update-index' tool, defining the required parameters: indexUid and primaryKey.
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      primaryKey: z.string().describe('New primary key for the index'),
    },
  • MCP tool registration for 'update-index', including name, description, schema, and handler function.
    server.tool(
      'update-index',
      'Update a Meilisearch index (currently only supports updating the primary key)',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
        primaryKey: z.string().describe('New primary key for the index'),
      },
      async ({ indexUid, primaryKey }: UpdateIndexParams) => {
        try {
          const response = await apiClient.patch(`/indexes/${indexUid}`, {
            primaryKey,
          });
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • src/index.ts:64-64 (registration)
    Invocation of registerIndexTools which registers the 'update-index' tool (among others) on the main MCP server instance.
    registerIndexTools(server);
  • TypeScript interface defining the input parameters for the update-index tool handler.
    interface UpdateIndexParams {
      indexUid: string;
      primaryKey: string;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool performs an update operation, implying mutation, but doesn't disclose behavioral traits such as permissions required, whether the update is reversible, side effects on existing data, or rate limits. The limitation about primary key support is useful but insufficient for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and includes a parenthetical limitation. Every word earns its place with no redundancy or waste, making it appropriately sized and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity as a mutation operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral context (e.g., safety, effects), usage prerequisites, and expected outcomes. While concise, it doesn't compensate for the missing structured data, leaving gaps for an AI agent to operate safely and effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters (indexUid, primaryKey) fully documented in the schema. The description adds no additional meaning about parameters beyond implying the primaryKey is the updatable field. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description provides minimal extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('a Meilisearch index'), and specifies the current capability ('currently only supports updating the primary key'). This distinguishes it from other update tools like update-documents or update-settings by limiting scope, though it doesn't explicitly name alternatives. The purpose is specific but could better differentiate from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like create-index or other update-* tools. The description mentions a limitation ('only supports updating the primary key'), which implies usage context but doesn't state when this operation is appropriate or what prerequisites exist. This leaves the agent without explicit usage rules.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.