@crypto512/jicon-mcp 2.2.1 → 2.3.19
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/PROMPT.md +10 -28
- package/README.md +39 -6
- package/TOOL_LIST.md +542 -407
- package/dist/config/constants.d.ts +28 -0
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +34 -0
- package/dist/config/constants.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +12 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/config/types.d.ts +49 -6
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +18 -0
- package/dist/config/types.js.map +1 -1
- package/dist/confluence/client.d.ts.map +1 -1
- package/dist/confluence/client.js +7 -2
- package/dist/confluence/client.js.map +1 -1
- package/dist/confluence/formatters.d.ts +20 -0
- package/dist/confluence/formatters.d.ts.map +1 -1
- package/dist/confluence/formatters.js +74 -8
- package/dist/confluence/formatters.js.map +1 -1
- package/dist/confluence/tools.d.ts +16 -20
- package/dist/confluence/tools.d.ts.map +1 -1
- package/dist/confluence/tools.js +71 -68
- package/dist/confluence/tools.js.map +1 -1
- package/dist/credentials/extractor.d.ts +15 -5
- package/dist/credentials/extractor.d.ts.map +1 -1
- package/dist/credentials/extractor.js +99 -12
- package/dist/credentials/extractor.js.map +1 -1
- package/dist/credentials/index.d.ts +4 -3
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/index.js +3 -2
- package/dist/credentials/index.js.map +1 -1
- package/dist/credentials/types.d.ts +22 -0
- package/dist/credentials/types.d.ts.map +1 -1
- package/dist/credentials/types.js.map +1 -1
- package/dist/index.js +211 -176
- package/dist/index.js.map +1 -1
- package/dist/jira/activity-tools.d.ts +8 -15
- package/dist/jira/activity-tools.d.ts.map +1 -1
- package/dist/jira/activity-tools.js +131 -90
- package/dist/jira/activity-tools.js.map +1 -1
- package/dist/jira/client.d.ts +24 -0
- package/dist/jira/client.d.ts.map +1 -1
- package/dist/jira/client.js +65 -6
- package/dist/jira/client.js.map +1 -1
- package/dist/jira/formatters.d.ts +61 -0
- package/dist/jira/formatters.d.ts.map +1 -1
- package/dist/jira/formatters.js +83 -11
- package/dist/jira/formatters.js.map +1 -1
- package/dist/jira/tools.d.ts +78 -26
- package/dist/jira/tools.d.ts.map +1 -1
- package/dist/jira/tools.js +293 -130
- package/dist/jira/tools.js.map +1 -1
- package/dist/permissions/filter.d.ts.map +1 -1
- package/dist/permissions/filter.js +8 -4
- package/dist/permissions/filter.js.map +1 -1
- package/dist/permissions/tool-registry.d.ts +15 -13
- package/dist/permissions/tool-registry.d.ts.map +1 -1
- package/dist/permissions/tool-registry.js +19 -10
- package/dist/permissions/tool-registry.js.map +1 -1
- package/dist/session/context.d.ts +81 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +107 -0
- package/dist/session/context.js.map +1 -0
- package/dist/session/index.d.ts +12 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +22 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +186 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +383 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/tempo/client.d.ts +14 -0
- package/dist/tempo/client.d.ts.map +1 -1
- package/dist/tempo/client.js +57 -0
- package/dist/tempo/client.js.map +1 -1
- package/dist/tempo/formatters.d.ts +13 -0
- package/dist/tempo/formatters.d.ts.map +1 -1
- package/dist/tempo/formatters.js +106 -20
- package/dist/tempo/formatters.js.map +1 -1
- package/dist/tempo/tools.d.ts +14 -13
- package/dist/tempo/tools.d.ts.map +1 -1
- package/dist/tempo/tools.js +203 -33
- package/dist/tempo/tools.js.map +1 -1
- package/dist/tempo/types.d.ts +20 -6
- package/dist/tempo/types.d.ts.map +1 -1
- package/dist/transport/http.d.ts +21 -5
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +193 -22
- package/dist/transport/http.js.map +1 -1
- package/dist/transport/index.d.ts +7 -2
- package/dist/transport/index.d.ts.map +1 -1
- package/dist/transport/index.js +10 -4
- package/dist/transport/index.js.map +1 -1
- package/dist/utils/buffer-tools.d.ts +48 -724
- package/dist/utils/buffer-tools.d.ts.map +1 -1
- package/dist/utils/buffer-tools.js +337 -170
- package/dist/utils/buffer-tools.js.map +1 -1
- package/dist/utils/content-buffer.d.ts +10 -31
- package/dist/utils/content-buffer.d.ts.map +1 -1
- package/dist/utils/content-buffer.js +12 -86
- package/dist/utils/content-buffer.js.map +1 -1
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/http-client.js +99 -2
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/jicon-help.d.ts +3 -3
- package/dist/utils/jicon-help.d.ts.map +1 -1
- package/dist/utils/jicon-help.js +164 -312
- package/dist/utils/jicon-help.js.map +1 -1
- package/dist/utils/logger.d.ts +43 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +102 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/plantuml/tools.d.ts.map +1 -1
- package/dist/utils/plantuml/tools.js +10 -9
- package/dist/utils/plantuml/tools.js.map +1 -1
- package/dist/utils/response-formatter.d.ts +20 -2
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +147 -17
- package/dist/utils/response-formatter.js.map +1 -1
- package/dist/utils/sandbox/formatters.d.ts +25 -0
- package/dist/utils/sandbox/formatters.d.ts.map +1 -0
- package/dist/utils/sandbox/formatters.js +690 -0
- package/dist/utils/sandbox/formatters.js.map +1 -0
- package/dist/utils/sandbox/helpers.d.ts +16 -0
- package/dist/utils/sandbox/helpers.d.ts.map +1 -0
- package/dist/utils/sandbox/helpers.js +252 -0
- package/dist/utils/sandbox/helpers.js.map +1 -0
- package/dist/utils/sandbox/index.d.ts +19 -0
- package/dist/utils/sandbox/index.d.ts.map +1 -0
- package/dist/utils/sandbox/index.js +269 -0
- package/dist/utils/sandbox/index.js.map +1 -0
- package/dist/utils/sandbox/schema.d.ts +55 -0
- package/dist/utils/sandbox/schema.d.ts.map +1 -0
- package/dist/utils/sandbox/schema.js +39 -0
- package/dist/utils/sandbox/schema.js.map +1 -0
- package/dist/utils/sandbox/types.d.ts +179 -0
- package/dist/utils/sandbox/types.d.ts.map +1 -0
- package/dist/utils/sandbox/types.js +8 -0
- package/dist/utils/sandbox/types.js.map +1 -0
- package/dist/utils/schemas/confluence.d.ts +41 -0
- package/dist/utils/schemas/confluence.d.ts.map +1 -0
- package/dist/utils/schemas/confluence.js +105 -0
- package/dist/utils/schemas/confluence.js.map +1 -0
- package/dist/utils/schemas/index.d.ts +77 -0
- package/dist/utils/schemas/index.d.ts.map +1 -0
- package/dist/utils/schemas/index.js +107 -0
- package/dist/utils/schemas/index.js.map +1 -0
- package/dist/utils/schemas/jira.d.ts +49 -0
- package/dist/utils/schemas/jira.d.ts.map +1 -0
- package/dist/utils/schemas/jira.js +153 -0
- package/dist/utils/schemas/jira.js.map +1 -0
- package/dist/utils/schemas/tempo.d.ts +29 -0
- package/dist/utils/schemas/tempo.d.ts.map +1 -0
- package/dist/utils/schemas/tempo.js +72 -0
- package/dist/utils/schemas/tempo.js.map +1 -0
- package/dist/utils/whoami-tools.d.ts +17 -0
- package/dist/utils/whoami-tools.d.ts.map +1 -0
- package/dist/utils/whoami-tools.js +90 -0
- package/dist/utils/whoami-tools.js.map +1 -0
- package/dist/utils/xhtml/error-locator.js +5 -5
- package/dist/utils/xhtml/error-locator.js.map +1 -1
- package/package.json +10 -9
- package/dist/credentials/client-factory.d.ts +0 -64
- package/dist/credentials/client-factory.d.ts.map +0 -1
- package/dist/credentials/client-factory.js +0 -110
- package/dist/credentials/client-factory.js.map +0 -1
- package/dist/credentials/context.d.ts +0 -25
- package/dist/credentials/context.d.ts.map +0 -1
- package/dist/credentials/context.js +0 -35
- package/dist/credentials/context.js.map +0 -1
- package/dist/utils/buffer-pipeline/index.d.ts +0 -30
- package/dist/utils/buffer-pipeline/index.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/index.js +0 -317
- package/dist/utils/buffer-pipeline/index.js.map +0 -1
- package/dist/utils/buffer-pipeline/output/csv.d.ts +0 -20
- package/dist/utils/buffer-pipeline/output/csv.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/output/csv.js +0 -117
- package/dist/utils/buffer-pipeline/output/csv.js.map +0 -1
- package/dist/utils/buffer-pipeline/output/json.d.ts +0 -16
- package/dist/utils/buffer-pipeline/output/json.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/output/json.js +0 -48
- package/dist/utils/buffer-pipeline/output/json.js.map +0 -1
- package/dist/utils/buffer-pipeline/output/markdown.d.ts +0 -15
- package/dist/utils/buffer-pipeline/output/markdown.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/output/markdown.js +0 -105
- package/dist/utils/buffer-pipeline/output/markdown.js.map +0 -1
- package/dist/utils/buffer-pipeline/output/xhtml-list.d.ts +0 -16
- package/dist/utils/buffer-pipeline/output/xhtml-list.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/output/xhtml-list.js +0 -81
- package/dist/utils/buffer-pipeline/output/xhtml-list.js.map +0 -1
- package/dist/utils/buffer-pipeline/output/xhtml-table.d.ts +0 -15
- package/dist/utils/buffer-pipeline/output/xhtml-table.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/output/xhtml-table.js +0 -176
- package/dist/utils/buffer-pipeline/output/xhtml-table.js.map +0 -1
- package/dist/utils/buffer-pipeline/schema.d.ts +0 -1878
- package/dist/utils/buffer-pipeline/schema.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/schema.js +0 -168
- package/dist/utils/buffer-pipeline/schema.js.map +0 -1
- package/dist/utils/buffer-pipeline/stages/filter.d.ts +0 -32
- package/dist/utils/buffer-pipeline/stages/filter.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/stages/filter.js +0 -208
- package/dist/utils/buffer-pipeline/stages/filter.js.map +0 -1
- package/dist/utils/buffer-pipeline/stages/format.d.ts +0 -45
- package/dist/utils/buffer-pipeline/stages/format.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/stages/format.js +0 -160
- package/dist/utils/buffer-pipeline/stages/format.js.map +0 -1
- package/dist/utils/buffer-pipeline/stages/group-by.d.ts +0 -25
- package/dist/utils/buffer-pipeline/stages/group-by.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/stages/group-by.js +0 -190
- package/dist/utils/buffer-pipeline/stages/group-by.js.map +0 -1
- package/dist/utils/buffer-pipeline/stages/select.d.ts +0 -54
- package/dist/utils/buffer-pipeline/stages/select.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/stages/select.js +0 -228
- package/dist/utils/buffer-pipeline/stages/select.js.map +0 -1
- package/dist/utils/buffer-pipeline/stages/sort.d.ts +0 -20
- package/dist/utils/buffer-pipeline/stages/sort.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/stages/sort.js +0 -96
- package/dist/utils/buffer-pipeline/stages/sort.js.map +0 -1
- package/dist/utils/buffer-pipeline/types.d.ts +0 -277
- package/dist/utils/buffer-pipeline/types.d.ts.map +0 -1
- package/dist/utils/buffer-pipeline/types.js +0 -8
- package/dist/utils/buffer-pipeline/types.js.map +0 -1
- package/dist/utils/plantuml/docker-manager.d.ts +0 -37
- package/dist/utils/plantuml/docker-manager.d.ts.map +0 -1
- package/dist/utils/plantuml/docker-manager.js +0 -284
- package/dist/utils/plantuml/docker-manager.js.map +0 -1
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Confluence MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* All tool handlers use session-scoped clients and buffers via getSessionXxxClient()
|
|
5
|
+
* and getSessionBuffer() functions which provide per-session isolation.
|
|
3
6
|
*/
|
|
4
7
|
import { z } from "zod";
|
|
5
|
-
import { ConfluenceClient } from "./client.js";
|
|
6
8
|
import type { ToolResult } from "../types.js";
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
10
|
+
* Create Confluence tools using session-scoped clients
|
|
11
|
+
*
|
|
12
|
+
* Tools automatically use the ConfluenceClient from the current session context,
|
|
13
|
+
* which provides per-session caching and credential isolation.
|
|
9
14
|
*/
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
* Create Confluence tools with a client getter function
|
|
13
|
-
*/
|
|
14
|
-
export declare function createConfluenceTools(getClient: ConfluenceClientGetter): {
|
|
15
|
+
export declare function createConfluenceTools(): {
|
|
15
16
|
confluence_search_content: {
|
|
16
17
|
description: string;
|
|
17
18
|
inputSchema: z.ZodObject<{
|
|
18
19
|
cql: z.ZodString;
|
|
19
|
-
expand: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
+
expand: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>>;
|
|
20
21
|
}, "strip", z.ZodTypeAny, {
|
|
21
22
|
cql: string;
|
|
22
23
|
expand?: string[] | undefined;
|
|
23
24
|
}, {
|
|
24
25
|
cql: string;
|
|
25
|
-
expand?:
|
|
26
|
+
expand?: unknown;
|
|
26
27
|
}>;
|
|
27
28
|
handler: (args: {
|
|
28
29
|
cql: string;
|
|
@@ -51,7 +52,7 @@ export declare function createConfluenceTools(getClient: ConfluenceClientGetter)
|
|
|
51
52
|
inputSchema: z.ZodObject<{
|
|
52
53
|
spaceKey: z.ZodString;
|
|
53
54
|
title: z.ZodString;
|
|
54
|
-
expand: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
55
|
+
expand: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>>;
|
|
55
56
|
}, "strip", z.ZodTypeAny, {
|
|
56
57
|
spaceKey: string;
|
|
57
58
|
title: string;
|
|
@@ -59,7 +60,7 @@ export declare function createConfluenceTools(getClient: ConfluenceClientGetter)
|
|
|
59
60
|
}, {
|
|
60
61
|
spaceKey: string;
|
|
61
62
|
title: string;
|
|
62
|
-
expand?:
|
|
63
|
+
expand?: unknown;
|
|
63
64
|
}>;
|
|
64
65
|
handler: (args: {
|
|
65
66
|
spaceKey: string;
|
|
@@ -110,13 +111,13 @@ export declare function createConfluenceTools(getClient: ConfluenceClientGetter)
|
|
|
110
111
|
description: string;
|
|
111
112
|
inputSchema: z.ZodObject<{
|
|
112
113
|
spaceKey: z.ZodString;
|
|
113
|
-
expand: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
114
|
+
expand: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>>;
|
|
114
115
|
}, "strip", z.ZodTypeAny, {
|
|
115
116
|
spaceKey: string;
|
|
116
117
|
expand?: string[] | undefined;
|
|
117
118
|
}, {
|
|
118
119
|
spaceKey: string;
|
|
119
|
-
expand?:
|
|
120
|
+
expand?: unknown;
|
|
120
121
|
}>;
|
|
121
122
|
handler: (args: {
|
|
122
123
|
spaceKey: string;
|
|
@@ -127,13 +128,13 @@ export declare function createConfluenceTools(getClient: ConfluenceClientGetter)
|
|
|
127
128
|
description: string;
|
|
128
129
|
inputSchema: z.ZodObject<{
|
|
129
130
|
pageId: z.ZodString;
|
|
130
|
-
expand: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
expand: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>>;
|
|
131
132
|
}, "strip", z.ZodTypeAny, {
|
|
132
133
|
pageId: string;
|
|
133
134
|
expand?: string[] | undefined;
|
|
134
135
|
}, {
|
|
135
136
|
pageId: string;
|
|
136
|
-
expand?:
|
|
137
|
+
expand?: unknown;
|
|
137
138
|
}>;
|
|
138
139
|
handler: (args: {
|
|
139
140
|
pageId: string;
|
|
@@ -204,11 +205,6 @@ export declare function createConfluenceTools(getClient: ConfluenceClientGetter)
|
|
|
204
205
|
pageId: string;
|
|
205
206
|
}) => Promise<ToolResult>;
|
|
206
207
|
};
|
|
207
|
-
confluence_get_current_user_space: {
|
|
208
|
-
description: string;
|
|
209
|
-
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
210
|
-
handler: () => Promise<ToolResult>;
|
|
211
|
-
};
|
|
212
208
|
confluence_draft_create: {
|
|
213
209
|
description: string;
|
|
214
210
|
inputSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/confluence/tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/confluence/tools.ts"],"names":[],"mappings":"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"}
|
package/dist/confluence/tools.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Confluence MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* All tool handlers use session-scoped clients and buffers via getSessionXxxClient()
|
|
5
|
+
* and getSessionBuffer() functions which provide per-session isolation.
|
|
3
6
|
*/
|
|
4
7
|
import { z } from "zod";
|
|
5
|
-
import { formatSuccess, formatSuccessJson, formatSuccessXhtml, formatError, isApiError } from "../utils/response-formatter.js";
|
|
6
|
-
import {
|
|
7
|
-
import { formatPageMetadata } from "./formatters.js";
|
|
8
|
+
import { formatSuccess, formatSuccessJson, formatSuccessXhtml, formatError, isApiError, getMaxApiResults } from "../utils/response-formatter.js";
|
|
9
|
+
import { getSessionBuffer, getSessionConfluenceClient } from "../session/context.js";
|
|
10
|
+
import { formatPageMetadata, formatPageSchemaMetadata, formatSpaceMetadata, formatCommentMetadata, formatAttachmentMetadata, formatDraftMetadata, } from "./formatters.js";
|
|
8
11
|
import { validateXhtmlAsync, parseXhtml, enhanceXhtmlError } from "../utils/xhtml/index.js";
|
|
9
12
|
import { detectRawPlantUml, detectDiagramType } from "../utils/xhtml/plantuml.js";
|
|
10
13
|
import { convertPlantUmlIncludesInXhtml, IncludeConversionError } from "../utils/plantuml/index.js";
|
|
11
14
|
import { parseUrl } from "../utils/url-tools.js";
|
|
12
15
|
import { DEFAULT_PAGE_EXPAND } from "./defaults.js";
|
|
16
|
+
/**
|
|
17
|
+
* Schema that accepts either a comma-separated string or an array of strings.
|
|
18
|
+
* Examples: "space,metadata" or ["space", "metadata"]
|
|
19
|
+
*/
|
|
20
|
+
const stringOrArray = z.preprocess((val) => typeof val === "string" ? val.split(",").map(s => s.trim()).filter(Boolean) : val, z.array(z.string()));
|
|
13
21
|
/**
|
|
14
22
|
* Generate a summary of content structure for draft responses.
|
|
15
23
|
* Helps AI assistants verify that diagrams and other elements are included.
|
|
@@ -137,11 +145,14 @@ async function validateContentForWrite(content, bufferId) {
|
|
|
137
145
|
return null; // Valid content
|
|
138
146
|
}
|
|
139
147
|
/**
|
|
140
|
-
* Create Confluence tools
|
|
148
|
+
* Create Confluence tools using session-scoped clients
|
|
149
|
+
*
|
|
150
|
+
* Tools automatically use the ConfluenceClient from the current session context,
|
|
151
|
+
* which provides per-session caching and credential isolation.
|
|
141
152
|
*/
|
|
142
|
-
export function createConfluenceTools(
|
|
153
|
+
export function createConfluenceTools() {
|
|
143
154
|
const requireClient = () => {
|
|
144
|
-
const client =
|
|
155
|
+
const client = getSessionConfluenceClient();
|
|
145
156
|
if (!client) {
|
|
146
157
|
throw new Error("Confluence is not configured. Provide CONFLUENCE_URL and CONFLUENCE_API_TOKEN environment variables, or pass credentials via X-Confluence-Url and X-Confluence-Token headers.");
|
|
147
158
|
}
|
|
@@ -155,20 +166,24 @@ Entry point for finding Confluence pages by content, title, or metadata.
|
|
|
155
166
|
|
|
156
167
|
REQUIRES: Valid CQL query (see help(topic="cql") for syntax)
|
|
157
168
|
RETURNS: bufferId (JSON array), itemCount with page IDs and titles
|
|
158
|
-
NEXT: confluence_get_page (to load),
|
|
169
|
+
NEXT: confluence_get_page (to load), buffer_transform (for reports), buffer_grep (to search results)
|
|
159
170
|
|
|
160
|
-
|
|
171
|
+
TIP: "MY pages" = contributor=currentUser() (pages user edited/created)
|
|
172
|
+
Example: cql="contributor=currentUser() ORDER BY lastmodified DESC"
|
|
161
173
|
|
|
162
174
|
WARNING: Use text~ not content~. Use space KEY not name.`,
|
|
163
175
|
inputSchema: z.object({
|
|
164
176
|
cql: z.string().describe("CQL query string"),
|
|
165
|
-
expand:
|
|
177
|
+
expand: stringOrArray.optional().describe("Additional data to expand (string or array)"),
|
|
166
178
|
}),
|
|
167
179
|
handler: async (args) => {
|
|
168
180
|
try {
|
|
169
|
-
const result = await requireClient().searchContentAll(args.cql, args.expand);
|
|
170
|
-
|
|
181
|
+
const result = await requireClient().searchContentAll(args.cql, args.expand, getMaxApiResults());
|
|
182
|
+
// Flatten pages to match confluence_page schema
|
|
183
|
+
const pages = (result.results || []).map((p) => formatPageSchemaMetadata(p));
|
|
184
|
+
return formatSuccessJson(pages, {
|
|
171
185
|
resourceType: "confluence_search",
|
|
186
|
+
schemaType: "confluence_page",
|
|
172
187
|
title: `CQL: ${args.cql.substring(0, 100)}${args.cql.length > 100 ? "..." : ""}`,
|
|
173
188
|
});
|
|
174
189
|
}
|
|
@@ -199,7 +214,8 @@ WARNING: Use text~ not content~. Use space KEY not name.`,
|
|
|
199
214
|
hint += "\nExamples:\n";
|
|
200
215
|
hint += " text~\"Mike Tasc\" - finds pages mentioning this person\n";
|
|
201
216
|
hint += " text~\"meeting\" AND space=MESH - finds meetings in MESH space\n";
|
|
202
|
-
hint += " title~\"sprint review\" - finds pages with sprint review in title";
|
|
217
|
+
hint += " title~\"sprint review\" - finds pages with sprint review in title\n";
|
|
218
|
+
hint += '\nTIP: Call help(topic="cql") for full CQL syntax guide.';
|
|
203
219
|
return formatError({
|
|
204
220
|
...error,
|
|
205
221
|
message: error.message + hint
|
|
@@ -277,7 +293,7 @@ Use buffer_edit(bufferId, after=ID, content/plantuml/fromBufferId) to add conten
|
|
|
277
293
|
inputSchema: z.object({
|
|
278
294
|
spaceKey: z.string().describe("Space key (short code like 'MESH', 'TC'), NOT the full space name"),
|
|
279
295
|
title: z.string().describe("Page title"),
|
|
280
|
-
expand:
|
|
296
|
+
expand: stringOrArray.optional().describe("Additional data to expand (string or array)"),
|
|
281
297
|
}),
|
|
282
298
|
handler: async (args) => {
|
|
283
299
|
try {
|
|
@@ -514,7 +530,7 @@ Example: confluence_delete_page(pageId="123456")`,
|
|
|
514
530
|
try {
|
|
515
531
|
await requireClient().deletePage(args.pageId);
|
|
516
532
|
// Invalidate any cached buffers for this page
|
|
517
|
-
|
|
533
|
+
getSessionBuffer().invalidateByMetadata({
|
|
518
534
|
resourceType: "confluence_page",
|
|
519
535
|
resourceId: args.pageId,
|
|
520
536
|
});
|
|
@@ -547,8 +563,11 @@ Example: confluence_list_spaces(type="global")`,
|
|
|
547
563
|
handler: async (args) => {
|
|
548
564
|
try {
|
|
549
565
|
const result = await requireClient().listSpaces(args.type);
|
|
550
|
-
|
|
566
|
+
// Flatten spaces to match confluence_space schema
|
|
567
|
+
const spaces = (result.results || []).map((s) => formatSpaceMetadata(s));
|
|
568
|
+
return formatSuccessJson(spaces, {
|
|
551
569
|
resourceType: "confluence_spaces",
|
|
570
|
+
schemaType: "confluence_space",
|
|
552
571
|
title: args.type ? `${args.type} spaces` : "All Spaces",
|
|
553
572
|
});
|
|
554
573
|
}
|
|
@@ -569,13 +588,18 @@ NEXT: confluence_search_content (to query space), confluence_get_page (homepage)
|
|
|
569
588
|
Example: confluence_get_space(spaceKey="DOCS")`,
|
|
570
589
|
inputSchema: z.object({
|
|
571
590
|
spaceKey: z.string().describe("Space key"),
|
|
572
|
-
expand:
|
|
591
|
+
expand: stringOrArray.optional().describe("Additional data to expand (string or array)"),
|
|
573
592
|
}),
|
|
574
593
|
handler: async (args) => {
|
|
575
594
|
try {
|
|
576
595
|
const result = await requireClient().getSpace(args.spaceKey, args.expand);
|
|
577
|
-
|
|
596
|
+
// Flatten space to match confluence_space schema, keep raw data for extra fields
|
|
597
|
+
return formatSuccessJson({
|
|
598
|
+
...formatSpaceMetadata(result),
|
|
599
|
+
data: result,
|
|
600
|
+
}, {
|
|
578
601
|
resourceType: "confluence_space",
|
|
602
|
+
schemaType: "confluence_space",
|
|
579
603
|
title: result.name || args.spaceKey,
|
|
580
604
|
spaceKey: args.spaceKey,
|
|
581
605
|
});
|
|
@@ -591,13 +615,16 @@ Example: confluence_get_space(spaceKey="DOCS")`,
|
|
|
591
615
|
Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
592
616
|
inputSchema: z.object({
|
|
593
617
|
pageId: z.coerce.string().describe("Parent page ID (accepts string or number)"),
|
|
594
|
-
expand:
|
|
618
|
+
expand: stringOrArray.optional().describe("Additional data to expand (string or array)"),
|
|
595
619
|
}),
|
|
596
620
|
handler: async (args) => {
|
|
597
621
|
try {
|
|
598
622
|
const result = await requireClient().getPageChildren(args.pageId, args.expand);
|
|
599
|
-
|
|
623
|
+
// Flatten pages to match confluence_page schema
|
|
624
|
+
const pages = (result.results || []).map((p) => formatPageSchemaMetadata(p));
|
|
625
|
+
return formatSuccessJson(pages, {
|
|
600
626
|
resourceType: "confluence_page_children",
|
|
627
|
+
schemaType: "confluence_page",
|
|
601
628
|
title: `Page ${args.pageId} children`,
|
|
602
629
|
pageId: args.pageId,
|
|
603
630
|
});
|
|
@@ -633,8 +660,11 @@ Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
|
633
660
|
handler: async (args) => {
|
|
634
661
|
try {
|
|
635
662
|
const result = await requireClient().getComments(args.pageId);
|
|
636
|
-
|
|
663
|
+
// Flatten comments to match confluence_comment schema
|
|
664
|
+
const comments = (result.results || []).map((c) => formatCommentMetadata(c));
|
|
665
|
+
return formatSuccessJson(comments, {
|
|
637
666
|
resourceType: "confluence_comments",
|
|
667
|
+
schemaType: "confluence_comment",
|
|
638
668
|
title: `Page ${args.pageId} comments`,
|
|
639
669
|
pageId: args.pageId,
|
|
640
670
|
});
|
|
@@ -671,8 +701,11 @@ Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
|
671
701
|
handler: async (args) => {
|
|
672
702
|
try {
|
|
673
703
|
const result = await requireClient().listAttachments(args.pageId);
|
|
674
|
-
|
|
704
|
+
// Flatten attachments to match confluence_attachment schema
|
|
705
|
+
const attachments = (result.results || []).map((a) => formatAttachmentMetadata(a));
|
|
706
|
+
return formatSuccessJson(attachments, {
|
|
675
707
|
resourceType: "confluence_attachments",
|
|
708
|
+
schemaType: "confluence_attachment",
|
|
676
709
|
title: `Page ${args.pageId} attachments`,
|
|
677
710
|
pageId: args.pageId,
|
|
678
711
|
});
|
|
@@ -682,34 +715,6 @@ Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
|
682
715
|
}
|
|
683
716
|
},
|
|
684
717
|
},
|
|
685
|
-
confluence_get_current_user_space: {
|
|
686
|
-
description: `Get the current user's personal Confluence space. Returns spaceKey and homePageId.
|
|
687
|
-
Use to verify personal space before write operations when write-home restriction is enabled.`,
|
|
688
|
-
inputSchema: z.object({}),
|
|
689
|
-
handler: async () => {
|
|
690
|
-
try {
|
|
691
|
-
const userSpace = await requireClient().getCurrentUserSpace();
|
|
692
|
-
if (!userSpace) {
|
|
693
|
-
return formatError({
|
|
694
|
-
error: true,
|
|
695
|
-
message: "No personal space found for current user",
|
|
696
|
-
statusCode: 404,
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
return formatSuccess({
|
|
700
|
-
spaceKey: userSpace.key,
|
|
701
|
-
spaceName: userSpace.name,
|
|
702
|
-
spaceType: userSpace.type,
|
|
703
|
-
homePageId: userSpace.homepage?.id,
|
|
704
|
-
homePageTitle: userSpace.homepage?.title,
|
|
705
|
-
tip: "Use this spaceKey when creating pages with write-home restriction enabled",
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
catch (error) {
|
|
709
|
-
return formatError(isApiError(error) ? error : new Error(String(error)));
|
|
710
|
-
}
|
|
711
|
-
},
|
|
712
|
-
},
|
|
713
718
|
// ========================================
|
|
714
719
|
// Draft Tools
|
|
715
720
|
// ========================================
|
|
@@ -740,7 +745,7 @@ WARNING: pageId must be a PAGE ID, not a draft ID. Use confluence_draft_open for
|
|
|
740
745
|
let originalPageId;
|
|
741
746
|
let originalPageVersion;
|
|
742
747
|
// Validate buffer exists and get content
|
|
743
|
-
const bufferInfo =
|
|
748
|
+
const bufferInfo = getSessionBuffer().getInfo(args.bufferId);
|
|
744
749
|
if (!bufferInfo) {
|
|
745
750
|
return formatError({
|
|
746
751
|
error: true,
|
|
@@ -763,7 +768,7 @@ WARNING: pageId must be a PAGE ID, not a draft ID. Use confluence_draft_open for
|
|
|
763
768
|
});
|
|
764
769
|
}
|
|
765
770
|
// Get full content from buffer
|
|
766
|
-
const fullContent =
|
|
771
|
+
const fullContent = getSessionBuffer().getChunk(args.bufferId, 0, bufferInfo.bufferSizeBytes);
|
|
767
772
|
if (!fullContent) {
|
|
768
773
|
return formatError({
|
|
769
774
|
error: true,
|
|
@@ -1054,7 +1059,10 @@ Use buffer_edit(bufferId, after=ID, content/plantuml/fromBufferId) to modify, th
|
|
|
1054
1059
|
},
|
|
1055
1060
|
},
|
|
1056
1061
|
confluence_draft_list: {
|
|
1057
|
-
description: `List your draft pages
|
|
1062
|
+
description: `List your UNPUBLISHED draft pages (work-in-progress, not yet published).
|
|
1063
|
+
|
|
1064
|
+
NOTE: To find PUBLISHED pages you edited, use:
|
|
1065
|
+
confluence_search_content(cql="contributor=currentUser() ORDER BY lastmodified DESC")
|
|
1058
1066
|
|
|
1059
1067
|
Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
1060
1068
|
inputSchema: z.object({
|
|
@@ -1065,19 +1073,14 @@ Returns bufferId. Use buffer_get_items to read, buffer_grep to search.`,
|
|
|
1065
1073
|
const result = await requireClient().listUserDrafts(args.spaceKey);
|
|
1066
1074
|
// Build the base URL for constructing full URLs
|
|
1067
1075
|
const baseUrl = requireClient().getBaseUrl();
|
|
1076
|
+
// Flatten drafts to match confluence_draft schema
|
|
1068
1077
|
const drafts = result.results.map((page) => ({
|
|
1069
|
-
|
|
1070
|
-
title: page.title,
|
|
1071
|
-
spaceKey: page.space?.key || "",
|
|
1072
|
-
spaceName: page.space?.name || "",
|
|
1073
|
-
created: page.version?.when || "",
|
|
1078
|
+
...formatDraftMetadata(page),
|
|
1074
1079
|
url: `${baseUrl}/pages/resumedraft.action?draftId=${page.id}`,
|
|
1075
1080
|
}));
|
|
1076
|
-
return formatSuccessJson({
|
|
1077
|
-
drafts,
|
|
1078
|
-
total: result.totalSize,
|
|
1079
|
-
}, {
|
|
1081
|
+
return formatSuccessJson(drafts, {
|
|
1080
1082
|
resourceType: "confluence_drafts",
|
|
1083
|
+
schemaType: "confluence_draft",
|
|
1081
1084
|
title: args.spaceKey ? `Drafts in ${args.spaceKey}` : "All Drafts",
|
|
1082
1085
|
});
|
|
1083
1086
|
}
|
|
@@ -1110,7 +1113,7 @@ Returns new draftId, bufferId, structure (element IDs), and URL. Always use the
|
|
|
1110
1113
|
});
|
|
1111
1114
|
}
|
|
1112
1115
|
// Get content from buffer
|
|
1113
|
-
const bufferChunk =
|
|
1116
|
+
const bufferChunk = getSessionBuffer().getChunk(args.bufferId);
|
|
1114
1117
|
if (!bufferChunk) {
|
|
1115
1118
|
return formatError({
|
|
1116
1119
|
error: true,
|
|
@@ -1119,7 +1122,7 @@ Returns new draftId, bufferId, structure (element IDs), and URL. Always use the
|
|
|
1119
1122
|
});
|
|
1120
1123
|
}
|
|
1121
1124
|
// Get full content from buffer
|
|
1122
|
-
const fullContent =
|
|
1125
|
+
const fullContent = getSessionBuffer().getChunk(args.bufferId, 0, bufferChunk.bufferSizeBytes);
|
|
1123
1126
|
if (!fullContent) {
|
|
1124
1127
|
return formatError({
|
|
1125
1128
|
error: true,
|
|
@@ -1195,7 +1198,7 @@ Returns new draftId, bufferId, structure (element IDs), and URL. Always use the
|
|
|
1195
1198
|
parentId: existingDraft.ancestors?.[0]?.id,
|
|
1196
1199
|
});
|
|
1197
1200
|
// Update buffer metadata with new draft ID
|
|
1198
|
-
|
|
1201
|
+
getSessionBuffer().invalidateByMetadata({
|
|
1199
1202
|
resourceType: "confluence_draft",
|
|
1200
1203
|
resourceId: args.draftId,
|
|
1201
1204
|
});
|
|
@@ -1247,7 +1250,7 @@ Drafts are NOT sent to trash - they are permanently deleted.`,
|
|
|
1247
1250
|
try {
|
|
1248
1251
|
await requireClient().deleteDraft(args.draftId);
|
|
1249
1252
|
// Invalidate any cached buffers for this draft
|
|
1250
|
-
|
|
1253
|
+
getSessionBuffer().invalidateByMetadata({
|
|
1251
1254
|
resourceType: "confluence_page",
|
|
1252
1255
|
resourceId: args.draftId,
|
|
1253
1256
|
});
|
|
@@ -1365,8 +1368,8 @@ Example: confluence_review_publish(reviewDraftId="123456")`,
|
|
|
1365
1368
|
// 7. Delete review draft
|
|
1366
1369
|
await requireClient().deleteDraft(args.reviewDraftId);
|
|
1367
1370
|
// 8. Invalidate buffers
|
|
1368
|
-
|
|
1369
|
-
|
|
1371
|
+
getSessionBuffer().invalidateByMetadata({ resourceId: originalPageId });
|
|
1372
|
+
getSessionBuffer().invalidateByMetadata({ resourceId: args.reviewDraftId });
|
|
1370
1373
|
// Build the page URL
|
|
1371
1374
|
const baseUrl = requireClient().getBaseUrl();
|
|
1372
1375
|
const pageUrl = `${baseUrl}${updatedPage._links?.webui || `/pages/viewpage.action?pageId=${originalPageId}`}`;
|
|
@@ -1415,7 +1418,7 @@ This tool:
|
|
|
1415
1418
|
// 3. Delete review draft
|
|
1416
1419
|
await requireClient().deleteDraft(args.reviewDraftId);
|
|
1417
1420
|
// 4. Invalidate buffer
|
|
1418
|
-
|
|
1421
|
+
getSessionBuffer().invalidateByMetadata({ resourceId: args.reviewDraftId });
|
|
1419
1422
|
return formatSuccess({
|
|
1420
1423
|
success: true,
|
|
1421
1424
|
discarded: true,
|