@connect-xlab/mcp-server 0.3.3 → 0.3.5
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/index.js +16 -0
- package/dist/tools/checkPartnerAgentLinks.js +40 -0
- package/dist/tools/createLinkInBioBlock.js +3 -3
- package/dist/tools/createPartnerAgent.js +45 -0
- package/dist/tools/deletePartnerAgent.js +33 -0
- package/dist/tools/getPartnerAgent.js +33 -0
- package/dist/tools/getPartnerAgentStats.js +39 -0
- package/dist/tools/listPartnerAgents.js +31 -0
- package/dist/tools/partnerAgentFields.js +29 -0
- package/dist/tools/setPartnerAgentPublished.js +35 -0
- package/dist/tools/updateLinkInBioBlock.js +3 -3
- package/dist/tools/updatePartnerAgent.js +45 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -199,6 +199,14 @@ import { rejectAssistantActionTool } from './tools/rejectAssistantAction.js';
|
|
|
199
199
|
import { correctAssistantActionTool } from './tools/correctAssistantAction.js';
|
|
200
200
|
import { requestAssistantPostDraftTool } from './tools/requestAssistantPostDraft.js';
|
|
201
201
|
import { getAssistantSummaryTool } from './tools/getAssistantSummary.js';
|
|
202
|
+
import { listPartnerAgentsTool } from './tools/listPartnerAgents.js';
|
|
203
|
+
import { getPartnerAgentTool } from './tools/getPartnerAgent.js';
|
|
204
|
+
import { createPartnerAgentTool } from './tools/createPartnerAgent.js';
|
|
205
|
+
import { updatePartnerAgentTool } from './tools/updatePartnerAgent.js';
|
|
206
|
+
import { setPartnerAgentPublishedTool } from './tools/setPartnerAgentPublished.js';
|
|
207
|
+
import { deletePartnerAgentTool } from './tools/deletePartnerAgent.js';
|
|
208
|
+
import { checkPartnerAgentLinksTool } from './tools/checkPartnerAgentLinks.js';
|
|
209
|
+
import { getPartnerAgentStatsTool } from './tools/getPartnerAgentStats.js';
|
|
202
210
|
const tools = [
|
|
203
211
|
listLabsTool,
|
|
204
212
|
listMembersTool,
|
|
@@ -397,6 +405,14 @@ const tools = [
|
|
|
397
405
|
correctAssistantActionTool,
|
|
398
406
|
requestAssistantPostDraftTool,
|
|
399
407
|
getAssistantSummaryTool,
|
|
408
|
+
listPartnerAgentsTool,
|
|
409
|
+
getPartnerAgentTool,
|
|
410
|
+
createPartnerAgentTool,
|
|
411
|
+
updatePartnerAgentTool,
|
|
412
|
+
setPartnerAgentPublishedTool,
|
|
413
|
+
deletePartnerAgentTool,
|
|
414
|
+
checkPartnerAgentLinksTool,
|
|
415
|
+
getPartnerAgentStatsTool,
|
|
400
416
|
];
|
|
401
417
|
const server = new Server({ name: 'connectxlab', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
402
418
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `check_partner_agent_links` — verifie que des liens repondent.
|
|
3
|
+
* Scope : partner_agents.read. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const checkPartnerAgentLinksTool = {
|
|
8
|
+
name: 'check_partner_agent_links',
|
|
9
|
+
description: "Verifie que le lien d'affiliation et/ou le site de l'editeur repondent avant de les enregistrer. Simple avertissement : certains sites bloquent les verifications.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
affiliate: { type: 'string', description: "Lien d'affiliation (https://)" },
|
|
15
|
+
landing: { type: 'string', description: "Site de l'editeur (https://)" },
|
|
16
|
+
},
|
|
17
|
+
required: ['lab'],
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
},
|
|
20
|
+
zodSchema: z.object({
|
|
21
|
+
lab: z.string(),
|
|
22
|
+
affiliate: z.string().max(2000).optional(),
|
|
23
|
+
landing: z.string().max(2000).optional(),
|
|
24
|
+
}),
|
|
25
|
+
async handler(args) {
|
|
26
|
+
const { lab, affiliate, landing } = this.zodSchema.parse(args);
|
|
27
|
+
const urls = {};
|
|
28
|
+
if (affiliate)
|
|
29
|
+
urls.affiliate = affiliate;
|
|
30
|
+
if (landing)
|
|
31
|
+
urls.landing = landing;
|
|
32
|
+
try {
|
|
33
|
+
const { data } = await http.post(`/mcp/labs/${encodeURIComponent(lab)}/partner-agents/check-links`, { urls });
|
|
34
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -23,7 +23,7 @@ export const createLinkInBioBlockTool = {
|
|
|
23
23
|
"- kind=lab : autre Lab de l'owner (lab_group_id requis)\n" +
|
|
24
24
|
"- kind=quiz : quiz du Lab (quiz_id requis). Le bloc reste masque sur la page publique tant que le quiz n'est pas publie et le plug-in Quiz active.\n" +
|
|
25
25
|
"- kind=calendar : calendrier du Lab (calendar_event_id requis, ids via get_link_in_bio_catalog ou list_calendars). La reservation s'ouvre en fenetre sur la page publique. Masque si le calendrier est inactif ; un calendrier payant doit etre vendu dans une boutique Stripe active.\n" +
|
|
26
|
-
"Les ids se trouvent via get_link_in_bio_catalog. Champs optionnels : subtitle, image_url, layout (forme du bloc : classic = petite image + bouton a droite, par defaut ; image = texte et bouton a contour a gauche, grande image a droite ; button = image + titre en haut, gros bouton pleine largeur en dessous), button_label (texte du bouton, 60 car. max ; vide = texte par defaut du type de bloc). Position en fin de liste (utiliser reorder pour changer).",
|
|
26
|
+
"Les ids se trouvent via get_link_in_bio_catalog. Champs optionnels : subtitle, image_url, layout (forme du bloc : classic = petite image + bouton a droite, par defaut ; image = texte et bouton a contour a gauche, grande image a droite ; image_left = pareil avec la grande image a gauche ; button = image + titre en haut, gros bouton pleine largeur en dessous, image a gauche ; button_right = pareil, image a droite ; button_cover = image en fond sur toute la largeur, titre ecrit dessus, bouton en dessous), button_label (texte du bouton, 60 car. max ; vide = texte par defaut du type de bloc). Position en fin de liste (utiliser reorder pour changer).",
|
|
27
27
|
inputSchema: {
|
|
28
28
|
type: 'object',
|
|
29
29
|
properties: {
|
|
@@ -31,7 +31,7 @@ export const createLinkInBioBlockTool = {
|
|
|
31
31
|
kind: { type: 'string', enum: [...KINDS] },
|
|
32
32
|
title: { type: 'string', maxLength: 200 },
|
|
33
33
|
subtitle: { type: 'string', maxLength: 300 },
|
|
34
|
-
layout: { type: 'string', enum: ['classic', 'image', 'button'] },
|
|
34
|
+
layout: { type: 'string', enum: ['classic', 'image', 'image_left', 'button', 'button_right', 'button_cover'] },
|
|
35
35
|
button_label: { type: 'string', maxLength: 60 },
|
|
36
36
|
url: { type: 'string', description: 'kind=external : URL du lien' },
|
|
37
37
|
image_url: { type: 'string' },
|
|
@@ -49,7 +49,7 @@ export const createLinkInBioBlockTool = {
|
|
|
49
49
|
kind: z.enum(KINDS),
|
|
50
50
|
title: z.string().max(200),
|
|
51
51
|
subtitle: z.string().max(300).optional(),
|
|
52
|
-
layout: z.enum(['classic', 'image', 'button']).optional(),
|
|
52
|
+
layout: z.enum(['classic', 'image', 'image_left', 'button', 'button_right', 'button_cover']).optional(),
|
|
53
53
|
button_label: z.string().max(60).optional(),
|
|
54
54
|
url: z.string().optional(),
|
|
55
55
|
image_url: z.string().optional(),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `create_partner_agent` — cree un agent partenaire et sa page de vente.
|
|
3
|
+
* Scope : partner_agents.write. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
import { partnerAgentProperties, partnerAgentZod } from './partnerAgentFields.js';
|
|
8
|
+
export const createPartnerAgentTool = {
|
|
9
|
+
name: 'create_partner_agent',
|
|
10
|
+
description: "Cree un agent partenaire dans le Lab officiel XLab : carte marketplace + page de vente dont les boutons menent au lien d'affiliation (suivi des vues et clics). Jamais propose en tunnel de vente, sans abonnement XLab. Publie par defaut (published=false pour le garder masque). Action visible publiquement : la faire confirmer.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
15
|
+
...partnerAgentProperties,
|
|
16
|
+
published: { type: 'boolean', description: 'Visible sur la marketplace (defaut true)' },
|
|
17
|
+
},
|
|
18
|
+
required: ['lab', 'title', 'short_description', 'call_to_action_text', 'shop_image', 'affiliate_url'],
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
},
|
|
21
|
+
zodSchema: z.object({
|
|
22
|
+
lab: z.string(),
|
|
23
|
+
title: partnerAgentZod.title,
|
|
24
|
+
short_description: partnerAgentZod.short_description,
|
|
25
|
+
description: partnerAgentZod.description.optional(),
|
|
26
|
+
call_to_action_text: partnerAgentZod.call_to_action_text,
|
|
27
|
+
shop_image: partnerAgentZod.shop_image,
|
|
28
|
+
icon: partnerAgentZod.icon.optional(),
|
|
29
|
+
affiliate_url: partnerAgentZod.affiliate_url,
|
|
30
|
+
pricing_label: partnerAgentZod.pricing_label.optional(),
|
|
31
|
+
landing_template: partnerAgentZod.landing_template.optional(),
|
|
32
|
+
landing_external_url: partnerAgentZod.landing_external_url.optional(),
|
|
33
|
+
published: z.boolean().optional(),
|
|
34
|
+
}),
|
|
35
|
+
async handler(args) {
|
|
36
|
+
const { lab, ...body } = this.zodSchema.parse(args);
|
|
37
|
+
try {
|
|
38
|
+
const { data } = await http.post(`/mcp/labs/${encodeURIComponent(lab)}/partner-agents`, body);
|
|
39
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `delete_partner_agent` — supprime un agent partenaire et ses statistiques.
|
|
3
|
+
* Scope : partner_agents.write. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const deletePartnerAgentTool = {
|
|
8
|
+
name: 'delete_partner_agent',
|
|
9
|
+
description: "Supprime definitivement un agent partenaire (carte, page de vente, vues et clics). Irreversible : la faire confirmer. Pour le retirer temporairement : set_partner_agent_published false.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
agent_id: { type: 'number', description: 'id de l agent partenaire (list_partner_agents)' },
|
|
15
|
+
},
|
|
16
|
+
required: ['lab', 'agent_id'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
zodSchema: z.object({
|
|
20
|
+
lab: z.string(),
|
|
21
|
+
agent_id: z.number().int().min(1),
|
|
22
|
+
}),
|
|
23
|
+
async handler(args) {
|
|
24
|
+
const p = this.zodSchema.parse(args);
|
|
25
|
+
try {
|
|
26
|
+
const { data } = await http.delete(`/mcp/labs/${encodeURIComponent(p.lab)}/partner-agents/${p.agent_id}`);
|
|
27
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `get_partner_agent` — detail d'un agent partenaire (page de vente complete).
|
|
3
|
+
* Scope : partner_agents.read. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const getPartnerAgentTool = {
|
|
8
|
+
name: 'get_partner_agent',
|
|
9
|
+
description: "Detail d'un agent partenaire du Lab officiel : textes de la page de vente (description HTML comprise), image, lien d'affiliation, texte du bouton, prix affiche, publication et liens suivis (page de vente, affiliation).",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
agent_id: { type: 'number', description: 'id de l agent partenaire (list_partner_agents)' },
|
|
15
|
+
},
|
|
16
|
+
required: ['lab', 'agent_id'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
zodSchema: z.object({
|
|
20
|
+
lab: z.string(),
|
|
21
|
+
agent_id: z.number().int().min(1),
|
|
22
|
+
}),
|
|
23
|
+
async handler(args) {
|
|
24
|
+
const p = this.zodSchema.parse(args);
|
|
25
|
+
try {
|
|
26
|
+
const { data } = await http.get(`/mcp/labs/${encodeURIComponent(p.lab)}/partner-agents/${p.agent_id}`);
|
|
27
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `get_partner_agent_stats` — vues et clics d'un agent partenaire, jour par jour.
|
|
3
|
+
* Scope : partner_agents.read. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const getPartnerAgentStatsTool = {
|
|
8
|
+
name: 'get_partner_agent_stats',
|
|
9
|
+
description: "Vues de la page de vente et clics vers le lien d'affiliation d'un agent partenaire, jour par jour. period : today, 7d, 30d (defaut) ou custom avec from / to (YYYY-MM-DD, 366 jours max).",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
agent_id: { type: 'number', description: 'id de l agent partenaire (list_partner_agents)' },
|
|
15
|
+
period: { type: 'string', enum: ['today', '7d', '30d', 'custom'] },
|
|
16
|
+
from: { type: 'string', description: 'YYYY-MM-DD (period=custom)' },
|
|
17
|
+
to: { type: 'string', description: 'YYYY-MM-DD (period=custom)' },
|
|
18
|
+
},
|
|
19
|
+
required: ['lab', 'agent_id'],
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
},
|
|
22
|
+
zodSchema: z.object({
|
|
23
|
+
lab: z.string(),
|
|
24
|
+
agent_id: z.number().int().min(1),
|
|
25
|
+
period: z.enum(['today', '7d', '30d', 'custom']).optional(),
|
|
26
|
+
from: z.string().optional(),
|
|
27
|
+
to: z.string().optional(),
|
|
28
|
+
}),
|
|
29
|
+
async handler(args) {
|
|
30
|
+
const { lab, agent_id, ...params } = this.zodSchema.parse(args);
|
|
31
|
+
try {
|
|
32
|
+
const { data } = await http.get(`/mcp/labs/${encodeURIComponent(lab)}/partner-agents/${agent_id}/stats`, { params });
|
|
33
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `list_partner_agents` — agents partenaires du Lab officiel XLab.
|
|
3
|
+
* Scope : partner_agents.read. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const listPartnerAgentsTool = {
|
|
8
|
+
name: 'list_partner_agents',
|
|
9
|
+
description: "Liste les agents partenaires (agents IA d'autres editeurs vendus via un lien d'affiliation) du Lab officiel XLab : titre, image, lien d'affiliation, prix affiche, publication, vues et clics sur 30 jours. Reserve au super admin, uniquement dans le Lab officiel.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
},
|
|
15
|
+
required: ['lab'],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
},
|
|
18
|
+
zodSchema: z.object({
|
|
19
|
+
lab: z.string(),
|
|
20
|
+
}),
|
|
21
|
+
async handler(args) {
|
|
22
|
+
const p = this.zodSchema.parse(args);
|
|
23
|
+
try {
|
|
24
|
+
const { data } = await http.get(`/mcp/labs/${encodeURIComponent(p.lab)}/partner-agents`);
|
|
25
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Champs de la page de vente d'un agent partenaire, partages par
|
|
3
|
+
* create_partner_agent et update_partner_agent.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const partnerAgentProperties = {
|
|
7
|
+
title: { type: 'string', maxLength: 255, description: "Nom de l'agent" },
|
|
8
|
+
short_description: { type: 'string', maxLength: 500, description: 'Phrase courte de la carte marketplace' },
|
|
9
|
+
description: { type: 'string', description: 'Description de la page de vente (HTML simple accepte)' },
|
|
10
|
+
call_to_action_text: { type: 'string', maxLength: 120, description: 'Texte du bouton de la page de vente (ex. "Essayer l\'agent")' },
|
|
11
|
+
shop_image: { type: 'string', description: "Image de la carte : URL https ou image encodee (data:image/...;base64,...)" },
|
|
12
|
+
icon: { type: 'string', description: 'Logo (URL https ou data URI), optionnel' },
|
|
13
|
+
affiliate_url: { type: 'string', maxLength: 2000, description: "Lien d'affiliation chez l'editeur, en https:// (les boutons de la page y menent)" },
|
|
14
|
+
pricing_label: { type: 'string', maxLength: 80, description: 'Prix affiche, texte libre (ex. "Des 29 euros/mois")' },
|
|
15
|
+
landing_template: { type: 'string', enum: ['', 'external_url'], description: '"" = page de vente XLab ; "external_url" = la carte mene au site de l editeur' },
|
|
16
|
+
landing_external_url: { type: 'string', maxLength: 2000, description: "Site de l'editeur en https:// (obligatoire si landing_template = external_url)" },
|
|
17
|
+
};
|
|
18
|
+
export const partnerAgentZod = {
|
|
19
|
+
title: z.string().max(255),
|
|
20
|
+
short_description: z.string().max(500),
|
|
21
|
+
description: z.string(),
|
|
22
|
+
call_to_action_text: z.string().max(120),
|
|
23
|
+
shop_image: z.string(),
|
|
24
|
+
icon: z.string().nullable(),
|
|
25
|
+
affiliate_url: z.string().max(2000),
|
|
26
|
+
pricing_label: z.string().max(80).nullable(),
|
|
27
|
+
landing_template: z.enum(['', 'external_url']),
|
|
28
|
+
landing_external_url: z.string().max(2000).nullable(),
|
|
29
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `set_partner_agent_published` — publie ou masque un agent partenaire.
|
|
3
|
+
* Scope : partner_agents.write. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
export const setPartnerAgentPublishedTool = {
|
|
8
|
+
name: 'set_partner_agent_published',
|
|
9
|
+
description: "Publie (published=true) ou masque (false) un agent partenaire sur la marketplace. Action visible publiquement : la faire confirmer.",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
14
|
+
agent_id: { type: 'number', description: 'id de l agent partenaire (list_partner_agents)' },
|
|
15
|
+
published: { type: 'boolean' },
|
|
16
|
+
},
|
|
17
|
+
required: ['lab', 'agent_id', 'published'],
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
},
|
|
20
|
+
zodSchema: z.object({
|
|
21
|
+
lab: z.string(),
|
|
22
|
+
agent_id: z.number().int().min(1),
|
|
23
|
+
published: z.boolean(),
|
|
24
|
+
}),
|
|
25
|
+
async handler(args) {
|
|
26
|
+
const p = this.zodSchema.parse(args);
|
|
27
|
+
try {
|
|
28
|
+
const { data } = await http.put(`/mcp/labs/${encodeURIComponent(p.lab)}/partner-agents/${p.agent_id}/published`, { published: p.published });
|
|
29
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|
|
7
7
|
import { http, formatApiError } from '../http.js';
|
|
8
8
|
export const updateLinkInBioBlockTool = {
|
|
9
9
|
name: 'update_link_in_bio_block',
|
|
10
|
-
description: "Modifie un bloc existant (identifie par block_id, entier renvoye par get_link_in_bio ou create_link_in_bio_block). Seuls les champs fournis changent : title, subtitle, url (bloc externe), image_url, layout (forme du bloc : classic = petite image + bouton a droite, par defaut ; image = texte et bouton a contour a gauche, grande image a droite ; button = image + titre en haut, gros bouton pleine largeur en dessous), button_label (texte du bouton, 60 car. max ; vide = texte par defaut du type de bloc), quiz_id (bloc quiz), calendar_event_id (bloc calendrier), lab_group_id (bloc Lab), is_active (afficher/masquer sans supprimer). Le type (kind) d'un bloc ne change pas.",
|
|
10
|
+
description: "Modifie un bloc existant (identifie par block_id, entier renvoye par get_link_in_bio ou create_link_in_bio_block). Seuls les champs fournis changent : title, subtitle, url (bloc externe), image_url, layout (forme du bloc : classic = petite image + bouton a droite, par defaut ; image = texte et bouton a contour a gauche, grande image a droite ; image_left = pareil avec la grande image a gauche ; button = image + titre en haut, gros bouton pleine largeur en dessous, image a gauche ; button_right = pareil, image a droite ; button_cover = image en fond sur toute la largeur, titre ecrit dessus, bouton en dessous), button_label (texte du bouton, 60 car. max ; vide = texte par defaut du type de bloc), quiz_id (bloc quiz), calendar_event_id (bloc calendrier), lab_group_id (bloc Lab), is_active (afficher/masquer sans supprimer). Le type (kind) d'un bloc ne change pas.",
|
|
11
11
|
inputSchema: {
|
|
12
12
|
type: 'object',
|
|
13
13
|
properties: {
|
|
@@ -15,7 +15,7 @@ export const updateLinkInBioBlockTool = {
|
|
|
15
15
|
block_id: { type: 'number', minimum: 1 },
|
|
16
16
|
title: { type: 'string', maxLength: 200 },
|
|
17
17
|
subtitle: { type: 'string', maxLength: 300 },
|
|
18
|
-
layout: { type: 'string', enum: ['classic', 'image', 'button'] },
|
|
18
|
+
layout: { type: 'string', enum: ['classic', 'image', 'image_left', 'button', 'button_right', 'button_cover'] },
|
|
19
19
|
button_label: { type: 'string', maxLength: 60 },
|
|
20
20
|
url: { type: 'string' },
|
|
21
21
|
image_url: { type: 'string' },
|
|
@@ -32,7 +32,7 @@ export const updateLinkInBioBlockTool = {
|
|
|
32
32
|
block_id: z.number().int().positive(),
|
|
33
33
|
title: z.string().max(200).optional(),
|
|
34
34
|
subtitle: z.string().max(300).optional(),
|
|
35
|
-
layout: z.enum(['classic', 'image', 'button']).optional(),
|
|
35
|
+
layout: z.enum(['classic', 'image', 'image_left', 'button', 'button_right', 'button_cover']).optional(),
|
|
36
36
|
button_label: z.string().max(60).optional(),
|
|
37
37
|
url: z.string().optional(),
|
|
38
38
|
image_url: z.string().optional(),
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool `update_partner_agent` — modifie la page de vente d'un agent partenaire.
|
|
3
|
+
* Scope : partner_agents.write. Super admin, Lab officiel uniquement.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { http, formatApiError } from '../http.js';
|
|
7
|
+
import { partnerAgentProperties, partnerAgentZod } from './partnerAgentFields.js';
|
|
8
|
+
export const updatePartnerAgentTool = {
|
|
9
|
+
name: 'update_partner_agent',
|
|
10
|
+
description: "Modifie un agent partenaire du Lab officiel : n'envoyer que les champs a changer, les autres gardent leur valeur (textes, image, lien d'affiliation, texte du bouton, prix affiche, type de page). Pour publier ou masquer : set_partner_agent_published.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
lab: { type: 'string', description: 'group_url ou id du Lab officiel XLab' },
|
|
15
|
+
agent_id: { type: 'number', description: 'id de l agent partenaire (list_partner_agents)' },
|
|
16
|
+
...partnerAgentProperties,
|
|
17
|
+
},
|
|
18
|
+
required: ['lab', 'agent_id'],
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
},
|
|
21
|
+
zodSchema: z.object({
|
|
22
|
+
lab: z.string(),
|
|
23
|
+
agent_id: z.number().int().min(1),
|
|
24
|
+
title: partnerAgentZod.title.optional(),
|
|
25
|
+
short_description: partnerAgentZod.short_description.optional(),
|
|
26
|
+
description: partnerAgentZod.description.optional(),
|
|
27
|
+
call_to_action_text: partnerAgentZod.call_to_action_text.optional(),
|
|
28
|
+
shop_image: partnerAgentZod.shop_image.optional(),
|
|
29
|
+
icon: partnerAgentZod.icon.optional(),
|
|
30
|
+
affiliate_url: partnerAgentZod.affiliate_url.optional(),
|
|
31
|
+
pricing_label: partnerAgentZod.pricing_label.optional(),
|
|
32
|
+
landing_template: partnerAgentZod.landing_template.optional(),
|
|
33
|
+
landing_external_url: partnerAgentZod.landing_external_url.optional(),
|
|
34
|
+
}),
|
|
35
|
+
async handler(args) {
|
|
36
|
+
const { lab, agent_id, ...body } = this.zodSchema.parse(args);
|
|
37
|
+
try {
|
|
38
|
+
const { data } = await http.put(`/mcp/labs/${encodeURIComponent(lab)}/partner-agents/${agent_id}`, body);
|
|
39
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
package/package.json
CHANGED