comment-kit-mcp 0.1.0 → 0.1.1
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/README.md +14 -8
- package/dist/api-client.d.ts +10 -1
- package/dist/api-client.js +28 -6
- package/dist/format.d.ts +5 -0
- package/dist/format.js +3 -1
- package/dist/server.js +53 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,9 @@ Create the project key and slug in CommentKit. A member of that project's team
|
|
|
31
31
|
can obtain the supported SDK token through the OTP flow:
|
|
32
32
|
|
|
33
33
|
1. `POST /api/auth/otp/request` with header `X-API-Key: <project key>` and JSON `{"email":"<team member email>"}`. The backend emails a short-lived code to that member.
|
|
34
|
-
2. `POST /api/auth/otp/verify` with the same header and JSON `{"email":"<team member email>","otp":"<six-digit code>"}`.
|
|
34
|
+
2. `POST /api/auth/otp/verify` with the same header and JSON `{"email":"<team member email>","otp":"<six-digit code>"}`.
|
|
35
|
+
3. If the response has `mfaRequired: true`, it does not contain an authenticated session. Complete `POST /api/auth/mfa/verify` with the same `X-API-Key` header and JSON `{"challenge":"<challenge from the response>","code":"<authenticator or unused recovery code>"}`. The challenge expires after five minutes and can be completed once; restart email sign-in if it expires.
|
|
36
|
+
4. Only after a response confirms `verified: true` and supplies a `token`, save that token as `COMMENT_KIT_ACCESS_TOKEN` in your private local MCP host configuration. Keep email codes, second-factor proofs and challenge values out of project files and agent prompts.
|
|
35
37
|
|
|
36
38
|
The default SDK token expires after 30 days; re-run OTP verification when it
|
|
37
39
|
expires. Revoke it at dashboard **Settings → Sessions**, or ask an administrator
|
|
@@ -80,11 +82,11 @@ claude mcp add comment-kit -- npx -y comment-kit-mcp
|
|
|
80
82
|
|
|
81
83
|
## Tools
|
|
82
84
|
|
|
83
|
-
| Tool | Description
|
|
84
|
-
| ----------------- |
|
|
85
|
-
| `list_comments` | List comments. Filter by `status`, `branch`, `environment`, `page_path`, `priority`, `limit`. Defaults to open comments.
|
|
86
|
-
| `get_comment` | Fetch a comment and its full context by `commentId`; continue oversized JSON with `context_offset` and `snapshot_sha256`.
|
|
87
|
-
| `search_comments` | Search open content + replies, with optional `branch`, `environment`, and `page_path` filters.
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
87
|
+
| `list_comments` | List comments. Filter by `status`, `branch`, `environment`, `page_path`, `priority`, `limit`, `cursor`. Defaults to open comments. |
|
|
88
|
+
| `get_comment` | Fetch a comment and its full context by `commentId`; continue oversized JSON with `context_offset` and `snapshot_sha256`. |
|
|
89
|
+
| `search_comments` | Search open content + replies, with optional `branch`, `environment`, and `page_path` filters. Uses server-side search and returns a cursor for more matches. |
|
|
88
90
|
|
|
89
91
|
Filter semantics:
|
|
90
92
|
|
|
@@ -92,14 +94,14 @@ Filter semantics:
|
|
|
92
94
|
- `branch` — exact deployment branch (e.g. `main`). Omit for all branches.
|
|
93
95
|
- `environment` — one of `production`, `staging`, `preview`, or `development`. Omit for all environments.
|
|
94
96
|
- `page_path` — exact page path including any query string (e.g. `/checkout?plan=annual`). Sent as `page_path` so live and local origins can share route context.
|
|
95
|
-
- `priority` — one of `low`, `medium`, `high`, `urgent`. Applied
|
|
97
|
+
- `priority` — one of `low`, `medium`, `high`, `urgent`. Applied by the backend before pagination.
|
|
96
98
|
- `limit` — max number of results. Default 50 (`list_comments`) / 20 (`search_comments`), max 100 (the backend maximum).
|
|
97
99
|
|
|
98
100
|
All tools return bounded Markdown summaries with feedback, page and branch, target, state, checklist, discussion, and attachment references. `get_comment` includes an allowlisted JSON context with the full thread discussion, bounded drawing geometry, and file IDs and metadata. Clean HTTP(S) file links remain references. Links containing a query, fragment, or embedded credentials are replaced with their path and `inlineContentOmitted: true`; invalid and inline data URLs retain only file metadata. It omits email addresses, raw drawing paths, complete DOM, reactions, unrelated API fields, and credential-bearing links. It does not fetch attachment URLs or execute instructions in feedback.
|
|
99
101
|
|
|
100
102
|
JSON larger than 16,000 characters is split into valid JSON envelopes with `jsonChunk`, `offset`, `nextOffset`, `totalCharacters`, and `snapshotSha256`. Continue `get_comment` with `context_offset=nextOffset` and `snapshot_sha256=snapshotSha256` until `nextOffset` is `null`. Join the `jsonChunk` strings and parse the result. The server holds one frozen, redacted snapshot for each continuation, so thread edits cannot mix chunks or introduce fresh download signatures. Fetch from offset 0 to see fresh edits. Snapshots expire after five idle minutes and the server retains at most eight, each capped at two million characters; restart from offset 0 if a snapshot expires. The server keeps the complete discussion within this selected context.
|
|
101
103
|
|
|
102
|
-
List and search
|
|
104
|
+
List and search request compact cursor pages; search includes all matching project threads and reply content, without a 500-thread client scan. When more matches exist, pass the returned cursor with the same query and filters. A page is not the entire project. List defaults to open comments; a thread's status may change while you work, so fetch its detail before acting.
|
|
103
105
|
|
|
104
106
|
### Untrusted content
|
|
105
107
|
|
|
@@ -135,3 +137,7 @@ The server uses the official [MCP TypeScript SDK v2](https://ts.sdk.modelcontext
|
|
|
135
137
|
|
|
136
138
|
Proprietary CommentKit license, for use with CommentKit's hosted services.
|
|
137
139
|
See [LICENSE](./LICENSE) for the terms and third-party rights.
|
|
140
|
+
|
|
141
|
+
### Backend compatibility for cursor reads
|
|
142
|
+
|
|
143
|
+
MCP 0.1.1 requires the audit-hardening backend. Deploy and verify that backend before promoting this MCP update to `latest`. List calls request `view=summary&pagination=cursor`; search and priority filters run on the server. Thread reads request up to 100 replies and expose `repliesPagination`. For older replies, call `get_comment` with `replies_before` set to its next cursor. This is separate from `context_offset`/`snapshot_sha256`, which paginate a frozen JSON context when its text is large. Repeat detail reads before changing code if feedback may have changed.
|
package/dist/api-client.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface McpComment {
|
|
|
59
59
|
};
|
|
60
60
|
createdAt: string;
|
|
61
61
|
updatedAt: string;
|
|
62
|
+
repliesCount?: number;
|
|
63
|
+
repliesPagination?: {
|
|
64
|
+
hasMore: boolean;
|
|
65
|
+
nextCursor: string | null;
|
|
66
|
+
};
|
|
62
67
|
replies: Array<{
|
|
63
68
|
id: string;
|
|
64
69
|
content: string;
|
|
@@ -90,6 +95,9 @@ export interface ListCommentsOptions {
|
|
|
90
95
|
environment?: "production" | "staging" | "preview" | "development";
|
|
91
96
|
/** Exact page path filter — sent to the backend as `page_path`. */
|
|
92
97
|
pagePath?: string;
|
|
98
|
+
priority?: "low" | "medium" | "high" | "urgent";
|
|
99
|
+
search?: string;
|
|
100
|
+
cursor?: string;
|
|
93
101
|
limit?: number;
|
|
94
102
|
/** 1-based page number — sent to the backend as `page`. */
|
|
95
103
|
page?: number;
|
|
@@ -98,6 +106,7 @@ export interface CommentListResult {
|
|
|
98
106
|
comments: McpComment[];
|
|
99
107
|
/** Whether the backend reported more results beyond this page. */
|
|
100
108
|
hasMore: boolean;
|
|
109
|
+
nextCursor?: string | null;
|
|
101
110
|
}
|
|
102
111
|
/**
|
|
103
112
|
* Parse and validate a CommentKit base URL. Requires https: unless the host
|
|
@@ -128,5 +137,5 @@ export declare class CommentKitApiClient {
|
|
|
128
137
|
* silently corrupting agent decisions on real-sized projects.
|
|
129
138
|
*/
|
|
130
139
|
listCommentsPaged(options?: Omit<ListCommentsOptions, "limit" | "page">, maxTotal?: number): Promise<CommentListResult>;
|
|
131
|
-
getComment(commentId: string): Promise<McpComment>;
|
|
140
|
+
getComment(commentId: string, repliesBefore?: string): Promise<McpComment>;
|
|
132
141
|
}
|
package/dist/api-client.js
CHANGED
|
@@ -112,8 +112,14 @@ export class CommentKitApiClient {
|
|
|
112
112
|
return body;
|
|
113
113
|
}
|
|
114
114
|
async listComments(options = {}) {
|
|
115
|
-
const params = new URLSearchParams();
|
|
116
|
-
|
|
115
|
+
const params = new URLSearchParams({ view: "summary", pagination: "cursor" });
|
|
116
|
+
if (options.cursor)
|
|
117
|
+
params.set("cursor", options.cursor);
|
|
118
|
+
if (options.priority)
|
|
119
|
+
params.set("priority", options.priority);
|
|
120
|
+
if (options.search)
|
|
121
|
+
params.set("search", options.search);
|
|
122
|
+
// Cursor pagination is stable across insertions/deletions. page remains a legacy fallback.
|
|
117
123
|
if (options.pagePath)
|
|
118
124
|
params.set("page_path", options.pagePath);
|
|
119
125
|
if (options.branch)
|
|
@@ -129,7 +135,11 @@ export class CommentKitApiClient {
|
|
|
129
135
|
: MAX_LIMIT;
|
|
130
136
|
params.set("limit", String(safeLimit));
|
|
131
137
|
}
|
|
132
|
-
if (
|
|
138
|
+
if (!options.cursor &&
|
|
139
|
+
typeof options.page === "number" &&
|
|
140
|
+
Number.isFinite(options.page) &&
|
|
141
|
+
options.page > 1) {
|
|
142
|
+
params.delete("pagination");
|
|
133
143
|
params.set("page", String(Math.floor(options.page)));
|
|
134
144
|
}
|
|
135
145
|
const qs = params.toString();
|
|
@@ -142,6 +152,7 @@ export class CommentKitApiClient {
|
|
|
142
152
|
return {
|
|
143
153
|
comments: data.comments ?? [],
|
|
144
154
|
hasMore: data.pagination?.hasMore === true,
|
|
155
|
+
nextCursor: data.pagination?.nextCursor ?? null,
|
|
145
156
|
};
|
|
146
157
|
}
|
|
147
158
|
return { comments: [], hasMore: false };
|
|
@@ -155,15 +166,23 @@ export class CommentKitApiClient {
|
|
|
155
166
|
const collected = [];
|
|
156
167
|
let page = 1;
|
|
157
168
|
let hasMore = true;
|
|
169
|
+
let cursor;
|
|
170
|
+
const seenCursors = new Set();
|
|
158
171
|
// Hard cap on requests as a defense against a backend that always
|
|
159
172
|
// reports hasMore.
|
|
160
173
|
const maxPages = Math.max(1, Math.ceil(maxTotal / MAX_LIMIT));
|
|
161
174
|
while (collected.length < maxTotal && hasMore && page <= maxPages) {
|
|
162
|
-
const result = await this.listComments({ ...options, limit: MAX_LIMIT, page });
|
|
175
|
+
const result = await this.listComments({ ...options, limit: MAX_LIMIT, page, cursor });
|
|
163
176
|
collected.push(...result.comments);
|
|
164
177
|
hasMore = result.hasMore;
|
|
165
178
|
if (result.comments.length === 0)
|
|
166
179
|
break;
|
|
180
|
+
if (result.nextCursor) {
|
|
181
|
+
if (seenCursors.has(result.nextCursor))
|
|
182
|
+
break;
|
|
183
|
+
seenCursors.add(result.nextCursor);
|
|
184
|
+
cursor = result.nextCursor;
|
|
185
|
+
}
|
|
167
186
|
page += 1;
|
|
168
187
|
}
|
|
169
188
|
return {
|
|
@@ -171,8 +190,11 @@ export class CommentKitApiClient {
|
|
|
171
190
|
hasMore: hasMore || collected.length > maxTotal,
|
|
172
191
|
};
|
|
173
192
|
}
|
|
174
|
-
async getComment(commentId) {
|
|
175
|
-
const
|
|
193
|
+
async getComment(commentId, repliesBefore) {
|
|
194
|
+
const params = new URLSearchParams({ replies_limit: "100" });
|
|
195
|
+
if (repliesBefore)
|
|
196
|
+
params.set("replies_before", repliesBefore);
|
|
197
|
+
const data = await this.request(`/projects/${encodePath(this.projectId)}/comments/${encodePath(commentId)}?${params}`);
|
|
176
198
|
// The backend wraps the comment: `{ "success": true, "comment": {...} }`.
|
|
177
199
|
// Unwrap it (with a legacy fallback for a bare comment object).
|
|
178
200
|
if (data && typeof data === "object" && "comment" in data && data.comment) {
|
package/dist/format.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ export declare function toAgentComment(comment: McpComment): {
|
|
|
60
60
|
mimeType?: string | undefined;
|
|
61
61
|
size?: number | undefined;
|
|
62
62
|
}[];
|
|
63
|
+
repliesPagination?: {
|
|
64
|
+
hasMore: boolean;
|
|
65
|
+
nextCursor: string | null;
|
|
66
|
+
} | undefined;
|
|
67
|
+
repliesCount?: number | undefined;
|
|
63
68
|
replies: {
|
|
64
69
|
id: string;
|
|
65
70
|
content: string;
|
package/dist/format.js
CHANGED
|
@@ -131,6 +131,8 @@ export function toAgentComment(comment) {
|
|
|
131
131
|
? { checklist: comment.checklist.map(({ label, done }) => ({ label, done })) }
|
|
132
132
|
: {}),
|
|
133
133
|
attachments: attachments(comment.attachments),
|
|
134
|
+
...(comment.repliesPagination ? { repliesPagination: comment.repliesPagination } : {}),
|
|
135
|
+
...(comment.repliesCount !== undefined ? { repliesCount: comment.repliesCount } : {}),
|
|
134
136
|
replies: (comment.replies ?? []).map((reply) => ({
|
|
135
137
|
id: reply.id,
|
|
136
138
|
content: reply.content,
|
|
@@ -206,7 +208,7 @@ export function summarizeComment(comment) {
|
|
|
206
208
|
`- Page: ${pageTitle ? untrusted(pageTitle) : "(untitled)"} — ${pageLocation ? untrusted(pageLocation) : "(unknown)"}`,
|
|
207
209
|
`- Selector: ${element ? untrusted(element) : "none"}`,
|
|
208
210
|
`- XPath: ${xpath ? untrusted(xpath) : "none"}`,
|
|
209
|
-
`- Replies: ${replies.length}`,
|
|
211
|
+
`- Replies: ${comment.repliesCount ?? replies.length}${comment.repliesCount !== undefined && comment.repliesCount > replies.length ? ` (${replies.length} included; fetch get_comment for details)` : ""}`,
|
|
210
212
|
assignees.length
|
|
211
213
|
? `- Assignees (${assignees.length}): ${assignees
|
|
212
214
|
.slice(0, MAX_SUMMARY_ITEMS)
|
package/dist/server.js
CHANGED
|
@@ -7,9 +7,6 @@ const STATUS_VALUES = ["open", "resolved", "complete", "all"];
|
|
|
7
7
|
const ENVIRONMENT_VALUES = ["production", "staging", "preview", "development"];
|
|
8
8
|
const PRIORITY_VALUES = ["low", "medium", "high", "urgent"];
|
|
9
9
|
const MAX_LIMIT = 100; // backend max per page
|
|
10
|
-
// Cap on paged scans (search / client-side priority filtering): 5 backend
|
|
11
|
-
// requests of MAX_LIMIT each.
|
|
12
|
-
const SCAN_CAP = 500;
|
|
13
10
|
const SNAPSHOT_TTL_MS = 5 * 60_000;
|
|
14
11
|
const MAX_SNAPSHOTS = 8;
|
|
15
12
|
const MAX_SNAPSHOT_CHARACTERS = 2_000_000;
|
|
@@ -22,11 +19,23 @@ const listSchema = z.strictObject({
|
|
|
22
19
|
page_path: z.string().trim().max(2048).optional().describe("Exact page path, including query"),
|
|
23
20
|
branch: z.string().trim().max(255).optional().describe("Exact deployment branch"),
|
|
24
21
|
environment: z.enum(ENVIRONMENT_VALUES).optional(),
|
|
25
|
-
priority: z.enum(PRIORITY_VALUES).optional().describe("
|
|
22
|
+
priority: z.enum(PRIORITY_VALUES).optional().describe("Exact server-side priority filter"),
|
|
26
23
|
limit: z.number().int().min(1).max(MAX_LIMIT).optional(),
|
|
24
|
+
cursor: z
|
|
25
|
+
.string()
|
|
26
|
+
.trim()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(2048)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("nextCursor from the previous result; keep all filters unchanged"),
|
|
27
31
|
});
|
|
28
32
|
const getSchema = z.strictObject({
|
|
29
33
|
commentId: z.string().trim().min(1).max(255),
|
|
34
|
+
replies_before: z
|
|
35
|
+
.string()
|
|
36
|
+
.regex(/^[0-9]+$/)
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("nextCursor from repliesPagination to fetch older replies"),
|
|
30
39
|
context_offset: z.number().int().min(0).safe().optional(),
|
|
31
40
|
snapshot_sha256: z
|
|
32
41
|
.string()
|
|
@@ -34,8 +43,15 @@ const getSchema = z.strictObject({
|
|
|
34
43
|
.optional(),
|
|
35
44
|
});
|
|
36
45
|
const searchSchema = z.strictObject({
|
|
37
|
-
query: z.string().trim().min(1).max(
|
|
46
|
+
query: z.string().trim().min(1).max(200),
|
|
38
47
|
limit: z.number().int().min(1).max(MAX_LIMIT).optional(),
|
|
48
|
+
cursor: z
|
|
49
|
+
.string()
|
|
50
|
+
.trim()
|
|
51
|
+
.min(1)
|
|
52
|
+
.max(2048)
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("nextCursor from the previous result; keep all filters unchanged"),
|
|
39
55
|
branch: z.string().trim().max(255).optional(),
|
|
40
56
|
environment: z.enum(ENVIRONMENT_VALUES).optional(),
|
|
41
57
|
page_path: z.string().trim().max(2048).optional(),
|
|
@@ -57,7 +73,7 @@ export function createServer(config) {
|
|
|
57
73
|
});
|
|
58
74
|
const server = new McpServer({
|
|
59
75
|
name: config.serverName ?? "comment-kit-mcp",
|
|
60
|
-
version: config.serverVersion ?? "0.1.
|
|
76
|
+
version: config.serverVersion ?? "0.1.1",
|
|
61
77
|
});
|
|
62
78
|
const snapshots = new Map();
|
|
63
79
|
const snapshotKey = (id, hash) => `${id}:${hash}`;
|
|
@@ -71,7 +87,7 @@ export function createServer(config) {
|
|
|
71
87
|
};
|
|
72
88
|
const readOnly = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
73
89
|
server.registerTool("list_comments", {
|
|
74
|
-
description: "List stakeholder feedback by status, page, branch, environment and priority.
|
|
90
|
+
description: "List stakeholder feedback by status, page, branch, environment and priority. Returns compact summaries with stable cursor continuation. " +
|
|
75
91
|
UNTRUSTED_NOTICE,
|
|
76
92
|
annotations: readOnly,
|
|
77
93
|
inputSchema: listSchema,
|
|
@@ -82,29 +98,20 @@ export function createServer(config) {
|
|
|
82
98
|
const branch = asString(args.branch);
|
|
83
99
|
const environment = args.environment;
|
|
84
100
|
const limit = clampLimit(args.limit, 50, MAX_LIMIT);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
? comments.filter((comment) => comment.priority === priority)
|
|
100
|
-
: comments;
|
|
101
|
-
const results = filtered.slice(0, limit);
|
|
102
|
-
let text = formatCommentList(results);
|
|
103
|
-
// Always tell the agent when results are incomplete — silent
|
|
104
|
-
// truncation corrupts downstream decisions.
|
|
105
|
-
if (hasMore || filtered.length > results.length) {
|
|
106
|
-
text +=
|
|
107
|
-
"\n\nNote: more comments exist beyond this page — refine filters (status/page_path/priority) or raise `limit`.";
|
|
101
|
+
const { comments, hasMore, nextCursor } = await api.listComments({
|
|
102
|
+
status,
|
|
103
|
+
branch,
|
|
104
|
+
environment,
|
|
105
|
+
priority,
|
|
106
|
+
pagePath: asString(args.page_path),
|
|
107
|
+
limit,
|
|
108
|
+
cursor: args.cursor,
|
|
109
|
+
});
|
|
110
|
+
let text = formatCommentList(comments);
|
|
111
|
+
if (hasMore) {
|
|
112
|
+
text += nextCursor
|
|
113
|
+
? `\n\nMore results. Call list_comments with the same filters and cursor: ${JSON.stringify(nextCursor)}`
|
|
114
|
+
: "\n\nMore results exist. This backend did not provide a cursor; refine filters or upgrade the backend.";
|
|
108
115
|
}
|
|
109
116
|
return { content: [{ type: "text", text }] };
|
|
110
117
|
}
|
|
@@ -113,7 +120,7 @@ export function createServer(config) {
|
|
|
113
120
|
}
|
|
114
121
|
});
|
|
115
122
|
server.registerTool("get_comment", {
|
|
116
|
-
description: "Fetch one thread with useful target, state, replies and file references. Large context uses nextOffset continuation with snapshot_sha256. " +
|
|
123
|
+
description: "Fetch one thread with useful target, state, replies and file references. Fetches at most 100 replies; use replies_before from repliesPagination for older replies. Large context uses nextOffset continuation with snapshot_sha256. " +
|
|
117
124
|
UNTRUSTED_NOTICE,
|
|
118
125
|
annotations: readOnly,
|
|
119
126
|
inputSchema: getSchema,
|
|
@@ -135,7 +142,7 @@ export function createServer(config) {
|
|
|
135
142
|
snapshot = entry.value;
|
|
136
143
|
}
|
|
137
144
|
else {
|
|
138
|
-
snapshot = createCommentDetailSnapshot(await api.getComment(id));
|
|
145
|
+
snapshot = createCommentDetailSnapshot(await api.getComment(id, args.replies_before));
|
|
139
146
|
if (snapshot.serialized.length > MAX_SNAPSHOT_CHARACTERS)
|
|
140
147
|
throw new Error("Comment context exceeds the 2 million character snapshot limit");
|
|
141
148
|
if (snapshot.serialized.length > 16_000) {
|
|
@@ -160,7 +167,7 @@ export function createServer(config) {
|
|
|
160
167
|
}
|
|
161
168
|
});
|
|
162
169
|
server.registerTool("search_comments", {
|
|
163
|
-
description: "Search open feedback and replies, with optional branch, environment and exact page filters.
|
|
170
|
+
description: "Search open feedback and replies, with optional branch, environment and exact page filters. Search runs across all matching threads on the server; results have cursor continuation. " +
|
|
164
171
|
UNTRUSTED_NOTICE,
|
|
165
172
|
annotations: readOnly,
|
|
166
173
|
inputSchema: searchSchema,
|
|
@@ -170,21 +177,20 @@ export function createServer(config) {
|
|
|
170
177
|
const limit = clampLimit(args.limit, 20, MAX_LIMIT);
|
|
171
178
|
const branch = asString(args.branch);
|
|
172
179
|
const environment = args.environment;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return (comment.replies ?? []).some((reply) => (reply?.content ?? "").toLowerCase().includes(needle));
|
|
180
|
+
const { comments, hasMore, nextCursor } = await api.listComments({
|
|
181
|
+
status: "open",
|
|
182
|
+
branch,
|
|
183
|
+
environment,
|
|
184
|
+
pagePath: asString(args.page_path),
|
|
185
|
+
search: query,
|
|
186
|
+
limit,
|
|
187
|
+
cursor: args.cursor,
|
|
182
188
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
let text = formatCommentList(comments);
|
|
190
|
+
if (hasMore) {
|
|
191
|
+
text += nextCursor
|
|
192
|
+
? `\n\nMore matches. Call search_comments with the same query and filters and cursor: ${JSON.stringify(nextCursor)}`
|
|
193
|
+
: "\n\nMore matches exist. This backend did not provide a cursor; refine filters or upgrade the backend.";
|
|
188
194
|
}
|
|
189
195
|
return { content: [{ type: "text", text }] };
|
|
190
196
|
}
|