@smartruns/mcp 1.1.1 → 1.1.2
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/tools/comments.js +11 -8
- package/package.json +1 -1
package/dist/tools/comments.js
CHANGED
|
@@ -8,15 +8,18 @@ function handleError(err) {
|
|
|
8
8
|
// Comments in SmartRuns are polymorphic but NOT via Rails-standard commentable_type /
|
|
9
9
|
// commentable_id, and NOT nested under a parent route. The CommentsController
|
|
10
10
|
// (app/controllers/comments_controller.rb) drives everything off two flat params,
|
|
11
|
-
// `source_type` + `source_id`, validated against Comment::SUPPORTED_SCOPES
|
|
12
|
-
// (app/models/comment.rb). The comment body lives on the `text` attribute.
|
|
13
|
-
//
|
|
14
|
-
|
|
11
|
+
// `source_type` + `source_id`, validated server-side against Comment::SUPPORTED_SCOPES
|
|
12
|
+
// (app/models/comment.rb). The comment body lives on the `text` attribute.
|
|
13
|
+
//
|
|
14
|
+
// source_type is intentionally a permissive string, NOT a hardcoded enum: the server is
|
|
15
|
+
// the single source of truth for valid scopes and rejects an unsupported one, so this
|
|
16
|
+
// wrapper never goes stale when a scope is added (e.g. `defect`). Do not re-introduce a
|
|
17
|
+
// client-side enum here — it only duplicates server validation and drifts.
|
|
15
18
|
const sourceTypeSchema = z
|
|
16
|
-
.
|
|
17
|
-
.describe('Parent entity type the comment belongs to
|
|
19
|
+
.string()
|
|
20
|
+
.describe('Parent entity type the comment belongs to — a Comment::SUPPORTED_SCOPES value (currently test, test_plan, test_run, test_suite, spec, defect). Validated server-side; an unsupported scope is rejected by the API.');
|
|
18
21
|
export function registerCommentTools(server, client) {
|
|
19
|
-
server.tool('list_comments', 'List comments on a parent entity (test, test_plan, test_run, test_suite, or
|
|
22
|
+
server.tool('list_comments', 'List comments on a parent entity (test, test_plan, test_run, test_suite, spec, or defect). Comments are polymorphic: identify the parent with source_type + source_id. Scoped to the current account and project server-side.', {
|
|
20
23
|
source_type: sourceTypeSchema,
|
|
21
24
|
source_id: z.number().int().describe('ID of the parent entity the comments belong to'),
|
|
22
25
|
project_id: z.string().optional().describe('Override the project for this call (WTProject header). Defaults to SMARTRUNS_PROJECT_ID.'),
|
|
@@ -29,7 +32,7 @@ export function registerCommentTools(server, client) {
|
|
|
29
32
|
return handleError(err);
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
|
-
server.tool('create_comment', 'Create a comment on a parent entity (test, test_plan, test_run, test_suite, or
|
|
35
|
+
server.tool('create_comment', 'Create a comment on a parent entity (test, test_plan, test_run, test_suite, spec, or defect). The comment body goes in the "text" field. The parent is identified by source_type + source_id. The author is set server-side from the authenticated token.', {
|
|
33
36
|
source_type: sourceTypeSchema,
|
|
34
37
|
source_id: z.number().int().describe('ID of the parent entity to comment on'),
|
|
35
38
|
text: z.string().describe('The comment body (required)'),
|