@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.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -162
  3. package/bin/flowdot-mcp.js +15 -15
  4. package/dist/api-client.d.ts +214 -1
  5. package/dist/api-client.d.ts.map +1 -1
  6. package/dist/api-client.js +481 -1
  7. package/dist/api-client.js.map +1 -1
  8. package/dist/server.d.ts.map +1 -1
  9. package/dist/server.js +8 -9
  10. package/dist/server.js.map +1 -1
  11. package/dist/tools/agent-toolkits.d.ts +57 -0
  12. package/dist/tools/agent-toolkits.d.ts.map +1 -0
  13. package/dist/tools/agent-toolkits.js +1705 -0
  14. package/dist/tools/agent-toolkits.js.map +1 -0
  15. package/dist/tools/append-app-code.d.ts +12 -0
  16. package/dist/tools/append-app-code.d.ts.map +1 -0
  17. package/dist/tools/append-app-code.js +83 -0
  18. package/dist/tools/append-app-code.js.map +1 -0
  19. package/dist/tools/clone-app.js +20 -20
  20. package/dist/tools/convert-app-to-multifile.d.ts +11 -0
  21. package/dist/tools/convert-app-to-multifile.d.ts.map +1 -0
  22. package/dist/tools/convert-app-to-multifile.js +69 -0
  23. package/dist/tools/convert-app-to-multifile.js.map +1 -0
  24. package/dist/tools/create-app-file.d.ts +11 -0
  25. package/dist/tools/create-app-file.d.ts.map +1 -0
  26. package/dist/tools/create-app-file.js +83 -0
  27. package/dist/tools/create-app-file.js.map +1 -0
  28. package/dist/tools/create-app.d.ts.map +1 -1
  29. package/dist/tools/create-app.js +47 -29
  30. package/dist/tools/create-app.js.map +1 -1
  31. package/dist/tools/create-knowledge-category.d.ts +16 -0
  32. package/dist/tools/create-knowledge-category.d.ts.map +1 -0
  33. package/dist/tools/create-knowledge-category.js +71 -0
  34. package/dist/tools/create-knowledge-category.js.map +1 -0
  35. package/dist/tools/delete-app-file.d.ts +11 -0
  36. package/dist/tools/delete-app-file.d.ts.map +1 -0
  37. package/dist/tools/delete-app-file.js +52 -0
  38. package/dist/tools/delete-app-file.js.map +1 -0
  39. package/dist/tools/delete-app.js +3 -3
  40. package/dist/tools/delete-knowledge-category.d.ts +12 -0
  41. package/dist/tools/delete-knowledge-category.d.ts.map +1 -0
  42. package/dist/tools/delete-knowledge-category.js +40 -0
  43. package/dist/tools/delete-knowledge-category.js.map +1 -0
  44. package/dist/tools/delete-knowledge-document.d.ts +12 -0
  45. package/dist/tools/delete-knowledge-document.d.ts.map +1 -0
  46. package/dist/tools/delete-knowledge-document.js +40 -0
  47. package/dist/tools/delete-knowledge-document.js.map +1 -0
  48. package/dist/tools/edit-app-code.d.ts +12 -0
  49. package/dist/tools/edit-app-code.d.ts.map +1 -0
  50. package/dist/tools/edit-app-code.js +110 -0
  51. package/dist/tools/edit-app-code.js.map +1 -0
  52. package/dist/tools/get-app-file.d.ts +11 -0
  53. package/dist/tools/get-app-file.d.ts.map +1 -0
  54. package/dist/tools/get-app-file.js +76 -0
  55. package/dist/tools/get-app-file.js.map +1 -0
  56. package/dist/tools/get-app-template.d.ts.map +1 -1
  57. package/dist/tools/get-app-template.js +65 -21
  58. package/dist/tools/get-app-template.js.map +1 -1
  59. package/dist/tools/get-app.js +54 -54
  60. package/dist/tools/get-knowledge-document.d.ts +12 -0
  61. package/dist/tools/get-knowledge-document.d.ts.map +1 -0
  62. package/dist/tools/get-knowledge-document.js +71 -0
  63. package/dist/tools/get-knowledge-document.js.map +1 -0
  64. package/dist/tools/get-knowledge-storage.d.ts +10 -0
  65. package/dist/tools/get-knowledge-storage.d.ts.map +1 -0
  66. package/dist/tools/get-knowledge-storage.js +54 -0
  67. package/dist/tools/get-knowledge-storage.js.map +1 -0
  68. package/dist/tools/index.d.ts.map +1 -1
  69. package/dist/tools/index.js +214 -1
  70. package/dist/tools/index.js.map +1 -1
  71. package/dist/tools/insert-app-code.d.ts +12 -0
  72. package/dist/tools/insert-app-code.d.ts.map +1 -0
  73. package/dist/tools/insert-app-code.js +97 -0
  74. package/dist/tools/insert-app-code.js.map +1 -0
  75. package/dist/tools/link-app-workflow.js +21 -21
  76. package/dist/tools/list-app-files.d.ts +11 -0
  77. package/dist/tools/list-app-files.d.ts.map +1 -0
  78. package/dist/tools/list-app-files.js +84 -0
  79. package/dist/tools/list-app-files.js.map +1 -0
  80. package/dist/tools/list-apps.js +8 -8
  81. package/dist/tools/list-knowledge-categories.d.ts +14 -0
  82. package/dist/tools/list-knowledge-categories.d.ts.map +1 -0
  83. package/dist/tools/list-knowledge-categories.js +107 -0
  84. package/dist/tools/list-knowledge-categories.js.map +1 -0
  85. package/dist/tools/list-knowledge-documents.d.ts +15 -0
  86. package/dist/tools/list-knowledge-documents.d.ts.map +1 -0
  87. package/dist/tools/list-knowledge-documents.js +129 -0
  88. package/dist/tools/list-knowledge-documents.js.map +1 -0
  89. package/dist/tools/list-user-teams.d.ts +11 -0
  90. package/dist/tools/list-user-teams.d.ts.map +1 -0
  91. package/dist/tools/list-user-teams.js +56 -0
  92. package/dist/tools/list-user-teams.js.map +1 -0
  93. package/dist/tools/move-document-to-category.d.ts +13 -0
  94. package/dist/tools/move-document-to-category.d.ts.map +1 -0
  95. package/dist/tools/move-document-to-category.js +42 -0
  96. package/dist/tools/move-document-to-category.js.map +1 -0
  97. package/dist/tools/prepend-app-code.d.ts +12 -0
  98. package/dist/tools/prepend-app-code.d.ts.map +1 -0
  99. package/dist/tools/prepend-app-code.js +79 -0
  100. package/dist/tools/prepend-app-code.js.map +1 -0
  101. package/dist/tools/publish-app.js +7 -7
  102. package/dist/tools/query-knowledge-base.d.ts +18 -0
  103. package/dist/tools/query-knowledge-base.d.ts.map +1 -0
  104. package/dist/tools/query-knowledge-base.js +144 -0
  105. package/dist/tools/query-knowledge-base.js.map +1 -0
  106. package/dist/tools/rename-app-file.d.ts +11 -0
  107. package/dist/tools/rename-app-file.d.ts.map +1 -0
  108. package/dist/tools/rename-app-file.js +64 -0
  109. package/dist/tools/rename-app-file.js.map +1 -0
  110. package/dist/tools/reprocess-document.d.ts +12 -0
  111. package/dist/tools/reprocess-document.d.ts.map +1 -0
  112. package/dist/tools/reprocess-document.js +40 -0
  113. package/dist/tools/reprocess-document.js.map +1 -0
  114. package/dist/tools/search-apps.js +13 -13
  115. package/dist/tools/search.d.ts +14 -0
  116. package/dist/tools/search.d.ts.map +1 -0
  117. package/dist/tools/search.js +86 -0
  118. package/dist/tools/search.js.map +1 -0
  119. package/dist/tools/set-app-entry-file.d.ts +11 -0
  120. package/dist/tools/set-app-entry-file.d.ts.map +1 -0
  121. package/dist/tools/set-app-entry-file.js +56 -0
  122. package/dist/tools/set-app-entry-file.js.map +1 -0
  123. package/dist/tools/transfer-document-ownership.d.ts +15 -0
  124. package/dist/tools/transfer-document-ownership.d.ts.map +1 -0
  125. package/dist/tools/transfer-document-ownership.js +66 -0
  126. package/dist/tools/transfer-document-ownership.js.map +1 -0
  127. package/dist/tools/unlink-app-workflow.js +2 -2
  128. package/dist/tools/unpublish-app.js +2 -2
  129. package/dist/tools/update-app-file.d.ts +11 -0
  130. package/dist/tools/update-app-file.d.ts.map +1 -0
  131. package/dist/tools/update-app-file.js +73 -0
  132. package/dist/tools/update-app-file.js.map +1 -0
  133. package/dist/tools/update-app.d.ts.map +1 -1
  134. package/dist/tools/update-app.js +8 -1
  135. package/dist/tools/update-app.js.map +1 -1
  136. package/dist/tools/update-knowledge-category.d.ts +15 -0
  137. package/dist/tools/update-knowledge-category.d.ts.map +1 -0
  138. package/dist/tools/update-knowledge-category.js +74 -0
  139. package/dist/tools/update-knowledge-category.js.map +1 -0
  140. package/dist/tools/upload-document-from-url.d.ts +16 -0
  141. package/dist/tools/upload-document-from-url.d.ts.map +1 -0
  142. package/dist/tools/upload-document-from-url.js +73 -0
  143. package/dist/tools/upload-document-from-url.js.map +1 -0
  144. package/dist/tools/upload-text-document.d.ts +17 -0
  145. package/dist/tools/upload-text-document.d.ts.map +1 -0
  146. package/dist/tools/upload-text-document.js +77 -0
  147. package/dist/tools/upload-text-document.js.map +1 -0
  148. package/dist/types.d.ts +426 -0
  149. package/dist/types.d.ts.map +1 -1
  150. package/package.json +54 -54
