Skip to main content
Glama
meilisearch

Meilisearch MCP Server

Official
by meilisearch

create-key

Generate API keys with specific permissions and expiration for managing Meilisearch indexes, ensuring controlled access and security.

Instructions

Create a new API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYes
descriptionNo
expiresAtNo
indexesYes

Implementation Reference

  • Executes the 'create-key' tool by calling KeyManager.create_key with parsed arguments and returns the result.
    elif name == "create-key":
        key = self.meili_client.keys.create_key(
            {
                "description": arguments.get("description"),
                "actions": arguments["actions"],
                "indexes": arguments["indexes"],
                "expiresAt": arguments.get("expiresAt"),
            }
        )
        return [
            types.TextContent(type="text", text=f"Created API key: {key}")
        ]
  • Registers the 'create-key' tool in the MCP server's list_tools handler, defining its name, description, and input schema.
    types.Tool(
        name="create-key",
        description="Create a new API key",
        inputSchema={
            "type": "object",
            "properties": {
                "description": {"type": "string"},
                "actions": {"type": "array", "items": {"type": "string"}},
                "indexes": {"type": "array", "items": {"type": "string"}},
                "expiresAt": {"type": "string"},
            },
            "required": ["actions", "indexes"],
            "additionalProperties": False,
        },
    ),
  • KeyManager helper method that wraps the Meilisearch client's create_key method to create a new API key.
    def create_key(self, options: Dict[str, Any]) -> Dict[str, Any]:
        """Create a new API key"""
        try:
            return self.client.create_key(options)
        except Exception as e:
            raise Exception(f"Failed to create key: {str(e)}")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Create a new API key,' implying a write operation, but does not cover critical aspects like authentication requirements, rate limits, whether the key is immediately usable, or what happens on failure. This leaves significant gaps for a mutation tool.

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 with zero waste, making it highly concise and front-loaded. It directly states the tool's purpose without unnecessary elaboration, which is appropriate for its brevity.

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 of a mutation tool with 4 parameters (2 required), 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on parameters, behavioral traits, return values, and usage context, making it inadequate for effective tool invocation.

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 for undocumented parameters. It adds no meaning beyond the tool name, failing to explain what 'actions,' 'description,' 'expiresAt,' or 'indexes' represent, their formats, or how they affect key creation, leaving all four parameters semantically unclear.

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 'Create a new API key' clearly states the action (create) and resource (API key), making the purpose immediately understandable. However, it does not differentiate from sibling tools like 'get-keys' or 'delete-key' by specifying what makes this creation unique, such as the required parameters or scope.

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-keys' for viewing keys or 'delete-key' for removal. The description lacks context about prerequisites, such as needing specific permissions or when API keys are typically created, leaving the agent without usage direction.

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