@flowdot.ai/mcp-server 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -162
- package/bin/flowdot-mcp.js +15 -15
- package/dist/api-client.d.ts +2 -344
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +2 -784
- package/dist/api-client.js.map +1 -1
- package/dist/resources/index.d.ts +12 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +2204 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +19 -10
- package/dist/server.js.map +1 -1
- package/dist/tools/add-recipe-step.d.ts +23 -0
- package/dist/tools/add-recipe-step.d.ts.map +1 -0
- package/dist/tools/add-recipe-step.js +196 -0
- package/dist/tools/add-recipe-step.js.map +1 -0
- package/dist/tools/add-recipe-store.d.ts +19 -0
- package/dist/tools/add-recipe-store.d.ts.map +1 -0
- package/dist/tools/add-recipe-store.js +116 -0
- package/dist/tools/add-recipe-store.js.map +1 -0
- 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 +1712 -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/browse-recipes.d.ts +16 -0
- package/dist/tools/browse-recipes.d.ts.map +1 -0
- package/dist/tools/browse-recipes.js +102 -0
- package/dist/tools/browse-recipes.js.map +1 -0
- package/dist/tools/clone-app.js +20 -20
- 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/create-recipe.d.ts +16 -0
- package/dist/tools/create-recipe.d.ts.map +1 -0
- package/dist/tools/create-recipe.js +92 -0
- package/dist/tools/create-recipe.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/delete-recipe-step.d.ts +14 -0
- package/dist/tools/delete-recipe-step.d.ts.map +1 -0
- package/dist/tools/delete-recipe-step.js +65 -0
- package/dist/tools/delete-recipe-step.js.map +1 -0
- package/dist/tools/delete-recipe-store.d.ts +14 -0
- package/dist/tools/delete-recipe-store.d.ts.map +1 -0
- package/dist/tools/delete-recipe-store.js +65 -0
- package/dist/tools/delete-recipe-store.js.map +1 -0
- package/dist/tools/delete-recipe.d.ts +13 -0
- package/dist/tools/delete-recipe.d.ts.map +1 -0
- package/dist/tools/delete-recipe.js +59 -0
- package/dist/tools/delete-recipe.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/favorite-recipe.d.ts +13 -0
- package/dist/tools/favorite-recipe.d.ts.map +1 -0
- package/dist/tools/favorite-recipe.js +53 -0
- package/dist/tools/favorite-recipe.js.map +1 -0
- package/dist/tools/fork-recipe.d.ts +13 -0
- package/dist/tools/fork-recipe.d.ts.map +1 -0
- package/dist/tools/fork-recipe.js +56 -0
- package/dist/tools/fork-recipe.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/get-recipe-definition.d.ts +15 -0
- package/dist/tools/get-recipe-definition.d.ts.map +1 -0
- package/dist/tools/get-recipe-definition.js +70 -0
- package/dist/tools/get-recipe-definition.js.map +1 -0
- package/dist/tools/get-recipe.d.ts +12 -0
- package/dist/tools/get-recipe.d.ts.map +1 -0
- package/dist/tools/get-recipe.js +88 -0
- package/dist/tools/get-recipe.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +301 -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/link-recipe.d.ts +14 -0
- package/dist/tools/link-recipe.d.ts.map +1 -0
- package/dist/tools/link-recipe.js +76 -0
- package/dist/tools/link-recipe.js.map +1 -0
- 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-recipe-steps.d.ts +12 -0
- package/dist/tools/list-recipe-steps.d.ts.map +1 -0
- package/dist/tools/list-recipe-steps.js +69 -0
- package/dist/tools/list-recipe-steps.js.map +1 -0
- package/dist/tools/list-recipe-stores.d.ts +12 -0
- package/dist/tools/list-recipe-stores.d.ts.map +1 -0
- package/dist/tools/list-recipe-stores.js +87 -0
- package/dist/tools/list-recipe-stores.js.map +1 -0
- package/dist/tools/list-recipes.d.ts +12 -0
- package/dist/tools/list-recipes.d.ts.map +1 -0
- package/dist/tools/list-recipes.js +92 -0
- package/dist/tools/list-recipes.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/update-recipe-step.d.ts +22 -0
- package/dist/tools/update-recipe-step.d.ts.map +1 -0
- package/dist/tools/update-recipe-step.js +97 -0
- package/dist/tools/update-recipe-step.js.map +1 -0
- package/dist/tools/update-recipe-store.d.ts +20 -0
- package/dist/tools/update-recipe-store.d.ts.map +1 -0
- package/dist/tools/update-recipe-store.js +98 -0
- package/dist/tools/update-recipe-store.js.map +1 -0
- package/dist/tools/update-recipe.d.ts +18 -0
- package/dist/tools/update-recipe.d.ts.map +1 -0
- package/dist/tools/update-recipe.js +98 -0
- package/dist/tools/update-recipe.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/tools/vote-recipe.d.ts +13 -0
- package/dist/tools/vote-recipe.d.ts.map +1 -0
- package/dist/tools/vote-recipe.js +54 -0
- package/dist/tools/vote-recipe.js.map +1 -0
- package/dist/types.d.ts +3 -666
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/script-validator.d.ts.map +1 -1
- package/dist/utils/script-validator.js +5 -1
- package/dist/utils/script-validator.js.map +1 -1
- package/package.json +62 -54
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* insert_app_code Tool
|
|
3
|
+
*
|
|
4
|
+
* Inserts content after a specific pattern in app code.
|
|
5
|
+
* Use this to add code at specific locations without replacing existing code.
|
|
6
|
+
* Required scope: apps:manage
|
|
7
|
+
*/
|
|
8
|
+
export const insertAppCodeTool = {
|
|
9
|
+
name: 'insert_app_code',
|
|
10
|
+
description: `Inserts content after a specific pattern in app code.
|
|
11
|
+
|
|
12
|
+
CRITICAL: Remember export rules:
|
|
13
|
+
- App entry file MUST end with: export default MyAppName;
|
|
14
|
+
- To add helper functions, insert BEFORE the export statement
|
|
15
|
+
- Use after_pattern to find the closing brace of your main component
|
|
16
|
+
|
|
17
|
+
Use this tool when you need to:
|
|
18
|
+
- Add new state declarations after existing ones
|
|
19
|
+
- Insert event handlers inside a component
|
|
20
|
+
- Add JSX elements at specific locations
|
|
21
|
+
- Insert code without replacing what's already there
|
|
22
|
+
|
|
23
|
+
IMPORTANT:
|
|
24
|
+
- after_pattern must exist EXACTLY in the code (including whitespace)
|
|
25
|
+
- Content is inserted immediately after the pattern (first occurrence)
|
|
26
|
+
- For multiple insertions at different locations, call this tool multiple times
|
|
27
|
+
|
|
28
|
+
WORKFLOW FOR BUILDING LARGE APPS:
|
|
29
|
+
1. Create app with skeleton: create_app + update_app with basic structure including export
|
|
30
|
+
2. Use insert_app_code to add state: after_pattern: "function MyApp() {"
|
|
31
|
+
content: "\\n const [data, setData] = React.useState(null);"
|
|
32
|
+
3. To add helper functions: after_pattern: "}\\n\\n" (before export)
|
|
33
|
+
content: "function helperFunc() { ... }\\n\\n"
|
|
34
|
+
|
|
35
|
+
Example:
|
|
36
|
+
- after_pattern: "const [loading, setLoading] = React.useState(false);"
|
|
37
|
+
- content: "\\n const [error, setError] = React.useState(null);"
|
|
38
|
+
|
|
39
|
+
Max code size: 102KB`,
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
app_id: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'The app ID (hash)',
|
|
46
|
+
},
|
|
47
|
+
after_pattern: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'The pattern to find (content will be inserted after this)',
|
|
50
|
+
},
|
|
51
|
+
content: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'The content to insert after the pattern',
|
|
54
|
+
},
|
|
55
|
+
field: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
enum: ['code', 'mobile_code'],
|
|
58
|
+
description: 'Which code field to insert into (default: "code")',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['app_id', 'after_pattern', 'content'],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export async function handleInsertAppCode(client, args) {
|
|
65
|
+
try {
|
|
66
|
+
const appId = String(args.app_id);
|
|
67
|
+
const afterPattern = String(args.after_pattern);
|
|
68
|
+
const content = String(args.content);
|
|
69
|
+
const field = args.field || 'code';
|
|
70
|
+
const result = await client.insertAppCode(appId, {
|
|
71
|
+
after_pattern: afterPattern,
|
|
72
|
+
content,
|
|
73
|
+
field,
|
|
74
|
+
});
|
|
75
|
+
const sizeDiff = result.new_length - result.previous_length;
|
|
76
|
+
return {
|
|
77
|
+
content: [{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Content inserted into app code successfully!
|
|
80
|
+
|
|
81
|
+
App ID: ${result.id}
|
|
82
|
+
Field: ${result.field}
|
|
83
|
+
Previous size: ${result.previous_length} bytes
|
|
84
|
+
New size: ${result.new_length} bytes (+${sizeDiff} bytes)
|
|
85
|
+
Updated at: ${result.updated_at}`,
|
|
86
|
+
}],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: 'text', text: `Error inserting into app code: ${message}` }],
|
|
93
|
+
isError: true,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=insert-app-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-app-code.js","sourceRoot":"","sources":["../../src/tools/insert-app-code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;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,MAAM,CAAC,UAAU,YAAY,QAAQ;cACnC,MAAM,CAAC,UAAU,EAAE;iBAC1B,CAAC;SACH,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,kCAAkC,OAAO,EAAE,EAAE,CAAC;YAC9E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export const linkAppWorkflowTool = {
|
|
8
8
|
name: 'link_app_workflow',
|
|
9
|
-
description: `Link a workflow to an app. Once linked, the app can invoke the workflow using invokeWorkflow().
|
|
10
|
-
|
|
11
|
-
The workflow must be owned by you. After linking, use the workflow hash in your app code:
|
|
12
|
-
|
|
13
|
-
\`\`\`javascript
|
|
14
|
-
const result = await invokeWorkflow('WORKFLOW_HASH', { input: 'value' });
|
|
15
|
-
\`\`\`
|
|
16
|
-
|
|
9
|
+
description: `Link a workflow to an app. Once linked, the app can invoke the workflow using invokeWorkflow().
|
|
10
|
+
|
|
11
|
+
The workflow must be owned by you. After linking, use the workflow hash in your app code:
|
|
12
|
+
|
|
13
|
+
\`\`\`javascript
|
|
14
|
+
const result = await invokeWorkflow('WORKFLOW_HASH', { input: 'value' });
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
17
|
You can optionally provide an alias to reference the workflow by a friendly name.`,
|
|
18
18
|
inputSchema: {
|
|
19
19
|
type: 'object',
|
|
@@ -40,19 +40,19 @@ export async function handleLinkAppWorkflow(client, args) {
|
|
|
40
40
|
const workflowHash = String(args.workflow_hash);
|
|
41
41
|
const alias = args.alias ? String(args.alias) : undefined;
|
|
42
42
|
const result = await client.linkAppWorkflow(appId, workflowHash, alias);
|
|
43
|
-
const text = `Workflow linked successfully!
|
|
44
|
-
|
|
45
|
-
**Workflow:** ${result.name} (${result.hash})
|
|
46
|
-
${result.alias ? `**Alias:** ${result.alias}` : ''}
|
|
47
|
-
${result.description ? `**Description:** ${result.description}` : ''}
|
|
48
|
-
|
|
49
|
-
## Usage in App Code
|
|
50
|
-
|
|
51
|
-
\`\`\`javascript
|
|
52
|
-
// Invoke the workflow
|
|
53
|
-
const result = await invokeWorkflow('${result.hash}', {
|
|
54
|
-
// your inputs here
|
|
55
|
-
});
|
|
43
|
+
const text = `Workflow linked successfully!
|
|
44
|
+
|
|
45
|
+
**Workflow:** ${result.name} (${result.hash})
|
|
46
|
+
${result.alias ? `**Alias:** ${result.alias}` : ''}
|
|
47
|
+
${result.description ? `**Description:** ${result.description}` : ''}
|
|
48
|
+
|
|
49
|
+
## Usage in App Code
|
|
50
|
+
|
|
51
|
+
\`\`\`javascript
|
|
52
|
+
// Invoke the workflow
|
|
53
|
+
const result = await invokeWorkflow('${result.hash}', {
|
|
54
|
+
// your inputs here
|
|
55
|
+
});
|
|
56
56
|
\`\`\``;
|
|
57
57
|
return {
|
|
58
58
|
content: [{ type: 'text', text }],
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* link_recipe MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Links a recipe for use in MCP context.
|
|
5
|
+
*/
|
|
6
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
8
|
+
export declare const linkRecipeTool: Tool;
|
|
9
|
+
export declare function handleLinkRecipe(api: FlowDotApiClient, args: {
|
|
10
|
+
hash: string;
|
|
11
|
+
alias: string;
|
|
12
|
+
is_default?: boolean;
|
|
13
|
+
}): Promise<CallToolResult>;
|
|
14
|
+
//# sourceMappingURL=link-recipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-recipe.d.ts","sourceRoot":"","sources":["../../src/tools/link-recipe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,eAAO,MAAM,cAAc,EAAE,IAkC5B,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,gBAAgB,EACrB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1D,OAAO,CAAC,cAAc,CAAC,CAmCzB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* link_recipe MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Links a recipe for use in MCP context.
|
|
5
|
+
*/
|
|
6
|
+
export const linkRecipeTool = {
|
|
7
|
+
name: 'link_recipe',
|
|
8
|
+
description: `Link a recipe for CLI execution. **REQUIRED** to run recipes from command line.
|
|
9
|
+
|
|
10
|
+
**CRITICAL - Alias Rules:**
|
|
11
|
+
- Use HYPHENS only: \`my-recipe\` ✓
|
|
12
|
+
- NO underscores: \`my_recipe\` ✗ (causes 422 error)
|
|
13
|
+
- Lowercase, alphanumeric + hyphens only
|
|
14
|
+
|
|
15
|
+
**After Linking, Run via CLI:**
|
|
16
|
+
\`\`\`bash
|
|
17
|
+
npx flowdot recipes run <alias> --input '{"input_key":"value"}'
|
|
18
|
+
\`\`\`
|
|
19
|
+
|
|
20
|
+
**Note:** MCP tools can only DESIGN recipes. CLI is required to EXECUTE them.`,
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
hash: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'The recipe hash/ID to link',
|
|
27
|
+
},
|
|
28
|
+
alias: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'A friendly alias for the recipe (e.g., "code-reviewer", "summarizer")',
|
|
31
|
+
},
|
|
32
|
+
is_default: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
description: 'Whether this should be the default linked recipe',
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['hash', 'alias'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export async function handleLinkRecipe(api, args) {
|
|
42
|
+
try {
|
|
43
|
+
const input = {
|
|
44
|
+
alias: args.alias,
|
|
45
|
+
is_default: args.is_default,
|
|
46
|
+
};
|
|
47
|
+
const result = await api.linkRecipe(args.hash, input);
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: `Recipe linked successfully!
|
|
53
|
+
|
|
54
|
+
**Alias:** ${result.alias}
|
|
55
|
+
**Recipe:** ${result.recipe_name} (${result.recipe_hash})
|
|
56
|
+
**Default:** ${result.is_default ? 'Yes' : 'No'}
|
|
57
|
+
|
|
58
|
+
You can now execute this recipe using the alias.`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: `Error linking recipe: ${message}`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=link-recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-recipe.js","sourceRoot":"","sources":["../../src/tools/link-recipe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EA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aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_app_files Tool
|
|
3
|
+
*
|
|
4
|
+
* List all files in a multi-file FlowDot app.
|
|
5
|
+
* Required scope: apps:read
|
|
6
|
+
*/
|
|
7
|
+
import { Tool, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { FlowDotApiClient } from '../api-client.js';
|
|
9
|
+
export declare const listAppFilesTool: Tool;
|
|
10
|
+
export declare function handleListAppFiles(client: FlowDotApiClient, args: Record<string, unknown>): Promise<CallToolResult>;
|
|
11
|
+
//# sourceMappingURL=list-app-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-app-files.d.ts","sourceRoot":"","sources":["../../src/tools/list-app-files.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,gBAAgB,EAAE,IAuB9B,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CA2DzB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_app_files Tool
|
|
3
|
+
*
|
|
4
|
+
* List all files in a multi-file FlowDot app.
|
|
5
|
+
* Required scope: apps:read
|
|
6
|
+
*/
|
|
7
|
+
export const listAppFilesTool = {
|
|
8
|
+
name: 'list_app_files',
|
|
9
|
+
description: `List all files in a multi-file FlowDot app.
|
|
10
|
+
|
|
11
|
+
Returns a list of files with their paths, types, and entry point status.
|
|
12
|
+
|
|
13
|
+
Multi-file apps allow organizing React code across multiple files:
|
|
14
|
+
- Component files (.jsx, .tsx)
|
|
15
|
+
- Utility files (.js, .ts)
|
|
16
|
+
- Style files (.css)
|
|
17
|
+
- JSON configuration files
|
|
18
|
+
|
|
19
|
+
Use get_app_file to retrieve the content of a specific file.`,
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
app_id: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'The app ID (hash)',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['app_id'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export async function handleListAppFiles(client, args) {
|
|
32
|
+
try {
|
|
33
|
+
const appId = String(args.app_id);
|
|
34
|
+
const files = await client.listAppFiles(appId);
|
|
35
|
+
if (files.length === 0) {
|
|
36
|
+
return {
|
|
37
|
+
content: [{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: `No files found in app ${appId}.\n\nUse create_app_file to add files to this app.`,
|
|
40
|
+
}],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Group files by directory
|
|
44
|
+
const filesByDir = {};
|
|
45
|
+
for (const file of files) {
|
|
46
|
+
const dir = file.path.includes('/')
|
|
47
|
+
? file.path.substring(0, file.path.lastIndexOf('/'))
|
|
48
|
+
: '(root)';
|
|
49
|
+
if (!filesByDir[dir]) {
|
|
50
|
+
filesByDir[dir] = [];
|
|
51
|
+
}
|
|
52
|
+
filesByDir[dir].push(file);
|
|
53
|
+
}
|
|
54
|
+
// Format output
|
|
55
|
+
let text = `# Files in App ${appId}\n\n`;
|
|
56
|
+
text += `**Total Files:** ${files.length}\n\n`;
|
|
57
|
+
// Find entry point
|
|
58
|
+
const entryFile = files.find(f => f.is_entry);
|
|
59
|
+
if (entryFile) {
|
|
60
|
+
text += `**Entry Point:** ${entryFile.path}\n\n`;
|
|
61
|
+
}
|
|
62
|
+
text += `## File List\n\n`;
|
|
63
|
+
for (const [dir, dirFiles] of Object.entries(filesByDir).sort()) {
|
|
64
|
+
text += `### ${dir}/\n\n`;
|
|
65
|
+
for (const file of dirFiles.sort((a, b) => a.path.localeCompare(b.path))) {
|
|
66
|
+
const entryBadge = file.is_entry ? ' [ENTRY]' : '';
|
|
67
|
+
const typeBadge = file.type ? ` (${file.type})` : '';
|
|
68
|
+
text += `- \`${file.path}\`${typeBadge}${entryBadge}\n`;
|
|
69
|
+
}
|
|
70
|
+
text += '\n';
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: 'text', text }],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: 'text', text: `Error listing app files: ${message}` }],
|
|
80
|
+
isError: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=list-app-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-app-files.js","sourceRoot":"","sources":["../../src/tools/list-app-files.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE;;;;;;;;;;6DAU8C;IAC3D,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mBAAmB;aACjC;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAwB,EACxB,IAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,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AO,GAAG,OAAO,CAAC;YAC1B,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrD,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,GAAG,UAAU,IAAI,CAAC;YAC1D,CAAC;YACD,IAAI,IAAI,IAAI,CAAC;QACf,CAAC;QAED,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"}
|
package/dist/tools/list-apps.js
CHANGED
|
@@ -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,MA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,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"}
|