@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.
- package/dist/mcp/index.js +21 -5
- 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
|
|
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: ["
|
|
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
|
|
3113
|
-
|
|
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();
|