@taiga-ai/mcp-server 0.38.0-dev.1210 → 0.38.0-dev.1212
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 +259 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24102,6 +24102,14 @@ var TaigaClient = class {
|
|
|
24102
24102
|
async updateBacklogItem(itemId, body) {
|
|
24103
24103
|
return this.request("PATCH", `/backlog/${seg(itemId)}`, body);
|
|
24104
24104
|
}
|
|
24105
|
+
/** Everyone who can open a product, the people an initiative there can be assigned to (PRO-4982). */
|
|
24106
|
+
async listProductPeople(productId) {
|
|
24107
|
+
return this.request("GET", `/products/${seg(productId)}/people`);
|
|
24108
|
+
}
|
|
24109
|
+
/** Follows an initiative, or stops following it, for the key's own person (PRO-4982). */
|
|
24110
|
+
async setInitiativeFollowing(itemId, userId, subscribed) {
|
|
24111
|
+
return this.request("PUT", `/backlog/${seg(itemId)}/subscribers/${seg(userId)}`, { subscribed });
|
|
24112
|
+
}
|
|
24105
24113
|
/** Deletes an initiative as the web does: its runs stop and the pull request it waits on closes (PRO-4983). */
|
|
24106
24114
|
async deleteBacklogItem(itemId) {
|
|
24107
24115
|
return this.request("DELETE", `/backlog/${seg(itemId)}`);
|
|
@@ -37184,6 +37192,7 @@ const TOOLSET_OF = {
|
|
|
37184
37192
|
taiga_list_factories: "core",
|
|
37185
37193
|
taiga_list_initiatives: "core",
|
|
37186
37194
|
taiga_get_initiative: "core",
|
|
37195
|
+
taiga_list_product_people: "core",
|
|
37187
37196
|
taiga_get_plan: "core",
|
|
37188
37197
|
taiga_list_runs: "core",
|
|
37189
37198
|
taiga_get_run: "core",
|
|
@@ -37201,6 +37210,7 @@ const TOOLSET_OF = {
|
|
|
37201
37210
|
taiga_move_initiative: "operate",
|
|
37202
37211
|
taiga_update_initiative: "operate",
|
|
37203
37212
|
taiga_delete_initiative: "operate",
|
|
37213
|
+
taiga_follow_initiative: "operate",
|
|
37204
37214
|
taiga_review_plan: "operate",
|
|
37205
37215
|
taiga_plan_again: "operate",
|
|
37206
37216
|
taiga_resume_initiative: "operate",
|
|
@@ -37290,6 +37300,8 @@ const DELIVERY_TOOLS = /* @__PURE__ */ new Set([
|
|
|
37290
37300
|
"taiga_move_initiative",
|
|
37291
37301
|
"taiga_update_initiative",
|
|
37292
37302
|
"taiga_delete_initiative",
|
|
37303
|
+
"taiga_follow_initiative",
|
|
37304
|
+
"taiga_list_product_people",
|
|
37293
37305
|
"taiga_review_plan",
|
|
37294
37306
|
"taiga_plan_again",
|
|
37295
37307
|
"taiga_resume_initiative",
|
|
@@ -41658,6 +41670,8 @@ function registerBacklogTools(server, client) {
|
|
|
41658
41670
|
if (may("backlog:write")) registerMove(server, client);
|
|
41659
41671
|
if (may("backlog:write")) registerEdit(server, client);
|
|
41660
41672
|
if (may("backlog:write")) registerDelete(server, client);
|
|
41673
|
+
if (may("products:read")) registerPeople(server, client);
|
|
41674
|
+
if (may("backlog:read")) registerFollow(server, client);
|
|
41661
41675
|
if (may("products:write")) registerRequest(server, client);
|
|
41662
41676
|
if (may("backlog:write") && may("products:write")) registerQueue(server, client);
|
|
41663
41677
|
if (may("products:write")) registerResume(server, client);
|
|
@@ -41736,7 +41750,7 @@ function registerBacklogReads(server, client) {
|
|
|
41736
41750
|
}));
|
|
41737
41751
|
server.registerTool("taiga_get_initiative", {
|
|
41738
41752
|
title: "Get initiative",
|
|
41739
|
-
description: "Read one initiative: where it stands (column, turn, a sentence naming the next step), its latest run, and the start of its description. full: true gives the whole description, every acceptance criterion with whether it is met, and its technical context: read it that way before implementing. A failed plan carries planFailure. webUrl is where a person opens it in Taiga (null when this Taiga has no web address set); externalRefKey and externalRefUrl name the ticket it came from in another tracker.",
|
|
41753
|
+
description: "Read one initiative: where it stands (column, turn, a sentence naming the next step), its latest run, and the start of its description. full: true gives the whole description, every acceptance criterion with whether it is met, and its technical context: read it that way before implementing. A failed plan carries planFailure. assignee is the one person accountable for it. webUrl is where a person opens it in Taiga (null when this Taiga has no web address set); externalRefKey and externalRefUrl name the ticket it came from in another tracker.",
|
|
41740
41754
|
inputSchema: object({
|
|
41741
41755
|
initiativeId,
|
|
41742
41756
|
full: boolean().optional().describe("Read it whole: every criterion, technical context and the raw state fields (default false)")
|
|
@@ -41745,10 +41759,11 @@ function registerBacklogReads(server, client) {
|
|
|
41745
41759
|
}, (params) => runTool(async () => {
|
|
41746
41760
|
const item = (await client.getBacklogItem(params.initiativeId)).data;
|
|
41747
41761
|
const row = item;
|
|
41748
|
-
const planFailure = item.planningStatus === "failed" ?
|
|
41762
|
+
const [planFailure, assignee] = await Promise.all([item.planningStatus === "failed" ? planFailureOf(client, params.initiativeId, item.lifecycle?.planFailureCause) : null, assigneeOf(client, item)]);
|
|
41749
41763
|
const failure = planFailure ? { planFailure } : {};
|
|
41750
41764
|
if (params.full) return toolResult({
|
|
41751
41765
|
...withSituation(row),
|
|
41766
|
+
...assignee,
|
|
41752
41767
|
...failure
|
|
41753
41768
|
});
|
|
41754
41769
|
const summary = itemRows([item], ITEM_SUMMARY_FIELDS)[0];
|
|
@@ -41758,6 +41773,7 @@ function registerBacklogReads(server, client) {
|
|
|
41758
41773
|
...summary,
|
|
41759
41774
|
description: description.length > DESCRIPTION_IN_SUMMARY ? `${description.slice(0, DESCRIPTION_IN_SUMMARY).trimEnd()}... (full: true has the rest)` : description
|
|
41760
41775
|
}),
|
|
41776
|
+
...assignee,
|
|
41761
41777
|
...failure
|
|
41762
41778
|
});
|
|
41763
41779
|
}));
|
|
@@ -41837,6 +41853,108 @@ function registerMove(server, client) {
|
|
|
41837
41853
|
}));
|
|
41838
41854
|
}
|
|
41839
41855
|
/**
|
|
41856
|
+
* What linking knowledge to an initiative reads and needs: the initiative (its
|
|
41857
|
+
* product and the files it links now), each file, and the write the web's
|
|
41858
|
+
* picker is gated on (PRO-4984). A factory's file also reads the product, for
|
|
41859
|
+
* its factory (products:read).
|
|
41860
|
+
*/
|
|
41861
|
+
const LINK_KNOWLEDGE_NEEDS = [
|
|
41862
|
+
"backlog:read",
|
|
41863
|
+
"customDocuments:read",
|
|
41864
|
+
"customDocuments:write"
|
|
41865
|
+
];
|
|
41866
|
+
/**
|
|
41867
|
+
* Why a file read by ID cannot stay linked, or null: one that failed
|
|
41868
|
+
* processing, which the API refuses (findReferenceableIds). One still
|
|
41869
|
+
* processing stays, as the web's upload links it at once. A deleted file does
|
|
41870
|
+
* not read at all; the API's refusal of it is passed through.
|
|
41871
|
+
*/
|
|
41872
|
+
function gone(file) {
|
|
41873
|
+
return file.status === "failed" ? "failed processing; add it again" : null;
|
|
41874
|
+
}
|
|
41875
|
+
/** Why a file cannot be newly linked, or null when it can: as the picker offers them (isAddable), ready ones only. */
|
|
41876
|
+
function unavailable(file) {
|
|
41877
|
+
if (file.kbStatus !== "active") return "is being removed";
|
|
41878
|
+
return gone(file) ?? (file.status !== "ready" ? "is still being processed; link it once its status is ready" : null);
|
|
41879
|
+
}
|
|
41880
|
+
/**
|
|
41881
|
+
* The knowledge an edit links, checked as the web's picker offers it
|
|
41882
|
+
* (ReferencedDocumentsPicker): the product's own files and its factory's,
|
|
41883
|
+
* once ready. The API takes any file of the organization, so another
|
|
41884
|
+
* product's file is refused here; a file the person cannot open reads as not
|
|
41885
|
+
* found. Each file is read by ID, its scope and state on it. The description's
|
|
41886
|
+
* images are linked too (origin inline), but the API keeps them whatever is
|
|
41887
|
+
* sent, so they are left out of the list, its cap and the answer. A file linked
|
|
41888
|
+
* already that failed since is refused by the API, so it is named here.
|
|
41889
|
+
*/
|
|
41890
|
+
async function knowledgeLinks(client, item, documentIds) {
|
|
41891
|
+
const current = item.documentIds ?? [];
|
|
41892
|
+
const wanted = [...new Set(documentIds)];
|
|
41893
|
+
const ids = [.../* @__PURE__ */ new Set([...current, ...wanted])];
|
|
41894
|
+
const read = await Promise.all(ids.map((docId) => client.getKnowledge(docId).then((result) => [docId, result.data], (error) => {
|
|
41895
|
+
if (isMissOrRefusal(error)) return [docId, null];
|
|
41896
|
+
throw error;
|
|
41897
|
+
})));
|
|
41898
|
+
const files = new Map(read);
|
|
41899
|
+
const inline = (docId) => files.get(docId)?.origin === "inline";
|
|
41900
|
+
const send = wanted.filter((docId) => !inline(docId));
|
|
41901
|
+
if (send.length > 25) return { refused: `An initiative links at most 25 knowledge files.` };
|
|
41902
|
+
const before = current.filter((docId) => !inline(docId));
|
|
41903
|
+
const changed = send.length !== before.length || send.some((docId) => !before.includes(docId));
|
|
41904
|
+
const ref = (docId) => ({
|
|
41905
|
+
id: docId,
|
|
41906
|
+
fileName: files.get(docId)?.fileName ?? null
|
|
41907
|
+
});
|
|
41908
|
+
if (!changed) return {
|
|
41909
|
+
send,
|
|
41910
|
+
changed,
|
|
41911
|
+
linked: send.map(ref),
|
|
41912
|
+
unlinked: []
|
|
41913
|
+
};
|
|
41914
|
+
let factoryId;
|
|
41915
|
+
const reasons = [];
|
|
41916
|
+
for (const docId of send) {
|
|
41917
|
+
const file = files.get(docId);
|
|
41918
|
+
const name = file ? `${file.fileName} (${docId})` : docId;
|
|
41919
|
+
if (before.includes(docId)) {
|
|
41920
|
+
const why = file && gone(file);
|
|
41921
|
+
if (why) reasons.push(`${name}, linked already, ${why}; leave it out to unlink it`);
|
|
41922
|
+
continue;
|
|
41923
|
+
}
|
|
41924
|
+
if (!file) {
|
|
41925
|
+
reasons.push(`${docId} is not a knowledge file this key can open`);
|
|
41926
|
+
continue;
|
|
41927
|
+
}
|
|
41928
|
+
let ofThisProduct = file.productId === item.productId;
|
|
41929
|
+
if (!ofThisProduct && file.productId === null && file.factoryId !== null) {
|
|
41930
|
+
if (!client.hasCapability("products:read")) {
|
|
41931
|
+
reasons.push(`${name} is a factory's file; linking one reads the product, which needs products:read`);
|
|
41932
|
+
continue;
|
|
41933
|
+
}
|
|
41934
|
+
factoryId ??= (await client.getProduct(item.productId)).data.factoryId ?? null;
|
|
41935
|
+
ofThisProduct = file.factoryId === factoryId;
|
|
41936
|
+
}
|
|
41937
|
+
if (!ofThisProduct) {
|
|
41938
|
+
reasons.push(`${name} is not a knowledge file of this product or its factory`);
|
|
41939
|
+
continue;
|
|
41940
|
+
}
|
|
41941
|
+
const why = unavailable(file);
|
|
41942
|
+
if (why) reasons.push(`${name} ${why}`);
|
|
41943
|
+
}
|
|
41944
|
+
if (reasons.length > 0) return { refused: `${reasons.join("; ")}. taiga_list_knowledge lists the product's files (productId) and its factory's (factoryId).` };
|
|
41945
|
+
return {
|
|
41946
|
+
send,
|
|
41947
|
+
changed,
|
|
41948
|
+
linked: send.map(ref),
|
|
41949
|
+
unlinked: before.filter((docId) => !send.includes(docId)).map(ref)
|
|
41950
|
+
};
|
|
41951
|
+
}
|
|
41952
|
+
/** What an edit that changed nothing left as it was. */
|
|
41953
|
+
function unchangedWhat(criteria, knowledge) {
|
|
41954
|
+
if (criteria && knowledge) return "The criteria and linked knowledge are as they were";
|
|
41955
|
+
return criteria ? "The criteria are as they were" : "The linked knowledge is as it was";
|
|
41956
|
+
}
|
|
41957
|
+
/**
|
|
41840
41958
|
* A criterion as the edit takes it: its text, and whether it needs an
|
|
41841
41959
|
* end-to-end check. Whether it is met is not the caller's to say: checking a
|
|
41842
41960
|
* criterion off is a person's verdict or a run's verification, and the web's
|
|
@@ -41899,7 +42017,7 @@ const MAX_INT = 2147483647;
|
|
|
41899
42017
|
function registerEdit(server, client) {
|
|
41900
42018
|
server.registerTool("taiga_update_initiative", {
|
|
41901
42019
|
title: "Edit initiative",
|
|
41902
|
-
description: "Change an initiative's title, description, priority, estimate, category, dependencies
|
|
42020
|
+
description: "Change an initiative's title, description, priority, estimate, category, dependencies, acceptance criteria, assignee or linked knowledge in place, as a person edits it in the web. Use it to correct, reword or translate an initiative rather than canceling it and requesting a new one. A field left out stays as it is. dependencies and acceptanceCriteria and documentIds replace the whole list: read it first with taiga_get_initiative full: true. A criterion whose text is unchanged keeps whether it is met; a new, reworded or newly end-to-end one starts unmet. The text is refused (CONFLICT) while an agent works on the initiative or its plan waits for review. documentIds links knowledge files the planner reads when it plans it: the product's own and its factory's, once ready (taiga_list_knowledge); the result names what it links and unlinks. taiga_move_initiative moves it on the board.",
|
|
41903
42021
|
inputSchema: object({
|
|
41904
42022
|
initiativeId,
|
|
41905
42023
|
title: string$2().trim().min(1).max(500).optional().describe("A new title"),
|
|
@@ -41908,34 +42026,153 @@ function registerEdit(server, client) {
|
|
|
41908
42026
|
estimate: number$1().int().min(0).max(MAX_INT).optional().describe("Its size in points"),
|
|
41909
42027
|
category: _enum(BACKLOG_CATEGORIES).optional().describe("The kind of work"),
|
|
41910
42028
|
dependencies: array(idInput("initiative", "taiga_list_initiatives gives it")).optional().describe("Every initiative it waits for, replacing the list; [] clears it"),
|
|
41911
|
-
acceptanceCriteria: array(criterionInput).optional().describe("Every criterion, in order, replacing the list")
|
|
42029
|
+
acceptanceCriteria: array(criterionInput).optional().describe("Every criterion, in order, replacing the list"),
|
|
42030
|
+
assigneeId: idInput("person", "taiga_list_product_people gives it").nullable().optional().describe("The one person accountable for it, someone who can open the product; null unassigns it"),
|
|
42031
|
+
documentIds: array(idInput("knowledge file", "taiga_list_knowledge gives it")).optional().describe(`Every knowledge file it links, at most 25, replacing the list; [] clears it. Images in its description stay linked whatever is sent`)
|
|
41912
42032
|
}),
|
|
41913
42033
|
annotations: WRITE
|
|
41914
42034
|
}, (params) => runTool(async () => {
|
|
41915
|
-
const { initiativeId: id, acceptanceCriteria, ...fields } = params;
|
|
42035
|
+
const { initiativeId: id, acceptanceCriteria, documentIds, ...fields } = params;
|
|
41916
42036
|
if (fields.dependencies?.includes(id)) return toolError("VALIDATION_ERROR", "An initiative cannot depend on itself.");
|
|
41917
|
-
if (acceptanceCriteria === void 0 && Object.values(fields).every((value) => value === void 0)) return toolError("VALIDATION_ERROR", "Give at least one of title, description, priority, estimate, category, dependencies or
|
|
42037
|
+
if (acceptanceCriteria === void 0 && documentIds === void 0 && Object.values(fields).every((value) => value === void 0)) return toolError("VALIDATION_ERROR", "Give at least one of title, description, priority, estimate, category, dependencies, acceptanceCriteria, assigneeId or documentIds.");
|
|
42038
|
+
if (documentIds !== void 0) {
|
|
42039
|
+
const lacking = LINK_KNOWLEDGE_NEEDS.filter((capability) => !client.hasCapability(capability));
|
|
42040
|
+
if (lacking.length > 0) return toolError("FORBIDDEN", `Linking knowledge reads the initiative and each file, and needs ${lacking.join(", ")}, which this key lacks.`);
|
|
42041
|
+
}
|
|
41918
42042
|
if (acceptanceCriteria !== void 0 && !client.hasCapability("backlog:read")) return toolError("FORBIDDEN", "Editing acceptance criteria reads the current ones first and needs backlog:read, which this key lacks.");
|
|
42043
|
+
const current = acceptanceCriteria !== void 0 || documentIds !== void 0 ? (await client.getBacklogItem(id)).data : null;
|
|
42044
|
+
let links;
|
|
42045
|
+
if (documentIds !== void 0 && current) {
|
|
42046
|
+
const checked = await knowledgeLinks(client, current, documentIds);
|
|
42047
|
+
if ("refused" in checked) return toolError("VALIDATION_ERROR", checked.refused);
|
|
42048
|
+
links = checked;
|
|
42049
|
+
}
|
|
41919
42050
|
let criteria;
|
|
41920
|
-
if (acceptanceCriteria !== void 0) {
|
|
41921
|
-
const current = (await client.getBacklogItem(id)).data;
|
|
42051
|
+
if (acceptanceCriteria !== void 0 && current) {
|
|
41922
42052
|
const carried = carriedCriteria(current.acceptanceCriteria, acceptanceCriteria);
|
|
41923
42053
|
if (criteriaSpec(carried) !== criteriaSpec(current.acceptanceCriteria)) criteria = carried;
|
|
41924
|
-
else if (Object.values(fields).every((value) => value === void 0)) return toolResult({
|
|
41925
|
-
...outcomeOf(current),
|
|
41926
|
-
unchanged: "The criteria are as they were; nothing was written."
|
|
41927
|
-
});
|
|
41928
42054
|
}
|
|
41929
|
-
const
|
|
41930
|
-
|
|
41931
|
-
...
|
|
41932
|
-
|
|
41933
|
-
|
|
41934
|
-
|
|
41935
|
-
|
|
41936
|
-
|
|
41937
|
-
|
|
41938
|
-
|
|
42055
|
+
const linksChange = links?.changed === true;
|
|
42056
|
+
if (current && criteria === void 0 && !linksChange && Object.values(fields).every((v) => v === void 0)) return toolResult({
|
|
42057
|
+
...outcomeOf(current),
|
|
42058
|
+
unchanged: `${unchangedWhat(acceptanceCriteria !== void 0, documentIds !== void 0)}; nothing was written.`
|
|
42059
|
+
});
|
|
42060
|
+
let item;
|
|
42061
|
+
try {
|
|
42062
|
+
item = (await client.updateBacklogItem(id, {
|
|
42063
|
+
...fields.title !== void 0 ? { title: fields.title } : {},
|
|
42064
|
+
...fields.description !== void 0 ? { description: fields.description } : {},
|
|
42065
|
+
...fields.priority !== void 0 ? { priority: fields.priority } : {},
|
|
42066
|
+
...fields.estimate !== void 0 ? { estimate: fields.estimate } : {},
|
|
42067
|
+
...fields.category !== void 0 ? { category: fields.category } : {},
|
|
42068
|
+
...fields.dependencies !== void 0 ? { dependencies: fields.dependencies } : {},
|
|
42069
|
+
...fields.assigneeId !== void 0 ? { assigneeId: fields.assigneeId } : {},
|
|
42070
|
+
...criteria !== void 0 ? { acceptanceCriteria: criteria } : {},
|
|
42071
|
+
...links && linksChange ? { documentIds: links.send } : {}
|
|
42072
|
+
})).data;
|
|
42073
|
+
} catch (error) {
|
|
42074
|
+
if (links && error instanceof TaigaApiError && error.status === 400 && /Referenced documents/.test(error.apiMessage ?? "")) return toolError("VALIDATION_ERROR", `${error.apiMessage} Leave them out of documentIds to unlink them.`);
|
|
42075
|
+
throw error;
|
|
42076
|
+
}
|
|
42077
|
+
const assigned = fields.assigneeId !== void 0 ? { assigneeId: fields.assigneeId } : {};
|
|
42078
|
+
if (!links) return toolResult({
|
|
42079
|
+
...outcomeOf(item),
|
|
42080
|
+
...assigned
|
|
42081
|
+
});
|
|
42082
|
+
return toolResult({
|
|
42083
|
+
...outcomeOf(item),
|
|
42084
|
+
...assigned,
|
|
42085
|
+
linkedKnowledge: links.linked,
|
|
42086
|
+
unlinkedKnowledge: links.unlinked
|
|
42087
|
+
});
|
|
42088
|
+
}));
|
|
42089
|
+
}
|
|
42090
|
+
/**
|
|
42091
|
+
* The initiative's assignee, named for a read (PRO-4982): the ID alone means
|
|
42092
|
+
* nothing to the person the client answers. The name is looked up in the
|
|
42093
|
+
* product's people where the key may read them; any failure of that side read
|
|
42094
|
+
* leaves the name null and never fails the read of the initiative itself.
|
|
42095
|
+
*/
|
|
42096
|
+
async function assigneeOf(client, item) {
|
|
42097
|
+
const id = item.assigneeId;
|
|
42098
|
+
if (!id) return {};
|
|
42099
|
+
if (!client.hasCapability("products:read")) return { assignee: {
|
|
42100
|
+
id,
|
|
42101
|
+
name: null
|
|
42102
|
+
} };
|
|
42103
|
+
try {
|
|
42104
|
+
return { assignee: {
|
|
42105
|
+
id,
|
|
42106
|
+
name: (await client.listProductPeople(item.productId)).data.find((person) => person.id === id)?.name ?? null
|
|
42107
|
+
} };
|
|
42108
|
+
} catch (error) {
|
|
42109
|
+
if (error instanceof TaigaApiError || isNetworkFailure(error)) return { assignee: {
|
|
42110
|
+
id,
|
|
42111
|
+
name: null
|
|
42112
|
+
} };
|
|
42113
|
+
throw error;
|
|
42114
|
+
}
|
|
42115
|
+
}
|
|
42116
|
+
/** The most people one list answers: past it, narrowing by name says more than a longer page. */
|
|
42117
|
+
const PEOPLE_SHOWN = 50;
|
|
42118
|
+
/**
|
|
42119
|
+
* Who can open a product, by name: the people an initiative there can be
|
|
42120
|
+
* assigned to, as the web's assignee menu lists them (PRO-4982).
|
|
42121
|
+
*/
|
|
42122
|
+
function registerPeople(server, client) {
|
|
42123
|
+
server.registerTool("taiga_list_product_people", {
|
|
42124
|
+
title: "List product people",
|
|
42125
|
+
description: "List everyone who can open a product, with their user IDs: the people an initiative there can be assigned to (taiga_update_initiative assigneeId). query narrows it by name or email. An email address is shown only where it tells two people of the same name apart, or where the query matched it.",
|
|
42126
|
+
inputSchema: object({
|
|
42127
|
+
productId,
|
|
42128
|
+
query: string$2().trim().min(1).max(200).optional().describe("Part of a name or email address")
|
|
42129
|
+
}),
|
|
42130
|
+
annotations: READ_ONLY
|
|
42131
|
+
}, (params) => runTool(async () => {
|
|
42132
|
+
const people = (await client.listProductPeople(params.productId)).data;
|
|
42133
|
+
const needle = params.query?.toLowerCase();
|
|
42134
|
+
const found = needle ? people.filter((person) => `${person.name}\n${person.email}`.toLowerCase().includes(needle)) : people;
|
|
42135
|
+
const named = /* @__PURE__ */ new Map();
|
|
42136
|
+
for (const person of found) named.set(person.name, (named.get(person.name) ?? 0) + 1);
|
|
42137
|
+
const rows = found.slice(0, PEOPLE_SHOWN).map(({ id, name, email }) => (named.get(name) ?? 0) > 1 || needle !== void 0 && email.toLowerCase().includes(needle) ? {
|
|
42138
|
+
id,
|
|
42139
|
+
name,
|
|
42140
|
+
email
|
|
42141
|
+
} : {
|
|
42142
|
+
id,
|
|
42143
|
+
name
|
|
42144
|
+
});
|
|
42145
|
+
return toolResult({
|
|
42146
|
+
data: rows,
|
|
42147
|
+
...found.length > rows.length ? { more: `${found.length - rows.length} more; narrow the list with query.` } : {}
|
|
42148
|
+
});
|
|
42149
|
+
}));
|
|
42150
|
+
}
|
|
42151
|
+
/**
|
|
42152
|
+
* Following an initiative, for the key's own person, as the web's Follow does
|
|
42153
|
+
* (PRO-4982): what reaches them about it. Another person's following is theirs
|
|
42154
|
+
* to set, so the tool takes no user.
|
|
42155
|
+
*/
|
|
42156
|
+
function registerFollow(server, client) {
|
|
42157
|
+
server.registerTool("taiga_follow_initiative", {
|
|
42158
|
+
title: "Follow initiative",
|
|
42159
|
+
description: "Follow an initiative, so its news reaches you, or stop following it (following: false). Stopping is remembered: creating it or being assigned it does not make you follow it again. Only your own following.",
|
|
42160
|
+
inputSchema: object({
|
|
42161
|
+
initiativeId,
|
|
42162
|
+
following: boolean().describe("true to follow it, false to stop")
|
|
42163
|
+
}),
|
|
42164
|
+
annotations: {
|
|
42165
|
+
...WRITE,
|
|
42166
|
+
idempotentHint: true
|
|
42167
|
+
}
|
|
42168
|
+
}, (params) => runTool(async () => {
|
|
42169
|
+
const me = client.getIntrospection()?.userId;
|
|
42170
|
+
if (!me) return toolError("UNAUTHENTICATED", "The key has not been checked yet; try again.");
|
|
42171
|
+
const row = (await client.setInitiativeFollowing(params.initiativeId, me, params.following)).data;
|
|
42172
|
+
return toolResult({
|
|
42173
|
+
initiativeId: params.initiativeId,
|
|
42174
|
+
following: row.subscribed
|
|
42175
|
+
});
|
|
41939
42176
|
}));
|
|
41940
42177
|
}
|
|
41941
42178
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ai/mcp-server",
|
|
3
|
-
"version": "0.38.0-dev.
|
|
3
|
+
"version": "0.38.0-dev.1212",
|
|
4
4
|
"description": "Taiga for AI coding assistants: read products, policies, initiatives and runs, and operate the line, over MCP",
|
|
5
5
|
"mcpName": "ga.tai/mcp-server",
|
|
6
6
|
"license": "UNLICENSED",
|