@flowdot.ai/mcp-server 1.0.0 → 1.0.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/LICENSE +21 -0
- package/README.md +162 -162
- package/bin/flowdot-mcp.js +15 -15
- package/dist/api-client.d.ts +214 -1
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +481 -1
- package/dist/api-client.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -9
- package/dist/server.js.map +1 -1
- package/dist/tools/agent-toolkits.d.ts +57 -0
- package/dist/tools/agent-toolkits.d.ts.map +1 -0
- package/dist/tools/agent-toolkits.js +1705 -0
- package/dist/tools/agent-toolkits.js.map +1 -0
- package/dist/tools/append-app-code.d.ts +12 -0
- package/dist/tools/append-app-code.d.ts.map +1 -0
- package/dist/tools/append-app-code.js +83 -0
- package/dist/tools/append-app-code.js.map +1 -0
- package/dist/tools/clone-app.js +20 -20
- package/dist/tools/convert-app-to-multifile.d.ts +11 -0
- package/dist/tools/convert-app-to-multifile.d.ts.map +1 -0
- package/dist/tools/convert-app-to-multifile.js +69 -0
- package/dist/tools/convert-app-to-multifile.js.map +1 -0
- package/dist/tools/create-app-file.d.ts +11 -0
- package/dist/tools/create-app-file.d.ts.map +1 -0
- package/dist/tools/create-app-file.js +83 -0
- package/dist/tools/create-app-file.js.map +1 -0
- package/dist/tools/create-app.d.ts.map +1 -1
- package/dist/tools/create-app.js +47 -29
- package/dist/tools/create-app.js.map +1 -1
- package/dist/tools/create-knowledge-category.d.ts +16 -0
- package/dist/tools/create-knowledge-category.d.ts.map +1 -0
- package/dist/tools/create-knowledge-category.js +71 -0
- package/dist/tools/create-knowledge-category.js.map +1 -0
- package/dist/tools/delete-app-file.d.ts +11 -0
- package/dist/tools/delete-app-file.d.ts.map +1 -0
- package/dist/tools/delete-app-file.js +52 -0
- package/dist/tools/delete-app-file.js.map +1 -0
- package/dist/tools/delete-app.js +3 -3
- package/dist/tools/delete-knowledge-category.d.ts +12 -0
- package/dist/tools/delete-knowledge-category.d.ts.map +1 -0
- package/dist/tools/delete-knowledge-category.js +40 -0
- package/dist/tools/delete-knowledge-category.js.map +1 -0
- package/dist/tools/delete-knowledge-document.d.ts +12 -0
- package/dist/tools/delete-knowledge-document.d.ts.map +1 -0
- package/dist/tools/delete-knowledge-document.js +40 -0
- package/dist/tools/delete-knowledge-document.js.map +1 -0
- package/dist/tools/edit-app-code.d.ts +12 -0
- package/dist/tools/edit-app-code.d.ts.map +1 -0
- package/dist/tools/edit-app-code.js +110 -0
- package/dist/tools/edit-app-code.js.map +1 -0
- package/dist/tools/get-app-file.d.ts +11 -0
- package/dist/tools/get-app-file.d.ts.map +1 -0
- package/dist/tools/get-app-file.js +76 -0
- package/dist/tools/get-app-file.js.map +1 -0
- package/dist/tools/get-app-template.d.ts.map +1 -1
- package/dist/tools/get-app-template.js +65 -21
- package/dist/tools/get-app-template.js.map +1 -1
- package/dist/tools/get-app.js +54 -54
- package/dist/tools/get-knowledge-document.d.ts +12 -0
- package/dist/tools/get-knowledge-document.d.ts.map +1 -0
- package/dist/tools/get-knowledge-document.js +71 -0
- package/dist/tools/get-knowledge-document.js.map +1 -0
- package/dist/tools/get-knowledge-storage.d.ts +10 -0
- package/dist/tools/get-knowledge-storage.d.ts.map +1 -0
- package/dist/tools/get-knowledge-storage.js +54 -0
- package/dist/tools/get-knowledge-storage.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +214 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/insert-app-code.d.ts +12 -0
- package/dist/tools/insert-app-code.d.ts.map +1 -0
- package/dist/tools/insert-app-code.js +97 -0
- package/dist/tools/insert-app-code.js.map +1 -0
- package/dist/tools/link-app-workflow.js +21 -21
- package/dist/tools/list-app-files.d.ts +11 -0
- package/dist/tools/list-app-files.d.ts.map +1 -0
- package/dist/tools/list-app-files.js +84 -0
- package/dist/tools/list-app-files.js.map +1 -0
- package/dist/tools/list-apps.js +8 -8
- package/dist/tools/list-knowledge-categories.d.ts +14 -0
- package/dist/tools/list-knowledge-categories.d.ts.map +1 -0
- package/dist/tools/list-knowledge-categories.js +107 -0
- package/dist/tools/list-knowledge-categories.js.map +1 -0
- package/dist/tools/list-knowledge-documents.d.ts +15 -0
- package/dist/tools/list-knowledge-documents.d.ts.map +1 -0
- package/dist/tools/list-knowledge-documents.js +129 -0
- package/dist/tools/list-knowledge-documents.js.map +1 -0
- package/dist/tools/list-user-teams.d.ts +11 -0
- package/dist/tools/list-user-teams.d.ts.map +1 -0
- package/dist/tools/list-user-teams.js +56 -0
- package/dist/tools/list-user-teams.js.map +1 -0
- package/dist/tools/move-document-to-category.d.ts +13 -0
- package/dist/tools/move-document-to-category.d.ts.map +1 -0
- package/dist/tools/move-document-to-category.js +42 -0
- package/dist/tools/move-document-to-category.js.map +1 -0
- package/dist/tools/prepend-app-code.d.ts +12 -0
- package/dist/tools/prepend-app-code.d.ts.map +1 -0
- package/dist/tools/prepend-app-code.js +79 -0
- package/dist/tools/prepend-app-code.js.map +1 -0
- package/dist/tools/publish-app.js +7 -7
- package/dist/tools/query-knowledge-base.d.ts +18 -0
- package/dist/tools/query-knowledge-base.d.ts.map +1 -0
- package/dist/tools/query-knowledge-base.js +144 -0
- package/dist/tools/query-knowledge-base.js.map +1 -0
- package/dist/tools/rename-app-file.d.ts +11 -0
- package/dist/tools/rename-app-file.d.ts.map +1 -0
- package/dist/tools/rename-app-file.js +64 -0
- package/dist/tools/rename-app-file.js.map +1 -0
- package/dist/tools/reprocess-document.d.ts +12 -0
- package/dist/tools/reprocess-document.d.ts.map +1 -0
- package/dist/tools/reprocess-document.js +40 -0
- package/dist/tools/reprocess-document.js.map +1 -0
- package/dist/tools/search-apps.js +13 -13
- package/dist/tools/search.d.ts +14 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +86 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/set-app-entry-file.d.ts +11 -0
- package/dist/tools/set-app-entry-file.d.ts.map +1 -0
- package/dist/tools/set-app-entry-file.js +56 -0
- package/dist/tools/set-app-entry-file.js.map +1 -0
- package/dist/tools/transfer-document-ownership.d.ts +15 -0
- package/dist/tools/transfer-document-ownership.d.ts.map +1 -0
- package/dist/tools/transfer-document-ownership.js +66 -0
- package/dist/tools/transfer-document-ownership.js.map +1 -0
- package/dist/tools/unlink-app-workflow.js +2 -2
- package/dist/tools/unpublish-app.js +2 -2
- package/dist/tools/update-app-file.d.ts +11 -0
- package/dist/tools/update-app-file.d.ts.map +1 -0
- package/dist/tools/update-app-file.js +73 -0
- package/dist/tools/update-app-file.js.map +1 -0
- package/dist/tools/update-app.d.ts.map +1 -1
- package/dist/tools/update-app.js +8 -1
- package/dist/tools/update-app.js.map +1 -1
- package/dist/tools/update-knowledge-category.d.ts +15 -0
- package/dist/tools/update-knowledge-category.d.ts.map +1 -0
- package/dist/tools/update-knowledge-category.js +74 -0
- package/dist/tools/update-knowledge-category.js.map +1 -0
- package/dist/tools/upload-document-from-url.d.ts +16 -0
- package/dist/tools/upload-document-from-url.d.ts.map +1 -0
- package/dist/tools/upload-document-from-url.js +73 -0
- package/dist/tools/upload-document-from-url.js.map +1 -0
- package/dist/tools/upload-text-document.d.ts +17 -0
- package/dist/tools/upload-text-document.d.ts.map +1 -0
- package/dist/tools/upload-text-document.js +77 -0
- package/dist/tools/upload-text-document.js.map +1 -0
- package/dist/types.d.ts +426 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +54 -54
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export const unpublishAppTool = {
|
|
8
8
|
name: 'unpublish_app',
|
|
9
|
-
description: `Unpublish an app to make it private. The app will no longer be visible in the public marketplace.
|
|
10
|
-
|
|
9
|
+
description: `Unpublish an app to make it private. The app will no longer be visible in the public marketplace.
|
|
10
|
+
|
|
11
11
|
Existing clones of your app will continue to work for their owners, but new users won't be able to discover or clone it.`,
|
|
12
12
|
inputSchema: {
|
|
13
13
|
type: 'object',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update_app_file Tool
|
|
3
|
+
*
|
|
4
|
+
* Update an existing file in a multi-file FlowDot app.
|
|
5
|
+
* Required scope: apps:manage
|
|
6
|
+
*/
|
|
7
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
9
|
+
export declare const updateAppFileTool: Tool;
|
|
10
|
+
export declare function handleUpdateAppFile(client: FlowDotApiClient, args: Record<string, unknown>): Promise<CallToolResult>;
|
|
11
|
+
//# sourceMappingURL=update-app-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-app-file.d.ts","sourceRoot":"","sources":["../../src/tools/update-app-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,eAAO,MAAM,iBAAiB,EAAE,IAkC/B,CAAC;AAEF,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update_app_file Tool
|
|
3
|
+
*
|
|
4
|
+
* Update an existing file in a multi-file FlowDot app.
|
|
5
|
+
* Required scope: apps:manage
|
|
6
|
+
*/
|
|
7
|
+
export const updateAppFileTool = {
|
|
8
|
+
name: 'update_app_file',
|
|
9
|
+
description: `Update the content of an existing file in a FlowDot app.
|
|
10
|
+
|
|
11
|
+
Updates the file's content and optionally its type. Use this for making changes to existing files.
|
|
12
|
+
|
|
13
|
+
For surgical edits (find/replace), consider using edit_app_code instead.
|
|
14
|
+
|
|
15
|
+
File constraints:
|
|
16
|
+
- Max file size: 100KB per file
|
|
17
|
+
- Max total app size: 512KB across all files`,
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
app_id: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'The app ID (hash)',
|
|
24
|
+
},
|
|
25
|
+
file_path: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'The file path to update (e.g., "App.jsx", "components/Button.jsx")',
|
|
28
|
+
},
|
|
29
|
+
content: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The new file content',
|
|
32
|
+
},
|
|
33
|
+
type: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
enum: ['component', 'hook', 'utility', 'page', 'context', 'style'],
|
|
36
|
+
description: 'The file type (optional)',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ['app_id', 'file_path', 'content'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export async function handleUpdateAppFile(client, args) {
|
|
43
|
+
try {
|
|
44
|
+
const appId = String(args.app_id);
|
|
45
|
+
const filePath = String(args.file_path);
|
|
46
|
+
const input = {
|
|
47
|
+
content: String(args.content),
|
|
48
|
+
};
|
|
49
|
+
if (args.type) {
|
|
50
|
+
input.type = args.type;
|
|
51
|
+
}
|
|
52
|
+
const result = await client.updateAppFile(appId, filePath, input);
|
|
53
|
+
const text = `# File Updated Successfully
|
|
54
|
+
|
|
55
|
+
**Path:** ${result.path}
|
|
56
|
+
**Type:** ${result.type}
|
|
57
|
+
**Entry Point:** ${result.is_entry ? 'Yes' : 'No'}
|
|
58
|
+
**Updated:** ${result.updated_at}
|
|
59
|
+
|
|
60
|
+
The file has been updated in app ${appId}.`;
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text }],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: 'text', text: `Error updating app file: ${message}` }],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=update-app-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-app-file.js","sourceRoot":"","sources":["../../src/tools/update-app-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;6CAQ8B;IAC3C,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mBAAmB;aACjC;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oEAAoE;aAClF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sBAAsB;aACpC;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;gBAClE,WAAW,EAAE,0BAA0B;aACxC;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAC;KAC7C;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAwB,EACxB,IAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,MAAM,KAAK,GAAuB;YAChC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;SAC9B,CAAC;QAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAkC,CAAC;QACvD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAElE,MAAM,IAAI,GAAG;;YAEL,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,IAAI;mBACJ,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;eAClC,MAAM,CAAC,UAAU;;mCAEG,KAAK,GAAG,CAAC;QAExC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAClC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,4BAA4B,OAAO,EAAE,EAAE,CAAC;YACxE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-app.d.ts","sourceRoot":"","sources":["../../src/tools/update-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"update-app.d.ts","sourceRoot":"","sources":["../../src/tools/update-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,eAAO,MAAM,aAAa,EAAE,IA4D3B,CAAC;AAEF,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAmCzB"}
|
package/dist/tools/update-app.js
CHANGED
|
@@ -8,8 +8,15 @@ export const updateAppTool = {
|
|
|
8
8
|
name: 'update_app',
|
|
9
9
|
description: `Update an existing FlowDot app. You can update any combination of fields.
|
|
10
10
|
|
|
11
|
+
CRITICAL: Remember these rules when updating code:
|
|
12
|
+
- NO IMPORTS - React is global (use React.useState, etc.)
|
|
13
|
+
- MUST include export default at the end: export default MyAppName;
|
|
14
|
+
- NO FORM ELEMENTS - Never use <form> tags (sandbox blocks them)
|
|
15
|
+
- ALL BUTTONS need type="button" attribute
|
|
16
|
+
- Use getNodeOutput() helper to extract workflow results safely
|
|
17
|
+
|
|
11
18
|
Use this to:
|
|
12
|
-
- Update the React code
|
|
19
|
+
- Update the React code
|
|
13
20
|
- Change the name or description
|
|
14
21
|
- Add/update mobile-specific code
|
|
15
22
|
- Set display mode via config: { displayMode: "windowed" | "fullscreen" | "embedded" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-app.js","sourceRoot":"","sources":["../../src/tools/update-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"update-app.js","sourceRoot":"","sources":["../../src/tools/update-app.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE;;;;;;;;;;;;;;2BAcY;IACz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AAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,OAAO,EAAE,EAAE,CAAC;YACnE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Knowledge Category Tool
|
|
3
|
+
*
|
|
4
|
+
* Updates an existing document category.
|
|
5
|
+
*/
|
|
6
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
8
|
+
export declare const updateKnowledgeCategoryToolDef: Tool;
|
|
9
|
+
export declare function handleUpdateKnowledgeCategory(api: FlowDotApiClient, args: {
|
|
10
|
+
category_id: number;
|
|
11
|
+
name?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
}): Promise<CallToolResult>;
|
|
15
|
+
//# sourceMappingURL=update-knowledge-category.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-knowledge-category.d.ts","sourceRoot":"","sources":["../../src/tools/update-knowledge-category.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,8BAA8B,EAAE,IA0B5C,CAAC;AAEF,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACjF,OAAO,CAAC,cAAc,CAAC,CAuCzB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update Knowledge Category Tool
|
|
3
|
+
*
|
|
4
|
+
* Updates an existing document category.
|
|
5
|
+
*/
|
|
6
|
+
export const updateKnowledgeCategoryToolDef = {
|
|
7
|
+
name: 'update_knowledge_category',
|
|
8
|
+
description: 'Update an existing knowledge base category name, description, or color.',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
category_id: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'The ID of the category to update',
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'New name for the category (max 100 characters)',
|
|
19
|
+
},
|
|
20
|
+
description: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'New description (max 500 characters)',
|
|
23
|
+
},
|
|
24
|
+
color: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'New hex color code (e.g., #3B82F6)',
|
|
27
|
+
pattern: '^#[0-9A-Fa-f]{6}$',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['category_id'],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export async function handleUpdateKnowledgeCategory(api, args) {
|
|
34
|
+
try {
|
|
35
|
+
const updates = {};
|
|
36
|
+
if (args.name !== undefined)
|
|
37
|
+
updates.name = args.name;
|
|
38
|
+
if (args.description !== undefined)
|
|
39
|
+
updates.description = args.description;
|
|
40
|
+
if (args.color !== undefined)
|
|
41
|
+
updates.color = args.color;
|
|
42
|
+
if (Object.keys(updates).length === 0) {
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: 'No updates provided. Specify at least one of: name, description, or color.',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
isError: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const category = await api.updateKnowledgeCategory(args.category_id, updates);
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `Category "${category.name}" (ID: ${category.id}) updated successfully.\n\n` +
|
|
59
|
+
`**Name:** ${category.name}\n` +
|
|
60
|
+
`**Description:** ${category.description || 'None'}\n` +
|
|
61
|
+
`**Color:** ${category.color}`,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: 'text', text: `Error updating category: ${message}` }],
|
|
70
|
+
isError: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=update-knowledge-category.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-knowledge-category.js","sourceRoot":"","sources":["../../src/tools/update-knowledge-category.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,CAAC,MAAM,8BAA8B,GAAS;IAClD,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,yEAAyE;IACtF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gDAAgD;aAC9D;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sCAAsC;aACpD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,mBAAmB;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1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EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,4BAA4B,OAAO,EAAE,EAAE,CAAC;YACxE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload Document from URL Tool
|
|
3
|
+
*
|
|
4
|
+
* Downloads and uploads a document from a URL to the knowledge base.
|
|
5
|
+
* Can upload to personal or team knowledge base.
|
|
6
|
+
*/
|
|
7
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
9
|
+
export declare const uploadDocumentFromUrlToolDef: Tool;
|
|
10
|
+
export declare function handleUploadDocumentFromUrl(api: FlowDotApiClient, args: {
|
|
11
|
+
url: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
category_id?: number;
|
|
14
|
+
team_id?: number;
|
|
15
|
+
}): Promise<CallToolResult>;
|
|
16
|
+
//# sourceMappingURL=upload-document-from-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-document-from-url.d.ts","sourceRoot":"","sources":["../../src/tools/upload-document-from-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,4BAA4B,EAAE,IA0B1C,CAAC;AAEF,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E,OAAO,CAAC,cAAc,CAAC,CAyCzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload Document from URL Tool
|
|
3
|
+
*
|
|
4
|
+
* Downloads and uploads a document from a URL to the knowledge base.
|
|
5
|
+
* Can upload to personal or team knowledge base.
|
|
6
|
+
*/
|
|
7
|
+
export const uploadDocumentFromUrlToolDef = {
|
|
8
|
+
name: 'upload_document_from_url',
|
|
9
|
+
description: 'Download a document from a URL and add it to your knowledge base. Supports PDF, DOCX, TXT, Markdown, CSV, and JSON files (max 50MB). Can upload to personal or team knowledge base.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
url: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'URL of the document to download',
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'Optional: Title for the document (defaults to filename from URL)',
|
|
20
|
+
},
|
|
21
|
+
category_id: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'Optional: Category ID to organize the document. Must belong to the same scope (personal or team).',
|
|
24
|
+
},
|
|
25
|
+
team_id: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: 'Optional: Team ID to upload the document to. If omitted, uploads to personal knowledge base. Use list_user_teams to see available teams.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
required: ['url'],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export async function handleUploadDocumentFromUrl(api, args) {
|
|
34
|
+
try {
|
|
35
|
+
const result = await api.uploadDocumentFromUrl({
|
|
36
|
+
url: args.url,
|
|
37
|
+
title: args.title,
|
|
38
|
+
category_id: args.category_id,
|
|
39
|
+
team_id: args.team_id,
|
|
40
|
+
});
|
|
41
|
+
const lines = [
|
|
42
|
+
`## Document Downloaded Successfully`,
|
|
43
|
+
'',
|
|
44
|
+
`**Title:** ${result.title}`,
|
|
45
|
+
`**ID:** ${result.id}`,
|
|
46
|
+
`**Hash:** ${result.hash}`,
|
|
47
|
+
result.original_filename ? `**Filename:** ${result.original_filename}` : '',
|
|
48
|
+
result.file_size_bytes ? `**Size:** ${(result.file_size_bytes / 1024).toFixed(1)} KB` : '',
|
|
49
|
+
`**Status:** ${result.status}`,
|
|
50
|
+
].filter(Boolean);
|
|
51
|
+
if (args.team_id) {
|
|
52
|
+
lines.push(`**Location:** Team knowledge base (Team ID: ${args.team_id})`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
lines.push(`**Location:** Personal knowledge base`);
|
|
56
|
+
}
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push(result.message || 'Document downloaded and queued for processing.');
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push('The document will be processed in the background. Use list_knowledge_documents to check the status.');
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: lines.join('\n') }],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: 'text', text: `Error uploading document from URL: ${message}` }],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=upload-document-from-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-document-from-url.js","sourceRoot":"","sources":["../../src/tools/upload-document-from-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,4BAA4B,GAAS;IAChD,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,qLAAqL;IACvL,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kEAAkE;aAChF;YACD,WAAW,EAAE;gBACX,IAAI,EAA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AAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,gDAAgD,CAAC,CAAC;QAC/E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,qGAAqG,CAAC,CAAC;QAElH,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SACpD,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACzE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sCAAsC,OAAO,EAAE,EAAE,CAAC;YAClF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload Text Document Tool
|
|
3
|
+
*
|
|
4
|
+
* Uploads text content directly as a document to the knowledge base.
|
|
5
|
+
* Can upload to personal or team knowledge base.
|
|
6
|
+
*/
|
|
7
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
9
|
+
export declare const uploadTextDocumentToolDef: Tool;
|
|
10
|
+
export declare function handleUploadTextDocument(api: FlowDotApiClient, args: {
|
|
11
|
+
title: string;
|
|
12
|
+
content: string;
|
|
13
|
+
category_id?: number;
|
|
14
|
+
team_id?: number;
|
|
15
|
+
mime_type?: 'text/plain' | 'text/markdown' | 'application/json';
|
|
16
|
+
}): Promise<CallToolResult>;
|
|
17
|
+
//# sourceMappingURL=upload-text-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-text-document.d.ts","sourceRoot":"","sources":["../../src/tools/upload-text-document.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,yBAAyB,EAAE,IA+BvC,CAAC;AAEF,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,kBAAkB,CAAC;CACjE,GACA,OAAO,CAAC,cAAc,CAAC,CAwCzB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload Text Document Tool
|
|
3
|
+
*
|
|
4
|
+
* Uploads text content directly as a document to the knowledge base.
|
|
5
|
+
* Can upload to personal or team knowledge base.
|
|
6
|
+
*/
|
|
7
|
+
export const uploadTextDocumentToolDef = {
|
|
8
|
+
name: 'upload_text_document',
|
|
9
|
+
description: 'Upload text content directly as a document to your knowledge base. Ideal for creating documents from AI-generated content, notes, or any text. The document will be processed and chunked for RAG queries. Can upload to personal or team knowledge base.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
title: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Title for the document (max 255 characters)',
|
|
16
|
+
},
|
|
17
|
+
content: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The text content to upload (max 10MB)',
|
|
20
|
+
},
|
|
21
|
+
category_id: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'Optional: Category ID to organize the document. Must belong to the same scope (personal or team).',
|
|
24
|
+
},
|
|
25
|
+
team_id: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: 'Optional: Team ID to upload the document to. If omitted, uploads to personal knowledge base. Use list_user_teams to see available teams.',
|
|
28
|
+
},
|
|
29
|
+
mime_type: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
enum: ['text/plain', 'text/markdown', 'application/json'],
|
|
32
|
+
description: 'Content type: text/plain (default), text/markdown, or application/json',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['title', 'content'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export async function handleUploadTextDocument(api, args) {
|
|
39
|
+
try {
|
|
40
|
+
const result = await api.uploadTextDocument({
|
|
41
|
+
title: args.title,
|
|
42
|
+
content: args.content,
|
|
43
|
+
category_id: args.category_id,
|
|
44
|
+
team_id: args.team_id,
|
|
45
|
+
mime_type: args.mime_type,
|
|
46
|
+
});
|
|
47
|
+
const lines = [
|
|
48
|
+
`## Document Uploaded Successfully`,
|
|
49
|
+
'',
|
|
50
|
+
`**Title:** ${result.title}`,
|
|
51
|
+
`**ID:** ${result.id}`,
|
|
52
|
+
`**Hash:** ${result.hash}`,
|
|
53
|
+
`**Status:** ${result.status}`,
|
|
54
|
+
];
|
|
55
|
+
if (args.team_id) {
|
|
56
|
+
lines.push(`**Location:** Team knowledge base (Team ID: ${args.team_id})`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
lines.push(`**Location:** Personal knowledge base`);
|
|
60
|
+
}
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push(result.message || 'Document created and queued for processing.');
|
|
63
|
+
lines.push('');
|
|
64
|
+
lines.push('The document will be processed in the background. Use list_knowledge_documents to check the status.');
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: 'text', text: lines.join('\n') }],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: 'text', text: `Error uploading document: ${message}` }],
|
|
73
|
+
isError: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=upload-text-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-text-document.js","sourceRoot":"","sources":["../../src/tools/upload-text-document.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,yBAAyB,GAAS;IAC7C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,2PAA2P;IAC7P,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6CAA6C;aAC3D;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uCAAuC;aACrD;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mGAAmG;aACjH;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0IAA0I;aACxJ;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,kBAAkB,CAAC;gBACzD,WAAW,EAAE,wEAAwE;aACtF;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,GAAqB,EACrB,IAMC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC;YAC1C,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS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