Skip to main content
Glama

delete_record

Remove a specific record from a resource by specifying its URI and record ID. Ideal for maintaining up-to-date and accurate data in your MCP Template server.

Instructions

Delete a record from a resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordIdYesID of the record to delete
resourceUriYesURI of the resource

Implementation Reference

  • Tool handler for 'delete_record' that validates arguments and calls dataService.deleteRecord, returning success status.
    case 'delete_record': {
      return await safeExecute(toolName, async () => {
        const args = validateInput(DeleteRecordArgsSchema, request.params.arguments);
        const success = await this.dataService.deleteRecord(args.resourceUri, args.recordId);
        return { success, id: args.recordId };
      });
    }
  • Zod input schema defining resourceUri and recordId for the delete_record tool.
    export const DeleteRecordArgsSchema = z.object({
      resourceUri: z.string().describe('URI of the resource'),
      recordId: z.string().describe('ID of the record to delete'),
    });
  • Tool registration in handleListTools method, providing name, description, and input schema.
    {
      name: 'delete_record',
      description: 'Delete a record from a resource',
      inputSchema: getInputSchema(DeleteRecordArgsSchema),
    },
  • Core implementation of deleteRecord in InMemoryDataService, which deletes the record by ID from the in-memory Map.
    public async deleteRecord(uri: string, id: string): Promise<boolean> {
      this.validateResource(uri);
      
      const resourceData = this.data.get(uri)!;
      
      if (!resourceData.has(id)) {
        throw new Error(`Record not found: ${id}`);
      }
      
      return resourceData.delete(id);
    }
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/kbhuw/MCP_TEMPLATE'

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