@limeadelabs/clarabit-mcp 2.0.2 → 2.2.0
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 +56 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,9 +99,10 @@ var ClarabitClient = class {
|
|
|
99
99
|
createPage(projectId, title, body) {
|
|
100
100
|
return this.request("POST", `/projects/${projectId}/pages`, { page: { title, body } });
|
|
101
101
|
}
|
|
102
|
-
updatePage(projectId, pageId, updates, changeSummary) {
|
|
102
|
+
updatePage(projectId, pageId, updates, changeSummary, verbose) {
|
|
103
103
|
const body = { page: updates };
|
|
104
104
|
if (changeSummary !== void 0) body.change_summary = changeSummary;
|
|
105
|
+
if (verbose !== void 0) body.verbose = verbose;
|
|
105
106
|
return this.request("PATCH", `/projects/${projectId}/pages/${pageId}`, body);
|
|
106
107
|
}
|
|
107
108
|
listPageVersions(projectId, pageId) {
|
|
@@ -130,9 +131,10 @@ var ClarabitClient = class {
|
|
|
130
131
|
getPageFlat(pageId) {
|
|
131
132
|
return this.request("GET", `/pages/${pageId}`);
|
|
132
133
|
}
|
|
133
|
-
updatePageFlat(pageId, updates, changeSummary) {
|
|
134
|
+
updatePageFlat(pageId, updates, changeSummary, verbose) {
|
|
134
135
|
const body = { page: updates };
|
|
135
136
|
if (changeSummary !== void 0) body.change_summary = changeSummary;
|
|
137
|
+
if (verbose !== void 0) body.verbose = verbose;
|
|
136
138
|
return this.request("PATCH", `/pages/${pageId}`, body);
|
|
137
139
|
}
|
|
138
140
|
listPageVersionsFlat(pageId) {
|
|
@@ -159,6 +161,13 @@ var ClarabitClient = class {
|
|
|
159
161
|
`/projects/${projectId}/pages/${pageId}/comments${query}`
|
|
160
162
|
);
|
|
161
163
|
}
|
|
164
|
+
listPageCommentsFlat(pageId, opts) {
|
|
165
|
+
const query = opts?.resolved === void 0 ? "" : `?resolved=${opts.resolved ? "true" : "false"}`;
|
|
166
|
+
return this.request(
|
|
167
|
+
"GET",
|
|
168
|
+
`/pages/${pageId}/comments${query}`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
162
171
|
createPageComment(projectId, pageId, body, opts) {
|
|
163
172
|
return this.request(
|
|
164
173
|
"POST",
|
|
@@ -207,6 +216,9 @@ var ClarabitClient = class {
|
|
|
207
216
|
updateContextEntry(identifier, data) {
|
|
208
217
|
return this.request("PATCH", `/contexts/${encodeURIComponent(identifier)}`, data);
|
|
209
218
|
}
|
|
219
|
+
createContextEntry(data) {
|
|
220
|
+
return this.request("POST", "/contexts", data);
|
|
221
|
+
}
|
|
210
222
|
createSession(taskId, agentType, agentId) {
|
|
211
223
|
return this.request("POST", "/sessions", {
|
|
212
224
|
task_id: taskId,
|
|
@@ -548,20 +560,21 @@ function registerPageTools(server2, client2) {
|
|
|
548
560
|
);
|
|
549
561
|
server2.tool(
|
|
550
562
|
"cla_update_page",
|
|
551
|
-
"Update an existing spec/doc page in a Clarabit project. Every MCP edit creates a new PageVersion (no debounce). Optionally pass change_summary to label the snapshot.",
|
|
563
|
+
"Update an existing spec/doc page in a Clarabit project. Every MCP edit creates a new PageVersion (no debounce). Optionally pass change_summary to label the snapshot. Returns a minimal confirmation by default (id, title, version_number, change_summary) \u2014 pass verbose: true if you actually need the full body back (rare; the agent typically just sent it).",
|
|
552
564
|
{
|
|
553
565
|
project_id: z7.coerce.number().optional().describe("Project ID (optional \u2014 inferred if omitted)"),
|
|
554
566
|
page_id: z7.coerce.number().describe("Page ID"),
|
|
555
567
|
title: z7.string().optional().describe("New page title (optional)"),
|
|
556
568
|
body: z7.string().optional().describe("New page body in markdown (optional)"),
|
|
557
|
-
change_summary: z7.string().optional().describe("Short note describing why this edit was made (shown in version history)")
|
|
569
|
+
change_summary: z7.string().optional().describe("Short note describing why this edit was made (shown in version history)"),
|
|
570
|
+
verbose: z7.boolean().optional().describe("Return the full page (including body) in the response. Default false \u2014 saves round-trip cost on long pages.")
|
|
558
571
|
},
|
|
559
572
|
async (params) => {
|
|
560
573
|
try {
|
|
561
574
|
const updates = {};
|
|
562
575
|
if (params.title) updates.title = params.title;
|
|
563
576
|
if (params.body) updates.body = params.body;
|
|
564
|
-
const result = params.project_id ? await client2.updatePage(params.project_id, params.page_id, updates, params.change_summary) : await client2.updatePageFlat(params.page_id, updates, params.change_summary);
|
|
577
|
+
const result = params.project_id ? await client2.updatePage(params.project_id, params.page_id, updates, params.change_summary, params.verbose) : await client2.updatePageFlat(params.page_id, updates, params.change_summary, params.verbose);
|
|
565
578
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
566
579
|
} catch (error) {
|
|
567
580
|
return handleError(error, client2.timeoutMs);
|
|
@@ -648,6 +661,24 @@ function registerPageTools(server2, client2) {
|
|
|
648
661
|
// src/tools/page-comments.ts
|
|
649
662
|
import { z as z8 } from "zod";
|
|
650
663
|
function registerPageCommentTools(server2, client2) {
|
|
664
|
+
server2.tool(
|
|
665
|
+
"cla_list_page_comments",
|
|
666
|
+
"List comments on a page. Returns root comments with their threaded replies. Use the resolved filter to focus on open threads (resolved=false) or only the resolved ones (resolved=true). Pass project_id to use the nested route; omit it and the server resolves the page via the api key\u2019s accessible_pages scope.",
|
|
667
|
+
{
|
|
668
|
+
page_id: z8.coerce.number().describe("Page ID to list comments for"),
|
|
669
|
+
project_id: z8.coerce.number().optional().describe("Project ID (optional \u2014 omit to use the flat route)"),
|
|
670
|
+
resolved: z8.boolean().optional().describe("Filter: true returns only resolved comments, false returns only unresolved")
|
|
671
|
+
},
|
|
672
|
+
async (params) => {
|
|
673
|
+
try {
|
|
674
|
+
const opts = params.resolved === void 0 ? void 0 : { resolved: params.resolved };
|
|
675
|
+
const result = params.project_id === void 0 ? await client2.listPageCommentsFlat(params.page_id, opts) : await client2.listPageComments(params.project_id, params.page_id, opts);
|
|
676
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
677
|
+
} catch (error) {
|
|
678
|
+
return handleError(error, client2.timeoutMs);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
);
|
|
651
682
|
server2.tool(
|
|
652
683
|
"cla_create_page_comment",
|
|
653
684
|
"Post a comment on a page. Optionally thread under another comment via parent_comment_id, or anchor to a text selection via anchor_text/anchor_start/anchor_end.",
|
|
@@ -799,6 +830,26 @@ function registerContextTools(server2, client2) {
|
|
|
799
830
|
}
|
|
800
831
|
}
|
|
801
832
|
);
|
|
833
|
+
server2.tool(
|
|
834
|
+
"cla_context_create",
|
|
835
|
+
"Create a new context entry. Required: name, entry_type, content. Optional: project_id (scope to project), workspace_id (when API key is not workspace-scoped), change_summary (initial commit message). Returns the new entry with id + slug.",
|
|
836
|
+
{
|
|
837
|
+
name: z9.string().describe("Display name of the entry"),
|
|
838
|
+
entry_type: z9.string().describe('Entry type (e.g., "instructions", "conventions", "architecture", "reference")'),
|
|
839
|
+
content: z9.string().describe("Initial markdown content"),
|
|
840
|
+
change_summary: z9.string().optional().describe("Initial commit message (defaults to a generic message if omitted)"),
|
|
841
|
+
project_id: z9.coerce.number().optional().describe("Scope entry to a project (omit for workspace-level)"),
|
|
842
|
+
workspace_id: z9.coerce.number().optional().describe("Workspace ID (only needed when API key is not workspace-scoped)")
|
|
843
|
+
},
|
|
844
|
+
async (params) => {
|
|
845
|
+
try {
|
|
846
|
+
const result = await client2.createContextEntry(params);
|
|
847
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
848
|
+
} catch (error) {
|
|
849
|
+
return handleError(error, client2.timeoutMs);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
);
|
|
802
853
|
server2.tool(
|
|
803
854
|
"cla_context_update",
|
|
804
855
|
"Update a context entry's content (requires write access)",
|