Skip to main content
Glama

bulk_update

Update multiple memories simultaneously by specifying memory IDs and new field values. Modify content, importance, scope, type, category, subject, or tags for up to 50 items per operation.

Instructions

Update multiple memories at once. Each item needs a memory_id and fields to update. Maximum 50 items per call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatesYesArray of update objects (max 50)

Implementation Reference

  • Handler function for bulk_update tool - calls the API endpoint /cogmemai/bulk-update with POST method, passing the updates array and returning wrapped result or error.
    async ({ updates }) => {
      try {
        const result = await api('/cogmemai/bulk-update', 'POST', { updates });
        return wrapResult(result);
      } catch (error) {
        return wrapError(error);
      }
    }
  • Zod schema definition for bulk_update input - validates an array of update objects (1-50 items), each containing memory_id (required) and optional fields: content, importance, scope, memory_type, category, subject, tags.
    updates: z
      .array(
        z.object({
          memory_id: z.coerce.number().int().describe('Memory ID to update'),
          content: z.string().min(5).max(2000).optional().describe('New content'),
          importance: z.coerce.number().int().min(1).max(10).optional().describe('New importance'),
          scope: z.enum(['global', 'project']).optional().describe('New scope'),
          memory_type: z.enum(MEMORY_TYPES).optional().describe('New memory type'),
          category: z.string().max(50).optional().describe('New category'),
          subject: z.string().max(100).optional().describe('New subject'),
          tags: z.array(z.string().max(30)).max(5).optional().describe('New tags'),
        })
      )
      .min(1)
      .max(50)
      .describe('Array of update objects (max 50)'),
  • src/tools.ts:566-595 (registration)
    Full tool registration using server.tool() - registers 'bulk_update' with description, input schema, and handler function.
    server.tool(
      'bulk_update',
      'Update multiple memories at once. Each item needs a memory_id and fields to update. Maximum 50 items per call.',
      {
        updates: z
          .array(
            z.object({
              memory_id: z.coerce.number().int().describe('Memory ID to update'),
              content: z.string().min(5).max(2000).optional().describe('New content'),
              importance: z.coerce.number().int().min(1).max(10).optional().describe('New importance'),
              scope: z.enum(['global', 'project']).optional().describe('New scope'),
              memory_type: z.enum(MEMORY_TYPES).optional().describe('New memory type'),
              category: z.string().max(50).optional().describe('New category'),
              subject: z.string().max(100).optional().describe('New subject'),
              tags: z.array(z.string().max(30)).max(5).optional().describe('New tags'),
            })
          )
          .min(1)
          .max(50)
          .describe('Array of update objects (max 50)'),
      },
      async ({ updates }) => {
        try {
          const result = await api('/cogmemai/bulk-update', 'POST', { updates });
          return wrapResult(result);
        } catch (error) {
          return wrapError(error);
        }
      }
    );
  • wrapError helper function - formats error messages for MCP tool responses, used by the bulk_update handler to return errors.
    function wrapError(error: unknown): { content: Array<{ type: 'text'; text: string }>; isError: true } {
      const message = error instanceof Error ? error.message : String(error);
      return {
        content: [{
          type: 'text' as const,
          text: JSON.stringify({ error: message }),
        }],
        isError: true,
      };
    }

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/hifriendbot/cogmemai-mcp'

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