@@ -6,8 +6,8 @@
6
6
  */
7
7
  export const listAppsTool = {
8
8
  name: 'list_apps',
9
- description: `List the user's own FlowDot apps. Apps are React frontend applications that can optionally use workflows as backends.
10
-
9
+ description: `List the user's own FlowDot apps. Apps are React frontend applications that can optionally use workflows as backends.
10
+
11
11
  Returns a paginated list of apps owned by the current user with metadata like name, description, category, tags, and usage stats.`,
12
12
  inputSchema: {
13
13
  type: 'object',
@@ -51,14 +51,14 @@ export async function handleListApps(client, args) {
51
51
  const appsInfo = result.data.map((app) => {
52
52
  const tags = app.tags?.length ? `[${app.tags.join(', ')}]` : '';
53
53
  const status = app.is_public ? 'Public' : 'Private';
54
- return `- **${app.name}** (${app.id})
55
- ${app.description || 'No description'}
56
- Category: ${app.category || 'Uncategorized'} | Status: ${status} | Mobile: ${app.mobile_compatible ? 'Yes' : 'No'}
57
- Executions: ${app.execution_count} | Upvotes: ${app.upvotes} | Clones: ${app.clone_count}
54
+ return `- **${app.name}** (${app.id})
55
+ ${app.description || 'No description'}
56
+ Category: ${app.category || 'Uncategorized'} | Status: ${status} | Mobile: ${app.mobile_compatible ? 'Yes' : 'No'}
57
+ Executions: ${app.execution_count} | Upvotes: ${app.upvotes} | Clones: ${app.clone_count}
58
58
  ${tags ? `Tags: ${tags}` : ''}`;
59
59
  });
