truncate_collection
Delete all documents in a collection while preserving its schema. This process retrieves the schema, deletes the collection, and recreates it with the same structure, ensuring data is cleared without altering the schema design.
Instructions
Truncates a collection by deleting all documents but keeping the schema.
Achieved by retrieving schema, deleting collection, and recreating it.
Args:
ctx (Context): The MCP context.
collection_name (str): The name of the collection to truncate.
Returns:
str: A success or error message string.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
collection_name | Yes |
Input Schema (JSON Schema)
{
"properties": {
"collection_name": {
"title": "Collection Name",
"type": "string"
}
},
"required": [
"collection_name"
],
"title": "truncate_collectionArguments",
"type": "object"
}