Skip to main content
Glama
meilisearch

Meilisearch MCP Server

Official
by meilisearch

get-index-metrics

Retrieve detailed metrics for a specified index in Meilisearch, providing insights into performance and usage. Simplify index analysis for better data management.

Instructions

Get detailed metrics for an index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYes

Implementation Reference

  • Core implementation of get-index-metrics tool: retrieves index stats using Meilisearch client and constructs IndexMetrics object
    def get_index_metrics(self, index_uid: str) -> IndexMetrics:
        """Get detailed metrics for an index"""
        try:
            index = self.client.index(index_uid)
            stats = index.get_stats()
    
            return IndexMetrics(
                number_of_documents=stats["numberOfDocuments"],
                field_distribution=stats["fieldDistribution"],
                is_indexing=stats["isIndexing"],
                index_size=stats.get("indexSize"),
            )
        except Exception as e:
            raise Exception(f"Failed to get index metrics: {str(e)}")
  • MCP server handler for get-index-metrics: delegates to client.monitoring.get_index_metrics and returns formatted JSON response
    elif name == "get-index-metrics":
        metrics = self.meili_client.monitoring.get_index_metrics(
            arguments["indexUid"]
        )
        self.logger.info(
            "Index metrics retrieved",
            index=arguments["indexUid"],
            metrics=metrics.__dict__,
        )
        return [
            types.TextContent(
                type="text",
                text=f"Index metrics: {json.dumps(metrics.__dict__, default=json_serializer)}",
            )
        ]
  • Registration of get-index-metrics tool in MCP list_tools handler, including input schema
    types.Tool(
        name="get-index-metrics",
        description="Get detailed metrics for an index",
        inputSchema={
            "type": "object",
            "properties": {"indexUid": {"type": "string"}},
            "required": ["indexUid"],
            "additionalProperties": False,
        },
    ),
  • Dataclass defining the structure of index metrics returned by the tool
    class IndexMetrics:
        """Detailed index metrics"""
    
        number_of_documents: int
        field_distribution: Dict[str, int]
        is_indexing: bool
        index_size: Optional[int] = None
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'Get detailed metrics' but doesn't disclose behavioral traits such as whether this is a read-only operation, potential rate limits, authentication needs, or what the output format looks like. The description is minimal and lacks essential context for safe and effective use.

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

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words. It is appropriately sized and front-loaded, though it could benefit from more detail given the lack of annotations and schema coverage.

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 complexity (a tool with one parameter but no annotations or output schema), the description is incomplete. It doesn't explain what 'detailed metrics' include, how to interpret results, or usage context. For a tool with zero schema coverage and no annotations, more descriptive content is needed to guide the agent effectively.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'for an index' which hints at the 'indexUid' parameter, but provides no details on parameter meaning, format, or constraints. The description adds minimal value beyond the bare schema, failing to clarify what an 'indexUid' is or how to obtain it.

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 ('Get') and resource ('detailed metrics for an index'), making the purpose understandable. It distinguishes from siblings like 'get-stats' or 'get-health-status' by specifying 'metrics' for an index, though it could be more specific about what metrics are included.

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 'get-stats' or 'get-health-status'. The description implies it's for index-specific metrics, but it doesn't specify prerequisites, exclusions, or comparative contexts with sibling tools.

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

Related 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/meilisearch/meilisearch-mcp'

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