@opsee/mcp-server 0.9.1 → 0.9.3
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/package.json +1 -1
- package/src/__tests__/tools.test.ts +26 -0
- package/src/tools/tasks.ts +4 -4
- package/src/utils/format.ts +2 -2
package/package.json
CHANGED
|
@@ -841,6 +841,32 @@ describe("MCP Tools", () => {
|
|
|
841
841
|
expect(text).toContain("Story Points: 3");
|
|
842
842
|
});
|
|
843
843
|
|
|
844
|
+
test("opsee_get_task returns full description while lists truncate", async () => {
|
|
845
|
+
const longDesc = "x".repeat(250);
|
|
846
|
+
const preview = "x".repeat(200) + "...";
|
|
847
|
+
const clients = createMockClients();
|
|
848
|
+
(clients.tasks as any).getTask = async () => ({ task: { ...mockTask, description: longDesc } });
|
|
849
|
+
(clients.tasks as any).getTasks = async () => ({ tasks: [{ ...mockTask, description: longDesc }] });
|
|
850
|
+
|
|
851
|
+
const [ct, st] = InMemoryTransport.createLinkedPair();
|
|
852
|
+
const srv = createServer(() => clients);
|
|
853
|
+
await srv.connect(st);
|
|
854
|
+
const c = new Client({ name: "full-desc-test", version: "1.0.0" });
|
|
855
|
+
await c.connect(ct);
|
|
856
|
+
|
|
857
|
+
const full = await c.callTool({ name: "opsee_get_task", arguments: { taskId: 10 } });
|
|
858
|
+
const fullText = (full.content as Array<{ type: string; text: string }>)[0].text;
|
|
859
|
+
expect(fullText).toContain(longDesc);
|
|
860
|
+
expect(fullText).not.toContain(preview);
|
|
861
|
+
|
|
862
|
+
const list = await c.callTool({ name: "opsee_list_tasks", arguments: { projectId: 1 } });
|
|
863
|
+
const listText = (list.content as Array<{ type: string; text: string }>)[0].text;
|
|
864
|
+
expect(listText).toContain(preview);
|
|
865
|
+
|
|
866
|
+
await c.close();
|
|
867
|
+
await srv.close();
|
|
868
|
+
});
|
|
869
|
+
|
|
844
870
|
test("auth error returns login instruction", async () => {
|
|
845
871
|
const authClients = createMockClients();
|
|
846
872
|
(authClients.users as any).getMe = async () => {
|
package/src/tools/tasks.ts
CHANGED
|
@@ -116,7 +116,7 @@ export function registerTaskTools(
|
|
|
116
116
|
const clients = getClients();
|
|
117
117
|
const res = await clients.tasks.getTask({ id: taskId });
|
|
118
118
|
if (!res.task) return { content: [{ type: "text", text: "Task not found. Use opsee_list_tasks to see available tasks." }] };
|
|
119
|
-
return { content: [{ type: "text", text: formatTask(res.task) }] };
|
|
119
|
+
return { content: [{ type: "text", text: formatTask(res.task, { full: true }) }] };
|
|
120
120
|
} catch (error) {
|
|
121
121
|
return { content: [{ type: "text", text: formatError(error) }], isError: true };
|
|
122
122
|
}
|
|
@@ -166,7 +166,7 @@ export function registerTaskTools(
|
|
|
166
166
|
]);
|
|
167
167
|
|
|
168
168
|
const sections: string[] = [];
|
|
169
|
-
sections.push(formatTask(task));
|
|
169
|
+
sections.push(formatTask(task, { full: true }));
|
|
170
170
|
|
|
171
171
|
const parentTask = parentRes?.task;
|
|
172
172
|
if (parentTask) {
|
|
@@ -283,7 +283,7 @@ export function registerTaskTools(
|
|
|
283
283
|
|
|
284
284
|
return {
|
|
285
285
|
content: [
|
|
286
|
-
{ type: "text", text: `Task created:\n${formatTask(res.task)}` },
|
|
286
|
+
{ type: "text", text: `Task created:\n${formatTask(res.task, { full: true })}` },
|
|
287
287
|
],
|
|
288
288
|
};
|
|
289
289
|
} catch (error) {
|
|
@@ -355,7 +355,7 @@ export function registerTaskTools(
|
|
|
355
355
|
|
|
356
356
|
return {
|
|
357
357
|
content: [
|
|
358
|
-
{ type: "text", text: `Task updated:\n${formatTask(res.task)}` },
|
|
358
|
+
{ type: "text", text: `Task updated:\n${formatTask(res.task, { full: true })}` },
|
|
359
359
|
],
|
|
360
360
|
};
|
|
361
361
|
} catch (error) {
|
package/src/utils/format.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function formatProjectList(projects: Project[]): string {
|
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function formatTask(t: Task): string {
|
|
25
|
+
export function formatTask(t: Task, opts: { full?: boolean } = {}): string {
|
|
26
26
|
const lines = [`[${t.identifier}] ${t.title}`];
|
|
27
27
|
|
|
28
28
|
const status = t.boardColumn?.name || "Unknown";
|
|
@@ -43,7 +43,7 @@ export function formatTask(t: Task): string {
|
|
|
43
43
|
|
|
44
44
|
if (t.description) {
|
|
45
45
|
const desc =
|
|
46
|
-
t.description.length > 200
|
|
46
|
+
!opts.full && t.description.length > 200
|
|
47
47
|
? t.description.substring(0, 200) + "..."
|
|
48
48
|
: t.description;
|
|
49
49
|
lines.push(` Description: ${desc}`);
|