Skip to main content
Glama

delete_index

Delete a knowledge index and all its documents to remove outdated or unused data from your local RAG system.

Instructions

Delete a knowledge index and all its documents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
index_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler: deletes an index by name from the in-memory _indexes dict and persists the change via _save().
    def delete_index(index_name: str) -> dict[str, Any]:
        if index_name not in _indexes:
            raise ValueError(f"Index '{index_name}' not found.")
        del _indexes[index_name]
        _save()
        return {"status": "deleted", "name": index_name}
  • Registration of delete_index as an MCP tool via @mcp.tool decorator, delegating to kn.delete_index (knowledge.py).
    @mcp.tool(
        name="delete_index",
        description="Delete a knowledge index and all its documents.",
    )
    def delete_index(index_name: str) -> dict[str, Any]:
        """
        Args:
            index_name: The name of the index to delete.
        """
        return kn.delete_index(index_name)
  • The function signature acts as the schema: accepts string index_name, returns dict with status and name.
    def delete_index(index_name: str) -> dict[str, Any]:
        if index_name not in _indexes:
            raise ValueError(f"Index '{index_name}' not found.")
        del _indexes[index_name]
        _save()
  • Helper _save() persists the _indexes dict to JSON file, called by delete_index after removal.
    def _save() -> None:
        data = {}
        for idx_name, idx in _indexes.items():
            data[idx_name] = {
                "embed_model": idx.embed_model,
                "documents": [
                    {
                        "id": d.id,
                        "text": d.text,
                        "metadata": d.metadata,
                        "embedding": d.embedding,
                    }
                    for d in idx.documents
                ],
            }
        STORE_PATH.write_text(json.dumps(data))
Behavior3/5

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

Discloses destructive nature and scope (deletes both index and documents), but no details on irreversibility, permissions, or error handling. No annotations to supplement.

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?

Single sentence, no wasted words. Could be slightly expanded for clarity on permanence.

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?

Adequate for a simple delete tool with one parameter and output schema present. Lacks mention of return value or error cases.

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?

Single parameter index_name is self-explanatory from schema; description adds no additional semantics. Schema description coverage is 0%.

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

Purpose5/5

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

Describes specific action: delete a knowledge index and all its documents. Clearly distinguishes from siblings like create_index and list_indexes.

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 on when to use vs alternatives, no prerequisites or consequences mentioned.

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/deadSwank001/Nexus-MCP'

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