Skip to main content
Glama

delete_record

Remove a specific record from a NocoDB table by providing the base ID, table name, and record ID.

Instructions

Delete a single record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_idYesThe ID of the base/project
table_nameYesThe name of the table
record_idYesThe ID of the record to delete

Implementation Reference

  • The handler function that implements the core logic of the 'delete_record' tool. It invokes the NocoDBClient's deleteRecord method with the provided arguments and returns a success message.
    handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; record_id: string; }, ) => { await client.deleteRecord(args.base_id, args.table_name, args.record_id); return { message: "Record deleted successfully", record_id: args.record_id, }; },
  • The input schema defining the required parameters (base_id, table_name, record_id) for the 'delete_record' tool.
    inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, record_id: { type: "string", description: "The ID of the record to delete", }, }, required: ["base_id", "table_name", "record_id"], },
  • src/index.ts:55-62 (registration)
    The 'recordTools' array (which includes the 'delete_record' tool) is imported and spread into 'allTools', which is registered with the MCP server's ListToolsRequestSchema and CallToolRequestSchema handlers.
    const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];
  • Supporting method in NocoDBClient that resolves the table ID, determines the primary key field, and makes the API call to delete the record.
    async deleteRecord( baseId: string, tableName: string, recordId: string, ): Promise<void> { // First get table ID from table name const tables = await this.listTables(baseId); const table = tables.find( (t) => t.table_name === tableName || t.title === tableName, ); if (!table) { throw new NocoDBError(`Table ${tableName} not found`); } // Get the primary key field name (usually ID but can vary) const columns = await this.listColumns(table.id); const pkColumn = columns.find((col) => col.pk) || columns.find((col) => col.title === "ID"); const pkField = pkColumn?.title || "ID"; await this.client.delete(`/api/v2/tables/${table.id}/records`, { data: { [pkField]: recordId }, }); }

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/andrewlwn77/nocodb-mcp'

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