Skip to main content
Glama
datastax

Astra DB MCP Server

Official

CreateCollection

Build a new database collection in Astra DB MCP Server, specifying collection name and optional vector properties for efficient data organization and retrieval.

Instructions

Create a new collection in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionNameYesName of the collection to create
dimensionNoThe dimensions of the vector collection, if vector is true
vectorNoWhether to create a vector collection

Implementation Reference

  • The core handler function that implements the CreateCollection tool logic. It creates a collection in Astra DB, optionally configuring it as a vector collection with specified dimensions and metric.
    export async function CreateCollection(params: {
      collectionName: string;
      vector?: boolean;
      dimension?: number;
      metric?: VectorMetric;
    }) {
      const { 
        collectionName, 
        vector = true, 
        dimension = 1536,
        metric = "cosine" as VectorMetric
      } = params;
    
      if (vector) {
        await db.createCollection(collectionName, {
          vector: {
            dimension: dimension,
            metric: metric
          },
        });
      } else {
        await db.createCollection(collectionName);
      }
    
      return {
        success: true,
        message: `Collection '${collectionName}' created successfully`,
      };
    }
  • The JSON schema definition for the CreateCollection tool input, including parameters like collectionName (required), vector, dimension, and metric with defaults.
    {
      name: "CreateCollection",
      description: "Create a new collection in the database",
      inputSchema: {
        type: "object",
        properties: {
          collectionName: {
            type: "string",
            description: "Name of the collection to create",
          },
          vector: {
            type: "boolean",
            description: "Whether to create a vector collection",
            default: true,
          },
          dimension: {
            type: "number",
            description:
              "The dimensions of the vector collection, if vector is true",
            default: 1536,
          },
          metric: {
            type: "string",
            description: "The similarity metric to use for vector search (cosine, euclidean, or dot_product)",
            default: "cosine",
            enum: ["cosine", "euclidean", "dot_product"]
          }
        },
        required: ["collectionName"],
      },
    },
  • index.ts:84-98 (registration)
    The registration and dispatch logic in the MCP server's CallToolRequest handler. It extracts arguments and calls the CreateCollection handler function, returning the result as MCP content.
    case "CreateCollection":
      const createResult = await CreateCollection({
        collectionName: args.collectionName as string,
        vector: args.vector as boolean | undefined,
        dimension: args.dimension as number | undefined,
        metric: args.metric as "cosine" | "euclidean" | "dot_product" | undefined,
      });
      return {
        content: [
          {
            type: "text",
            text: createResult.message,
          },
        ],
      };
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without disclosing behavioral traits like permissions needed, whether it's idempotent, error conditions, or what happens on success (e.g., returns a collection ID). For a mutation tool, this is a significant gap in transparency.

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—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, earning full marks for conciseness.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects, return values, or error handling, leaving gaps that could hinder an AI agent's correct invocation in a database context.

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%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying a 'collection' resource, which is already clear from the tool name and schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('Create') and resource ('a new collection in the database'), making the purpose unambiguous. However, it doesn't differentiate from siblings like 'UpdateCollection' or 'DeleteCollection' beyond the verb, missing specific scope details that would warrant a 5.

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 such as 'UpdateCollection' or 'GetCollections', nor does it mention prerequisites or exclusions. The description only states what it does, leaving usage context implied at best.

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/datastax/astra-db-mcp'

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