60
- const text = `Found ${result.total} app(s) (page ${result.current_page}/${result.last_page}):
61
-
60
+ const text = `Found ${result.total} app(s) (page ${result.current_page}/${result.last_page}):
61
+
62
62
  ${appsInfo.join('\n\n')}`;
63
63
  return {
64
64
  content: [{ type: 'text', text }],
@@ -0,0 +1,14 @@
1
+ /**
2
+ * List Knowledge Categories Tool
3
+ *
4
+ * Lists all document categories in the user's knowledge base.
5
+ * Supports filtering by team or personal categories only.
6
+ */
7
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
+ import { FlowDotApiClient } from '../api-client.js';
9
+ export declare const listKnowledgeCategoriesToolDef: Tool;
10
+ export declare function handleListKnowledgeCategories(api: FlowDotApiClient, args?: {
11
+ team_id?: number;
12
+ personal?: boolean;
13
+ }): Promise<CallToolResult>;
14
+ //# sourceMappingURL=list-knowledge-categories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-knowledge-categories.d.ts","sourceRoot":"","sources":["../../src/tools/list-knowledge-categories.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,8BAA8B,EAAE,IAkB5C,CAAC;AAEF,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,gBAAgB,EACrB,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9C,OAAO,CAAC,cAAc,CAAC,CAwFzB"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * List Knowledge Categories Tool
3
+ *
4
+ * Lists all document categories in the user's knowledge base.
5
+ * Supports filtering by team or personal categories only.
6
+ */
7
+ export const listKnowledgeCategoriesToolDef = {
8
+ name: 'list_knowledge_categories',
9
+ description: 'List all document categories in your knowledge base. Categories help organize documents for easier retrieval and targeted RAG queries. By default, shows both personal and team categories.',
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ team_id: {
14
+ type: 'number',
15
+ description: 'Optional: Filter to categories from a specific team only. Use list_user_teams to see available teams.',
16
+ },
17
+ personal: {
18
+ type: 'boolean',
19
+ description: 'Optional: Set to true to show only personal categories (excludes team categories).',
20
+ },
21
+ },
22
+ required: [],
23
+ },
24
+ };
25
+ export async function handleListKnowledgeCategories(api, args) {
26
+ try {
27
+ const categories = await api.listKnowledgeCategories({
28
+ team_id: args?.team_id,
29
+ personal: args?.personal,
30
+ });
31
+ if (categories.length === 0) {
32
+ let message = 'No knowledge base categories found.';
33
+ if (args?.team_id) {
34
+ message = `No categories found for team ID ${args.team_id}.`;
35
+ }
36
+ else if (args?.personal) {
37
+ message = 'No personal categories found.';
38
+ }
39
+ message += ' Use create_knowledge_category to create your first category.';
40
+ return {
41
+ content: [{ type: 'text', text: message }],
42
+ };
43
+ }
44
+ // Separate personal and team categories for display
45
+ const personalCategories = categories.filter(c => !c.team_id);
46
+ const teamCategories = categories.filter(c => c.team_id);
47
+ const lines = [
48
+ `## Knowledge Base Categories (${categories.length} total)`,
49
+ '',
50
+ ];
51
+ // Show personal categories
52
+ if (personalCategories.length > 0 && !args?.team_id) {
53
+ lines.push('### Personal Categories');
54
+ lines.push('');
55
+ for (const category of personalCategories) {
56
+ lines.push(`#### ${category.name}`);
57
+ lines.push(`- **ID:** ${category.id}`);
58
+ lines.push(`- **Slug:** ${category.slug}`);
59
+ if (category.description) {
60
+ lines.push(`- **Description:** ${category.description}`);
61
+ }
62
+ lines.push(`- **Color:** ${category.color}`);
63
+ lines.push(`- **Documents:** ${category.document_count}`);
64
+ lines.push('');
65
+ }
66
+ }
67
+ // Show team categories
68
+ if (teamCategories.length > 0 && !args?.personal) {
69
+ // Group by team
70
+ const byTeam = new Map();
71
+ for (const cat of teamCategories) {
72
+ const teamId = cat.team_id;
73
+ if (!byTeam.has(teamId)) {
74
+ byTeam.set(teamId, []);
75
+ }
76
+ byTeam.get(teamId).push(cat);
77
+ }
78
+ for (const [teamId, cats] of byTeam) {
79
+ const teamName = cats[0].team_name || `Team ${teamId}`;
80
+ lines.push(`### Team: ${teamName} (ID: ${teamId})`);
81
+ lines.push('');
82
+ for (const category of cats) {
83
+ lines.push(`#### ${category.name}`);
84
+ lines.push(`- **ID:** ${category.id}`);
85
+ lines.push(`- **Slug:** ${category.slug}`);
86
+ if (category.description) {
87
+ lines.push(`- **Description:** ${category.description}`);
88
+ }
89
+ lines.push(`- **Color:** ${category.color}`);
90
+ lines.push(`- **Documents:** ${category.document_count}`);
91
+ lines.push('');
92
+ }
93
+ }
94
+ }
95
+ return {
96
+ content: [{ type: 'text', text: lines.join('\n') }],
97
+ };
98
+ }
99
+ catch (error) {
100
+ const message = error instanceof Error ? error.message : 'Unknown error';
101
+ return {
102
+ content: [{ type: 'text', text: `Error listing categories: ${message}` }],
103
+ isError: true,
104
+ };
105
+ }
106
+ }
107
+ //# sourceMappingURL=list-knowledge-categories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-knowledge-categories.js","sourceRoot":"","sources":["../../src/tools/list-knowledge-categories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,8BAA8B,GAAS;IAClD,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,6LAA6L;IAC/L,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uGAAuG;aACrH;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,oFAAoF;aAClG;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,GAAqB,EACrB,IAA+C;IAE/C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,uBAAuB,CAAC;YACnD,OAAO,EAAE,IAAI,EAAE,OAAO;YACtB,QAAQ,EAAE,IAAI,EAAE,QAAQ;SACzB,CAAC,CAAC;QAEH,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,OAAO,GAAG,qCAAqC,CAAC;YACpD,IAAI,IAAI,EAAE,OAAO,EAAE,CAAC;gBAClB,OAAO,GAAG,mCAAmC,IAAI,CAAC,OAAO,GAAG,CAAC;YAC/D,CAAC;iBAAM,IAAI,IAAI,EAAE,QAA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AAW,EAAE,CAAC;wBACzB,KAAK,CAAC,IAAI,CAAC,sBAAsB,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;oBAC3D,CAAC;oBACD,KAAK,CAAC,IAAI,CAAC,gBAAgB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;oBAC7C,KAAK,CAAC,IAAI,CAAC,oBAAoB,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;oBAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC;QAED,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,6BAA6B,OAAO,EAAE,EAAE,CAAC;YACzE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * List Knowledge Documents Tool
3
+ *
4
+ * Lists documents in the user's knowledge base with optional filtering.
5
+ * Includes both personal and team documents.
6
+ */
7
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
+ import { FlowDotApiClient } from '../api-client.js';
9
+ export declare const listKnowledgeDocumentsToolDef: Tool;
10
+ export declare function handleListKnowledgeDocuments(api: FlowDotApiClient, args: {
11
+ category_id?: number;
12
+ team_id?: number | 'personal';
13
+ status?: 'pending' | 'processing' | 'ready' | 'failed';
14
+ }): Promise<CallToolResult>;
15
+ //# sourceMappingURL=list-knowledge-documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-knowledge-documents.d.ts","sourceRoot":"","sources":["../../src/tools/list-knowledge-documents.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,6BAA6B,EAAE,IAuB3C,CAAC;AAEF,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IACJ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;CACxD,GACA,OAAO,CAAC,cAAc,CAAC,CAyGzB"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * List Knowledge Documents Tool
3
+ *
4
+ * Lists documents in the user's knowledge base with optional filtering.
5
+ * Includes both personal and team documents.
6
+ */
7
+ export const listKnowledgeDocumentsToolDef = {
8
+ name: 'list_knowledge_documents',
9
+ description: 'List documents in your knowledge base. Optionally filter by category, team, or status. Shows document title, status, size, and chunk count. By default shows all accessible documents (personal and team).',
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ category_id: {
14
+ type: 'number',
15
+ description: 'Filter documents by category ID (optional)',
16
+ },
17
+ team_id: {
18
+ type: ['number', 'string'],
19
+ description: 'Filter documents by team. Use a team ID (number) to show only that team\'s documents, or "personal" to show only personal documents. Use list_user_teams to see available teams.',
20
+ },
21
+ status: {
22
+ type: 'string',
23
+ enum: ['pending', 'processing', 'ready', 'failed'],
24
+ description: 'Filter documents by processing status (optional)',
25
+ },
26
+ },
27
+ required: [],
28
+ },
29
+ };
30
+ export async function handleListKnowledgeDocuments(api, args) {
31
+ try {
32
+ const documents = await api.listKnowledgeDocuments({
33
+ category_id: args.category_id,
34
+ team_id: args.team_id,
35
+ status: args.status,
36
+ });
37
+ if (documents.length === 0) {
38
+ let message = 'No documents found in your knowledge base.';
39
+ if (args.category_id || args.status || args.team_id) {
40
+ message += ' Try adjusting your filters.';
41
+ }
42
+ else {
43
+ message += ' Use upload_text_document or upload_document_from_url to add documents.';
44
+ }
45
+ return {
46
+ content: [{ type: 'text', text: message }],
47
+ };
48
+ }
49
+ const statusIcon = (status) => {
50
+ switch (status) {
51
+ case 'ready':
52
+ return '✓';
53
+ case 'processing':
54
+ return '⏳';
55
+ case 'pending':
56
+ return '○';
57
+ case 'failed':
58
+ return '✗';
59
+ default:
60
+ return '?';
61
+ }
62
+ };
63
+ // Group documents by personal vs team
64
+ const personalDocs = documents.filter(d => !d.is_team_document);
65
+ const teamDocs = documents.filter(d => d.is_team_document);
66
+ const lines = [
67
+ `## Knowledge Base Documents (${documents.length} total)`,
68
+ '',
69
+ ];
70
+ const formatDoc = (doc) => {
71
+ const docLines = [];
72
+ docLines.push(`### ${statusIcon(doc.status)} ${doc.title}`);
73
+ docLines.push(`- **ID:** ${doc.id} | **Hash:** ${doc.hash}`);
74
+ docLines.push(`- **Status:** ${doc.status}${doc.processing_error ? ` (Error: ${doc.processing_error})` : ''}`);
75
+ docLines.push(`- **Size:** ${doc.formatted_size} | **Chunks:** ${doc.chunk_count} | **Tokens:** ${doc.token_count}`);
76
+ docLines.push(`- **Type:** ${doc.mime_type}`);
77
+ if (doc.category) {
78
+ docLines.push(`- **Category:** ${doc.category.name}`);
79
+ }
80
+ if (doc.has_embeddings) {
81
+ docLines.push(`- **Embeddings:** Available`);
82
+ }
83
+ if (!doc.can_edit) {
84
+ docLines.push(`- **Access:** Read-only`);
85
+ }
86
+ docLines.push(`- **Created:** ${doc.created_at}`);
87
+ docLines.push('');
88
+ return docLines;
89
+ };
90
+ // Show personal documents if no team filter or explicitly 'personal'
91
+ if (personalDocs.length > 0 && (args.team_id === undefined || args.team_id === 'personal')) {
92
+ lines.push('### Personal Documents');
93
+ lines.push('');
94
+ for (const doc of personalDocs) {
95
+ lines.push(...formatDoc(doc));
96
+ }
97
+ }
98
+ // Show team documents grouped by team
99
+ if (teamDocs.length > 0 && args.team_id !== 'personal') {
100
+ const byTeam = new Map();
101
+ for (const doc of teamDocs) {
102
+ const teamId = doc.team_id;
103
+ if (!byTeam.has(teamId)) {
104
+ byTeam.set(teamId, []);
105
+ }
106
+ byTeam.get(teamId).push(doc);
107
+ }
108
+ for (const [teamId, docs] of byTeam) {
109
+ const teamName = docs[0].team?.name || `Team ${teamId}`;
110
+ lines.push(`### Team: ${teamName} (ID: ${teamId})`);
111
+ lines.push('');
112
+ for (const doc of docs) {
113
+ lines.push(...formatDoc(doc));
114
+ }
115
+ }
116
+ }
117
+ return {
118
+ content: [{ type: 'text', text: lines.join('\n') }],
119
+ };
120
+ }
121
+ catch (error) {
122
+ const message = error instanceof Error ? error.message : 'Unknown error';
123
+ return {
124
+ content: [{ type: 'text', text: `Error listing documents: ${message}` }],
125
+ isError: true,
126
+ };
127
+ }
128
+ }
129
+ //# sourceMappingURL=list-knowledge-documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-knowledge-documents.js","sourceRoot":"","sources":["../../src/tools/list-knowledge-documents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,6BAA6B,GAAS;IACjD,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,4MAA4M;IAC9M,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4CAA4C;aAC1D;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAC1B,WAAW,EAAE,kLAAkL;aAChM;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC;gB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AQ,SAAS,MAAM,GAAG,CAAC,CAAC;gBACpD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;oBACvB,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QAED,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,4BAA4B,OAAO,EAAE,EAAE,CAAC;YACxE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * List User Teams Tool
3
+ *
4
+ * Lists all teams the user belongs to, including owned teams and member teams.
5
+ * Use this to discover available teams before filtering knowledge base operations.
6
+ */
7
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
+ import { FlowDotApiClient } from '../api-client.js';
9
+ export declare const listUserTeamsToolDef: Tool;
10
+ export declare function handleListUserTeams(api: FlowDotApiClient): Promise<CallToolResult>;
11
+ //# sourceMappingURL=list-user-teams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-user-teams.d.ts","sourceRoot":"","sources":["../../src/tools/list-user-teams.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,oBAAoB,EAAE,IASlC,CAAC;AAEF,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,cAAc,CAAC,CA2CzB"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * List User Teams Tool
3
+ *
4
+ * Lists all teams the user belongs to, including owned teams and member teams.
5
+ * Use this to discover available teams before filtering knowledge base operations.
6
+ */
7
+ export const listUserTeamsToolDef = {
8
+ name: 'list_user_teams',
9
+ description: 'List all teams you belong to. Use this to discover available teams before filtering knowledge base operations by team. Returns team ID, name, your role, and member count.',
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {},
13
+ required: [],
14
+ },
15
+ };
16
+ export async function handleListUserTeams(api) {
17
+ try {
18
+ const teams = await api.listUserTeams();
19
+ if (teams.length === 0) {
20
+ return {
21
+ content: [
22
+ {
23
+ type: 'text',
24
+ text: 'You are not a member of any teams. Your knowledge base contains only personal documents.',
25
+ },
26
+ ],
27
+ };
28
+ }
29
+ const lines = [`## Your Teams (${teams.length})`, ''];
30
+ for (const team of teams) {
31
+ lines.push(`### ${team.name}`);
32
+ lines.push(`- **ID:** ${team.id}`);
33
+ lines.push(`- **Slug:** ${team.slug}`);
34
+ if (team.description) {
35
+ lines.push(`- **Description:** ${team.description}`);
36
+ }
37
+ lines.push(`- **Your Role:** ${team.role}`);
38
+ lines.push(`- **Members:** ${team.member_count}`);
39
+ lines.push(`- **Created:** ${team.created_at}`);
40
+ lines.push('');
41
+ }
42
+ lines.push('---');
43
+ lines.push('Use the team ID to filter knowledge base operations by team.');
44
+ return {
45
+ content: [{ type: 'text', text: lines.join('\n') }],
46
+ };
47
+ }
48
+ catch (error) {
49
+ const message = error instanceof Error ? error.message : 'Unknown error';
50
+ return {
51
+ content: [{ type: 'text', text: `Error listing teams: ${message}` }],
52
+ isError: true,
53
+ };
54
+ }
55
+ }
56
+ //# sourceMappingURL=list-user-teams.js.map
@@ -0,0 +1 @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YAClD,KAAK,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;YAChD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QAE3E,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,wBAAwB,OAAO,EAAE,EAAE,CAAC;YACpE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Move Document to Category Tool
3
+ *
4
+ * Moves a document to a different category.
5
+ */
6
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
7
+ import { FlowDotApiClient } from '../api-client.js';
8
+ export declare const moveDocumentToCategoryToolDef: Tool;
9
+ export declare function handleMoveDocumentToCategory(api: FlowDotApiClient, args: {
10
+ document_id: number;
11
+ category_id?: number | null;
12
+ }): Promise<CallToolResult>;
13
+ //# sourceMappingURL=move-document-to-category.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-document-to-category.d.ts","sourceRoot":"","sources":["../../src/tools/move-document-to-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,6BAA6B,EAAE,IAiB3C,CAAC;AAEF,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACzD,OAAO,CAAC,cAAc,CAAC,CAkBzB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Move Document to Category Tool
3
+ *
4
+ * Moves a document to a different category.
5
+ */
6
+ export const moveDocumentToCategoryToolDef = {
7
+ name: 'move_document_to_category',
8
+ description: 'Move a document to a different category, or remove it from its current category (make it uncategorized).',
9
+ inputSchema: {
10
+ type: 'object',
11
+ properties: {
12
+ document_id: {
13
+ type: 'number',
14
+ description: 'The ID of the document to move',
15
+ },
16
+ category_id: {
17
+ type: ['number', 'null'],
18
+ description: 'The ID of the target category, or null to make the document uncategorized',
19
+ },
20
+ },
21
+ required: ['document_id'],
22
+ },
23
+ };
24
+ export async function handleMoveDocumentToCategory(api, args) {
25
+ try {
26
+ await api.moveDocumentToCategory(args.document_id, args.category_id ?? null);
27
+ const message = args.category_id
28
+ ? `Document ${args.document_id} moved to category ${args.category_id}.`
29
+ : `Document ${args.document_id} is now uncategorized.`;
30
+ return {
31
+ content: [{ type: 'text', text: message }],
32
+ };
33
+ }
34
+ catch (error) {
35
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
36
+ return {
37
+ content: [{ type: 'text', text: `Error moving document: ${errorMessage}` }],
38
+ isError: true,
39
+ };
40
+ }
41
+ }
42
+ //# sourceMappingURL=move-document-to-category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-document-to-category.js","sourceRoot":"","sources":["../../src/tools/move-document-to-category.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,CAAC,MAAM,6BAA6B,GAAS;IACjD,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,0GAA0G;IACvH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAC9C;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACxB,WAAW,EAAE,2EAA2E;aACzF;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,GAAqB,EACrB,IAA0D;IAE1D,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW;YAC9B,CAAC,CAAC,YAAY,IAAI,CAAC,WAAW,sBAAsB,IAAI,CAAC,WAAW,GAAG;YACvE,CAAC,CAAC,YAAY,IAAI,CAAC,WAAW,wBAAwB,CAAC;QAEzD,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAC9E,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,YAAY,EAAE,EAAE,CAAC;YAC3E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * prepend_app_code Tool
3
+ *
4
+ * Prepends content to the beginning of app code.
5
+ * Use this to add constants, configuration, or setup code at the start.
6
+ * Required scope: apps:manage
7
+ */
8
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
9
+ import { FlowDotApiClient } from '../api-client.js';
10
+ export declare const prependAppCodeTool: Tool;
11
+ export declare function handlePrependAppCode(client: FlowDotApiClient, args: Record<string, unknown>): Promise<CallToolResult>;
12
+ //# sourceMappingURL=prepend-app-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepend-app-code.d.ts","sourceRoot":"","sources":["../../src/tools/prepend-app-code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,eAAO,MAAM,kBAAkB,EAAE,IAuChC,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAgCzB"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * prepend_app_code Tool
3
+ *
4
+ * Prepends content to the beginning of app code.
5
+ * Use this to add constants, configuration, or setup code at the start.
6
+ * Required scope: apps:manage
7
+ */
8
+ export const prependAppCodeTool = {
9
+ name: 'prepend_app_code',
10
+ description: `Prepends content to the beginning of app code.
11
+
12
+ CRITICAL: Remember export rules:
13
+ - NO IMPORTS - React is global
14
+ - App entry file MUST end with: export default MyAppName;
15
+
16
+ Use this tool when you need to:
17
+ - Add constants or configuration at the start of the code
18
+ - Add comments or documentation at the beginning
19
+ - Insert setup code before the main component
20
+
21
+ NOTE: Since FlowDot apps don't use imports, this is less commonly needed.
22
+ For most cases, use edit_app_code or insert_app_code instead.
23
+
24
+ Example usage:
25
+ - content: "// App Configuration\\nconst API_URL = 'https://api.example.com';\\n\\n"
26
+
27
+ Max code size: 102KB`,
28
+ inputSchema: {
29
+ type: 'object',
30
+ properties: {
31
+ app_id: {
32
+ type: 'string',
33
+ description: 'The app ID (hash)',
34
+ },
35
+ content: {
36
+ type: 'string',
37
+ description: 'The content to prepend to the beginning of the code',
38
+ },
39
+ field: {
40
+ type: 'string',
41
+ enum: ['code', 'mobile_code'],
42
+ description: 'Which code field to prepend to (default: "code")',
43
+ },
44
+ },
45
+ required: ['app_id', 'content'],
46
+ },
47
+ };
48
+ export async function handlePrependAppCode(client, args) {
49
+ try {
50
+ const appId = String(args.app_id);
51
+ const content = String(args.content);
52
+ const field = args.field || 'code';
53
+ const result = await client.prependAppCode(appId, {
54
+ content,
55
+ field,
56
+ });
57
+ const sizeDiff = result.new_length - result.previous_length;
58
+ return {
59
+ content: [{
60
+ type: 'text',
61
+ text: `Content prepended to app code successfully!
62
+
63
+ App ID: ${result.id}
64
+ Field: ${result.field}
65
+ Previous size: ${result.previous_length} bytes
66
+ New size: ${result.new_length} bytes (+${sizeDiff} bytes)
67
+ Updated at: ${result.updated_at}`,
68
+ }],
69
+ };
70
+ }
71
+ catch (error) {
72
+ const message = error instanceof Error ? error.message : 'Unknown error';
73
+ return {
74
+ content: [{ type: 'text', text: `Error prepending to app code: ${message}` }],
75
+ isError: true,
76
+ };
77
+ }
78
+ }
79
+ //# sourceMappingURL=prepend-app-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepend-app-code.js","sourceRoot":"","sources":["../../src/tools/prepend-app-code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE;;;;;;;;;;;;;;;;;qBAiBM;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mBAAmB;aACjC;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qDAAqD;aACnE;YACD,KAAK,EAAE;gBACL,IAAI,E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Tool = {
8
8
  name: 'publish_app',
