Skip to main content
Glama
datastax

Astra DB MCP Server

Official

UpdateRecord

Modify an existing record in a specified collection using its unique ID and updated data. Integrates with Astra DB MCP Server to manage database records via natural language commands.

Instructions

Update an existing record in a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionNameYesName of the collection containing the record
recordYesThe updated record data
recordIdYesID of the record to update

Implementation Reference

  • The core handler function that executes the UpdateRecord tool logic. It updates a specific record in a MongoDB collection by ID, removes _id from update data, and returns success message or throws error if not found.
    export async function UpdateRecord(params: {
      collectionName: string;
      recordId: string;
      record: Record<string, any>;
    }) {
      const { collectionName, recordId, record } = params;
    
      const collection = db.collection(collectionName);
    
      // Remove _id from the record if it exists, as it cannot be updated
      const updateData = { ...record };
      delete updateData._id;
    
      const result = await collection.updateOne(
        { _id: recordId },
        { $set: updateData }
      );
    
      if (result.matchedCount === 0) {
        throw new Error(
          `Record with ID '${recordId}' not found in collection '${collectionName}'`
        );
      }
    
      return {
        success: true,
        message: `Record '${recordId}' updated successfully in collection '${collectionName}'`,
      };
    }
  • Defines the tool's metadata including name, description, and input schema used for validation in MCP tool listing.
    {
      name: "UpdateRecord",
      description: "Update an existing record in a collection",
      inputSchema: {
        type: "object",
        properties: {
          collectionName: {
            type: "string",
            description: "Name of the collection containing the record",
          },
          recordId: {
            type: "string",
            description: "ID of the record to update",
          },
          record: {
            type: "object",
            description: "The updated record data",
          },
        },
        required: ["collectionName", "recordId", "record"],
      },
    },
  • index.ts:61-65 (registration)
    Registers the list tools handler which returns the tools array including UpdateRecord schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools,
      };
    });
  • index.ts:186-199 (registration)
    The switch case in the CallToolRequest handler that dispatches to the UpdateRecord function based on tool name.
    case "UpdateRecord":
      const updateRecordResult = await UpdateRecord({
        collectionName: args.collectionName as string,
        recordId: args.recordId as string,
        record: args.record as Record<string, any>,
      });
      return {
        content: [
          {
            type: "text",
            text: updateRecordResult.message,
          },
        ],
      };
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 of behavioral disclosure. It states the action ('Update an existing record') but doesn't describe traits like permission requirements, whether updates are partial or full, error handling (e.g., if record doesn't exist), or side effects. For a mutation tool with zero annotation coverage, this is a significant gap.

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's front-loaded with the core action and resource, making it easy to parse. Every word earns its place without redundancy or fluff.

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 no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., auth needs, error cases), return values, or usage context. The schema covers parameters well, but overall completeness is inadequate for safe and effective tool invocation.

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 already documents all three parameters ('collectionName', 'recordId', 'record') with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when 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 verb ('Update') and resource ('an existing record in a collection'), making the purpose unambiguous. It distinguishes from siblings like 'CreateRecord' (for new records) and 'BulkUpdateRecords' (for multiple updates), though it doesn't explicitly name these alternatives. The specificity is good but lacks explicit sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., record must exist), exclusions (e.g., not for bulk operations), or compare with siblings like 'BulkUpdateRecords' or 'UpdateCollection'. Usage is implied by the verb 'Update' but lacks explicit context.

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