@hasna/contacts 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mcp/index.js +21 -5
  2. package/package.json +1 -1
package/dist/mcp/index.js CHANGED
@@ -2411,14 +2411,15 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
2411
2411
  },
2412
2412
  {
2413
2413
  name: "add_contact_to_group",
2414
- description: "Add a contact to a group.",
2414
+ description: "Add one or more contacts to a group. Pass contact_id for a single contact, or contact_ids (array) for bulk.",
2415
2415
  inputSchema: {
2416
2416
  type: "object",
2417
2417
  properties: {
2418
- contact_id: { type: "string" },
2418
+ contact_id: { type: "string", description: "Single contact ID (use contact_ids for bulk)" },
2419
+ contact_ids: { type: "array", items: { type: "string" }, description: "Multiple contact IDs to add at once" },
2419
2420
  group_id: { type: "string" }
2420
2421
  },
2421
- required: ["contact_id", "group_id"]
2422
+ required: ["group_id"]
2422
2423
  }
2423
2424
  },
2424
2425
  {
@@ -3109,8 +3110,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
3109
3110
  }
3110
3111
  case "add_contact_to_group": {
3111
3112
  const db = getDatabase();
3112
- const result = addContactToGroup(db, a.contact_id, a.group_id);
3113
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3113
+ const groupId = a.group_id;
3114
+ const ids = a.contact_ids ? a.contact_ids : [a.contact_id];
3115
+ if (ids.length === 1) {
3116
+ const result = addContactToGroup(db, ids[0], groupId);
3117
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3118
+ }
3119
+ let added = 0;
3120
+ const errors = [];
3121
+ for (const cid of ids) {
3122
+ try {
3123
+ addContactToGroup(db, cid, groupId);
3124
+ added++;
3125
+ } catch (e) {
3126
+ errors.push(`${cid}: ${e instanceof Error ? e.message : String(e)}`);
3127
+ }
3128
+ }
3129
+ return { content: [{ type: "text", text: JSON.stringify({ added, errors: errors.length, error_details: errors }, null, 2) }] };
3114
3130
  }
3115
3131
  case "remove_contact_from_group": {
3116
3132
  const db = getDatabase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/contacts",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Contact management for AI coding agents — CLI + MCP + Web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",