9
- description: `Publish an app to make it publicly visible in the FlowDot app marketplace.
10
-
11
- Once published:
12
- - Other users can discover and view your app
13
- - Other users can clone your app
14
- - Your app can receive votes and comments
15
-
9
+ description: `Publish an app to make it publicly visible in the FlowDot app marketplace.
10
+
11
+ Once published:
12
+ - Other users can discover and view your app
13
+ - Other users can clone your app
14
+ - Your app can receive votes and comments
15
+
16
16
  You can unpublish at any time using unpublish_app.`,
17
17
  inputSchema: {
18
18
  type: 'object',
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Query Knowledge Base Tool
3
+ *
4
+ * Performs RAG queries against the knowledge base to retrieve relevant document chunks.
5
+ * Supports filtering by team and controlling which document sources to include.
6
+ */
7
+ import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
8
+ import { FlowDotApiClient } from '../api-client.js';
9
+ export declare const queryKnowledgeBaseToolDef: Tool;
10
+ export declare function handleQueryKnowledgeBase(api: FlowDotApiClient, args: {
11
+ query: string;
12
+ category_id?: number;
13
+ team_id?: number;
14
+ include_personal?: boolean;
15
+ include_team?: boolean;
16
+ top_k?: number;
17
+ }): Promise<CallToolResult>;
18
+ //# sourceMappingURL=query-knowledge-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-knowledge-base.d.ts","sourceRoot":"","sources":["../../src/tools/query-knowledge-base.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,IAoCvC,CAAC;AAEF,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC,cAAc,CAAC,CA+GzB"}