Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

stats

Retrieve statistics for all indexes or a specific index to monitor performance and track data metrics in Meilisearch.

Instructions

Get statistics about all indexes or a specific index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidNoUnique identifier of the index (optional, if not provided stats for all indexes will be returned)

Implementation Reference

  • The handler function for the 'stats' tool. It constructs the appropriate Meilisearch API endpoint (/stats or /indexes/{indexUid}/stats), fetches the data using apiClient, and returns the JSON-formatted response as text content. Errors are handled via createErrorResponse.
    async ({ indexUid }) => {
      try {
        const endpoint = indexUid ? `/indexes/${indexUid}/stats` : '/stats';
        const response = await apiClient.get(endpoint);
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod input schema defining the optional 'indexUid' parameter for specifying a particular index.
    indexUid: z.string().optional().describe('Unique identifier of the index (optional, if not provided stats for all indexes will be returned)'),
  • Direct registration of the 'stats' tool on the MCP server using server.tool(). Includes name, description, input schema, and handler function.
    server.tool(
      'stats',
      'Get statistics about all indexes or a specific index',
      {
        indexUid: z.string().optional().describe('Unique identifier of the index (optional, if not provided stats for all indexes will be returned)'),
      },
      async ({ indexUid }) => {
        try {
          const endpoint = indexUid ? `/indexes/${indexUid}/stats` : '/stats';
          const response = await apiClient.get(endpoint);
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • src/index.ts:69-69 (registration)
    Top-level registration call for the system tools module (which includes the 'stats' tool) on the main MCP server instance.
    registerSystemTools(server);
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 mentions the tool retrieves statistics, which implies a read-only operation, but doesn't disclose behavioral traits like whether it requires specific permissions, what statistics are included (e.g., document counts, performance metrics), rate limits, or error conditions. The description is minimal and lacks operational context.

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 functionality. It wastes no words and directly communicates the tool's behavior with the parameter implication. Every part of the sentence earns its place.

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

Completeness3/5

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

Given no annotations and no output schema, the description is incomplete for a tool that likely returns complex statistical data. It adequately covers the basic purpose and parameter behavior but lacks details on what statistics are returned, error handling, or performance implications. For a read operation with minimal structured support, it's borderline adequate.

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 the parameter 'indexUid' fully documented in the schema as optional. The description adds marginal value by restating that omitting it returns stats for all indexes, but doesn't provide additional semantics like format examples or constraints beyond what's in the schema. Baseline 3 is appropriate given high schema coverage.

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 verb ('Get') and resource ('statistics about all indexes or a specific index'), making the purpose immediately understandable. It distinguishes between getting stats for all indexes vs. a specific one, though it doesn't explicitly differentiate from siblings like 'get-index' or 'list-indexes' which provide different types of index information.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning the optional parameter behavior (stats for all indexes if no indexUid provided). However, it doesn't explicitly state when to use this tool versus alternatives like 'get-index' (which likely returns configuration) or 'list-indexes' (which likely lists metadata). No explicit exclusions or prerequisites are provided.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devlimelabs/meilisearch-ts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server