Skip to main content
Glama
vjsr007
by vjsr007

index-delete

Remove indexed notes by ID or key from the MCP Index Notes server. Returns a count or boolean confirmation for deleted entries, ensuring precise note management.

Instructions

Delete notes by id or by key. Returns count/boolean.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
keyNo

Implementation Reference

  • Main handler for the 'index-delete' MCP tool. Parses arguments using DeleteSchema, then calls db.deleteById(id) or db.deleteByKey(key) accordingly, returning JSON result.
    case 'index-delete': {
      const parsed = DeleteSchema.parse(args ?? {});
      if (parsed.id) {
        const ok = db.deleteById(parsed.id);
        return { content: [{ type: 'text', text: JSON.stringify({ ok }) }] };
      }
      if (parsed.key) {
        const count = db.deleteByKey(parsed.key);
        return { content: [{ type: 'text', text: JSON.stringify({ deleted: count }) }] };
      }
      return { content: [{ type: 'text', text: JSON.stringify({ error: 'Provide id or key' }) }] };
  • src/mcp.ts:122-132 (registration)
    Tool registration in the tools array, defining name, description, and inputSchema for 'index-delete'.
    {
      name: 'index-delete',
      description: 'Delete notes by id or by key. Returns count/boolean.',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'number' },
          key: { type: 'string' },
        },
      },
    },
  • Zod schema (DeleteSchema) used for input validation in the index-delete handler.
    export const DeleteSchema = z.object({
      id: z.number().int().positive().optional(),
      key: z.string().optional(),
    });
  • Database helper method deleteById(id) called by the tool handler when deleting by note ID.
    deleteById(id: number) {
      logger.warn({ id }, 'Deleting note by id');
      const info = this.db.prepare(`DELETE FROM notes WHERE id = ?`).run(id);
      return info.changes > 0;
    }
  • Database helper method deleteByKey(key) called by the tool handler when deleting by key.
    deleteByKey(key: string) {
      logger.warn({ key }, 'Deleting notes by key');
      const info = this.db.prepare(`DELETE FROM notes WHERE key = ?`).run(key);
      return info.changes;
    }

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/vjsr007/mcp-index-notes'

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