@b3os/mcp 0.1.0 → 0.1.3
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/README.md +129 -43
- package/bin/b3os-mcp.js +14 -3
- package/dist/compact.d.ts +27 -0
- package/dist/compact.js +138 -0
- package/dist/compact.js.map +1 -0
- package/dist/handlers/_common.d.ts +150 -0
- package/dist/handlers/_common.js +329 -0
- package/dist/handlers/_common.js.map +1 -0
- package/dist/handlers/actions.d.ts +19 -0
- package/dist/handlers/actions.js +110 -0
- package/dist/handlers/actions.js.map +1 -0
- package/dist/handlers/render.d.ts +7 -0
- package/dist/handlers/render.js +72 -0
- package/dist/handlers/render.js.map +1 -0
- package/dist/handlers/routines.d.ts +20 -0
- package/dist/handlers/routines.js +128 -0
- package/dist/handlers/routines.js.map +1 -0
- package/dist/handlers/sandboxes.d.ts +2 -0
- package/dist/handlers/sandboxes.js +100 -0
- package/dist/handlers/sandboxes.js.map +1 -0
- package/dist/handlers/vision.d.ts +7 -0
- package/dist/handlers/vision.js +186 -0
- package/dist/handlers/vision.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.js +88 -7
- package/dist/main.js.map +1 -1
- package/dist/server.d.ts +68 -1
- package/dist/server.js +175 -18
- package/dist/server.js.map +1 -1
- package/dist/stdio.d.ts +24 -1
- package/dist/stdio.js +89 -12
- package/dist/stdio.js.map +1 -1
- package/dist/table-types.d.ts +84 -0
- package/dist/table-types.js +4 -0
- package/dist/table-types.js.map +1 -0
- package/dist/table.d.ts +54 -0
- package/dist/table.gen.d.ts +7 -0
- package/dist/table.gen.js +3755 -0
- package/dist/table.gen.js.map +1 -0
- package/dist/table.js +240 -0
- package/dist/table.js.map +1 -0
- package/dist/tools.d.ts +61 -47
- package/dist/tools.js +231 -705
- package/dist/tools.js.map +1 -1
- package/package.json +16 -6
- package/src/compact.ts +127 -0
- package/src/handlers/_common.ts +433 -0
- package/src/handlers/actions.ts +144 -0
- package/src/handlers/render.ts +90 -0
- package/src/handlers/routines.ts +152 -0
- package/src/handlers/sandboxes.ts +110 -0
- package/src/handlers/vision.ts +213 -0
- package/src/index.ts +36 -0
- package/src/main.ts +79 -7
- package/src/server.ts +225 -19
- package/src/stdio.ts +107 -10
- package/src/table-types.ts +88 -0
- package/src/table.gen.ts +3812 -0
- package/src/table.ts +304 -0
- package/src/tools.ts +310 -785
- package/table/core.mjs +73 -0
- package/table/requests.json +1151 -0
- package/table/table.json +3764 -0
- package/table/tools/actions.mjs +55 -0
- package/table/tools/infer.mjs +52 -0
- package/table/tools/platform.mjs +76 -0
- package/table/tools/render.mjs +126 -0
- package/table/tools/routines.mjs +70 -0
- package/table/tools/sandboxes.mjs +269 -0
- package/table/tools/vision.mjs +316 -0
- package/table/tools.mjs +92 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Actions tools of the MCP tool table (owner: actions-triggers, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the actions toolset.
|
|
4
|
+
|
|
5
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
6
|
+
export const TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: "actions_search",
|
|
9
|
+
group: "core",
|
|
10
|
+
title: "Search catalog actions",
|
|
11
|
+
description:
|
|
12
|
+
"Find catalog actions (GitHub, Slack, Linear, Notion, HTTP and more) by what they do. Returns refs to pass " +
|
|
13
|
+
"to actions_describe (for the input schema) and actions_call. kind=trigger finds triggers for routines instead.",
|
|
14
|
+
op: "actionsSearch",
|
|
15
|
+
query: {
|
|
16
|
+
q: { description: "What the action should do, in words." },
|
|
17
|
+
pack: { description: "Only this pack, for example io.b3os/github." },
|
|
18
|
+
effects: {},
|
|
19
|
+
kind: {},
|
|
20
|
+
limit: {},
|
|
21
|
+
},
|
|
22
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "actions_describe",
|
|
26
|
+
group: "core",
|
|
27
|
+
title: "Describe an action",
|
|
28
|
+
description: "Get an action's input and output JSON Schemas, effect class and the connections it needs.",
|
|
29
|
+
op: "actionsDescribe",
|
|
30
|
+
query: {
|
|
31
|
+
ref: { description: "An action ref from actions_search, for example io.b3os/github/create-issue@1." },
|
|
32
|
+
},
|
|
33
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "actions_call",
|
|
37
|
+
group: "core",
|
|
38
|
+
title: "Call an action",
|
|
39
|
+
description:
|
|
40
|
+
"Run a catalog action with an input object. Credentials come from your stored connections (vault), never " +
|
|
41
|
+
"from arguments; name one per connection key in connections when you have several.",
|
|
42
|
+
op: "actionsCall",
|
|
43
|
+
body: {
|
|
44
|
+
ref: { description: "The action ref from actions_search, for example io.b3os/github/create-issue@1." },
|
|
45
|
+
input: { default: {} },
|
|
46
|
+
connections: {
|
|
47
|
+
collapse: true,
|
|
48
|
+
description: "Connection key to conn_… id, only when you have several connections for a key.",
|
|
49
|
+
},
|
|
50
|
+
timeout_ms: {},
|
|
51
|
+
},
|
|
52
|
+
defaults: { input: {} },
|
|
53
|
+
hints: { readOnlyHint: false, openWorldHint: true },
|
|
54
|
+
},
|
|
55
|
+
];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Infer tools of the MCP tool table (owner: infer, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the infer toolset.
|
|
4
|
+
|
|
5
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
6
|
+
export const TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: "infer_chat",
|
|
9
|
+
group: "infer",
|
|
10
|
+
title: "Chat with the node's model",
|
|
11
|
+
description:
|
|
12
|
+
"One chat completion on a model served on the node (GET /v1/infer/models lists them), for cheap sub-tasks " +
|
|
13
|
+
"next to the other tools.",
|
|
14
|
+
op: "inferCreateChatCompletion",
|
|
15
|
+
body: {
|
|
16
|
+
model: {},
|
|
17
|
+
messages: {
|
|
18
|
+
collapse: true,
|
|
19
|
+
description: "OpenAI-style messages: [{role: 'system' | 'user' | 'assistant', content}].",
|
|
20
|
+
},
|
|
21
|
+
response_format: {
|
|
22
|
+
collapse: true,
|
|
23
|
+
description: "{type: 'json_schema', json_schema: {name, schema}} for JSON output.",
|
|
24
|
+
},
|
|
25
|
+
temperature: {},
|
|
26
|
+
max_tokens: {},
|
|
27
|
+
},
|
|
28
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "infer_models",
|
|
32
|
+
group: "infer",
|
|
33
|
+
title: "List the node's models",
|
|
34
|
+
description:
|
|
35
|
+
"The models served on the node: each one's kind (chat or speech), context length, quantization, tool, JSON " +
|
|
36
|
+
"Schema and image support, and your organization's tokens and requests per minute for it. Pick a chat model " +
|
|
37
|
+
"for infer_chat here.",
|
|
38
|
+
op: "inferListModels",
|
|
39
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "infer_voices",
|
|
43
|
+
group: "infer",
|
|
44
|
+
title: "List narration voices",
|
|
45
|
+
description:
|
|
46
|
+
"The voices of the node's speech models, with each voice's language, gender, where its word timings come " +
|
|
47
|
+
"from, and a sample URL.",
|
|
48
|
+
op: "inferListVoices",
|
|
49
|
+
query: { model: {} },
|
|
50
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
51
|
+
},
|
|
52
|
+
];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Platform tools of the MCP tool table (owner: platform-dx, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the platform toolset.
|
|
4
|
+
|
|
5
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
6
|
+
export const TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: "usage_get",
|
|
9
|
+
group: "platform",
|
|
10
|
+
title: "Summarize usage",
|
|
11
|
+
description: "Summarize your organization's metered usage over a time range, grouped as you ask.",
|
|
12
|
+
op: "platformGetUsage",
|
|
13
|
+
query: { start: {}, end: {}, group_by: {}, project_id: {} },
|
|
14
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "limits_get",
|
|
18
|
+
group: "platform",
|
|
19
|
+
title: "Get your limits",
|
|
20
|
+
description: "Your organization's rate, concurrency and monthly limits and what is used of them.",
|
|
21
|
+
op: "platformGetLimits",
|
|
22
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "requests_list",
|
|
26
|
+
group: "platform",
|
|
27
|
+
title: "List API requests",
|
|
28
|
+
description:
|
|
29
|
+
"List the API requests the node served for this project in the last 7 days, newest first; filter by " +
|
|
30
|
+
"product, operation, status, key, connection kind, sandbox or time.",
|
|
31
|
+
op: "platformListRequests",
|
|
32
|
+
query: {
|
|
33
|
+
product: {},
|
|
34
|
+
operation_id: {},
|
|
35
|
+
status: {},
|
|
36
|
+
key_id: {},
|
|
37
|
+
connection: {},
|
|
38
|
+
sandbox_id: {},
|
|
39
|
+
since: {},
|
|
40
|
+
limit: {},
|
|
41
|
+
cursor: {},
|
|
42
|
+
},
|
|
43
|
+
example: { product: "sandboxes", status: "5xx", limit: 20 },
|
|
44
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "requests_get",
|
|
48
|
+
group: "platform",
|
|
49
|
+
title: "Get an API request",
|
|
50
|
+
description:
|
|
51
|
+
"Get one request by its ID (a response's x-request-id) with its full timing phase breakdown, node and edge.",
|
|
52
|
+
op: "platformGetRequest",
|
|
53
|
+
path: { request_id: {} },
|
|
54
|
+
example: { request_id: "req_01m5t68q1b590rj801nbzsqzkk" },
|
|
55
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "webhooks_list_deliveries",
|
|
59
|
+
group: "platform",
|
|
60
|
+
title: "List webhook deliveries",
|
|
61
|
+
description: "List webhook deliveries with their attempts and answers; filter by url, job or status.",
|
|
62
|
+
op: "webhooksListDeliveries",
|
|
63
|
+
query: { url: {}, job_id: {}, status: {}, limit: {}, cursor: {} },
|
|
64
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "webhooks_send_test",
|
|
68
|
+
group: "platform",
|
|
69
|
+
title: "Send a test webhook",
|
|
70
|
+
description:
|
|
71
|
+
"Send one signed webhook.test event to a URL now and return the delivery with its outcome (not retried).",
|
|
72
|
+
op: "webhooksSendTest",
|
|
73
|
+
body: { url: {} },
|
|
74
|
+
hints: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
75
|
+
},
|
|
76
|
+
];
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Render tools of the MCP tool table (owner: render, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the render toolset.
|
|
4
|
+
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { WAIT_S } from "../core.mjs";
|
|
7
|
+
|
|
8
|
+
// The browser steps a beat's `do` takes, read from the spec so the description cannot drift from ScriptStep:
|
|
9
|
+
// gen-table.mjs collapses schemas below depth 4, which is where a beat's step objects sit.
|
|
10
|
+
const SPEC = JSON.parse(readFileSync(new URL("../../../spec/dist/openapi.json", import.meta.url), "utf8"));
|
|
11
|
+
const STEPS = SPEC.components.schemas.ScriptStep.oneOf
|
|
12
|
+
.map((b) => SPEC.components.schemas[b.$ref.split("/").pop()])
|
|
13
|
+
.map((s) => {
|
|
14
|
+
const kind = s.properties.kind.const;
|
|
15
|
+
const fields = (s.required ?? []).filter((f) => f !== "kind");
|
|
16
|
+
return fields.length ? `${kind} {${fields.join(", ")}}` : kind;
|
|
17
|
+
})
|
|
18
|
+
.join(", ");
|
|
19
|
+
|
|
20
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
21
|
+
export const TOOLS = [
|
|
22
|
+
{
|
|
23
|
+
name: "render_screenshot",
|
|
24
|
+
group: "core",
|
|
25
|
+
title: "Take a screenshot",
|
|
26
|
+
description:
|
|
27
|
+
"Capture a page (or one element, or the full page) in a warm browser, optionally styled with a background and " +
|
|
28
|
+
"window frame. Give url or html. Returns the image and a signed URL to it.",
|
|
29
|
+
op: "renderCreateScreenshot",
|
|
30
|
+
body: {
|
|
31
|
+
url: {},
|
|
32
|
+
html: {},
|
|
33
|
+
viewport: {},
|
|
34
|
+
full_page: {},
|
|
35
|
+
target: {
|
|
36
|
+
collapse: true,
|
|
37
|
+
keys: ["selector", "text", "role", "name"],
|
|
38
|
+
description: "Capture only this element: {selector} (CSS), {text} (visible text) or {role, name}.",
|
|
39
|
+
},
|
|
40
|
+
wait_for_ms: {},
|
|
41
|
+
theme: {},
|
|
42
|
+
hide: {},
|
|
43
|
+
style: {
|
|
44
|
+
collapse: true,
|
|
45
|
+
keys: ["background", "frame"],
|
|
46
|
+
description:
|
|
47
|
+
"Leave style out for a plain capture (the page exactly as it painted). Any style object, even {}, adds the B3OS frame: padding, rounded corners and a shadow, so the image is larger than the viewport. Preset IDs from GET /v1/render/presets, for example {background: 'midnight', frame: 'browser-dark'}.",
|
|
48
|
+
},
|
|
49
|
+
format: {},
|
|
50
|
+
},
|
|
51
|
+
args: {
|
|
52
|
+
include_image: {
|
|
53
|
+
type: "boolean",
|
|
54
|
+
default: true,
|
|
55
|
+
description: "Return the image itself as well as its URL.",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
hints: { readOnlyHint: true, openWorldHint: true },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "render_video",
|
|
62
|
+
group: "core",
|
|
63
|
+
title: "Render a product video",
|
|
64
|
+
description:
|
|
65
|
+
"Record a scripted product demo (beats of browser steps, optional narration and captions) as MP4, GIF and a " +
|
|
66
|
+
"poster image. Waits up to wait_s seconds and returns the poster; if the video is still rendering, call " +
|
|
67
|
+
"again with job_id.",
|
|
68
|
+
op: "renderCreateVideo",
|
|
69
|
+
query: { wait: { from: "wait_s" } },
|
|
70
|
+
body: {
|
|
71
|
+
source: { required: false },
|
|
72
|
+
beats: {
|
|
73
|
+
required: false,
|
|
74
|
+
description:
|
|
75
|
+
"Beats in order, each {title?, say?, do: [steps], hold_ms?}: the narration line and the browser steps " +
|
|
76
|
+
"performed while it is said, for example {say: 'Open billing.', do: [{kind: 'click', target: {role: " +
|
|
77
|
+
`'link', name: 'Billing'}}]}. Step kinds and their required fields: ${STEPS}; a target is {selector}, ` +
|
|
78
|
+
"{text} or {role, name}.",
|
|
79
|
+
},
|
|
80
|
+
// The object branch of the spec's `VoiceSpec | null`: an agent leaves voice out for the default narration.
|
|
81
|
+
voice: {
|
|
82
|
+
schema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
required: ["model", "voice"],
|
|
85
|
+
properties: {
|
|
86
|
+
model: {
|
|
87
|
+
type: "string",
|
|
88
|
+
maxLength: 64,
|
|
89
|
+
description: "A speech model from GET /v1/infer/models, such as kokoro-82m.",
|
|
90
|
+
},
|
|
91
|
+
voice: { type: "string", maxLength: 64, description: "A voice from GET /v1/infer/audio/voices." },
|
|
92
|
+
speed: { type: "number", minimum: 0.5, maximum: 2, default: 1 },
|
|
93
|
+
},
|
|
94
|
+
additionalProperties: false,
|
|
95
|
+
description:
|
|
96
|
+
"Narration voice, for example {model: 'kokoro-82m', voice: 'af_heart'} (GET /v1/infer/audio/voices); " +
|
|
97
|
+
"omit to narrate every say line in af_heart. Narration needs infer:run in the key's scopes; without it " +
|
|
98
|
+
"the video is silent and result.warnings has narration_scope.",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
captions: {
|
|
102
|
+
description:
|
|
103
|
+
"Captions from the narration, for example {burn_in: 'karaoke', sidecars: ['vtt']}; omit for static " +
|
|
104
|
+
"burned-in captions and a WebVTT file, {burn_in: 'none'} for the file only.",
|
|
105
|
+
},
|
|
106
|
+
style: {
|
|
107
|
+
collapse: true,
|
|
108
|
+
keys: ["background", "frame", "cursor", "captions", "click_effect"],
|
|
109
|
+
description: "Preset IDs from GET /v1/render/presets.",
|
|
110
|
+
},
|
|
111
|
+
viewport: {},
|
|
112
|
+
formats: {},
|
|
113
|
+
},
|
|
114
|
+
args: {
|
|
115
|
+
job_id: { type: "string", description: "A vid_… id from an earlier call." },
|
|
116
|
+
wait_s: WAIT_S,
|
|
117
|
+
include_poster: {
|
|
118
|
+
type: "boolean",
|
|
119
|
+
default: true,
|
|
120
|
+
description: "Return the poster frame as an image once the video has succeeded.",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
continueWith: { arg: "job_id", op: "renderGetVideo" },
|
|
124
|
+
hints: { readOnlyHint: false, openWorldHint: true },
|
|
125
|
+
},
|
|
126
|
+
];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Routines tools of the MCP tool table (owner: routines, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the routines toolset.
|
|
4
|
+
|
|
5
|
+
import { WAIT_S } from "../core.mjs";
|
|
6
|
+
|
|
7
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
8
|
+
export const TOOLS = [
|
|
9
|
+
{
|
|
10
|
+
name: "routine_run",
|
|
11
|
+
group: "core",
|
|
12
|
+
title: "Run a routine",
|
|
13
|
+
description:
|
|
14
|
+
"Start a run of a published routine (by name or rtn_ id) with an input object and wait up to wait_s seconds " +
|
|
15
|
+
"for its output; if it is still running, call again with job_id.",
|
|
16
|
+
op: "routinesCreateRun",
|
|
17
|
+
path: { routine: { required: false, description: "Routine name or rtn_… id (omit with job_id)." } },
|
|
18
|
+
query: { wait: { from: "wait_s" } },
|
|
19
|
+
body: {
|
|
20
|
+
input: {},
|
|
21
|
+
version: { collapse: true, description: "Run this version (a number or ver_ id) instead of the active one." },
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
job_id: { type: "string", description: "A run_… id from an earlier call." },
|
|
25
|
+
wait_s: WAIT_S,
|
|
26
|
+
},
|
|
27
|
+
continueWith: { arg: "job_id", op: "routinesGetRun" },
|
|
28
|
+
hints: { readOnlyHint: false, openWorldHint: true },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "routine_get_run",
|
|
32
|
+
group: "routines",
|
|
33
|
+
title: "Get a routine run",
|
|
34
|
+
description:
|
|
35
|
+
"Read a routine run by its run_ id: its status, the step it failed at with the error code, each step's " +
|
|
36
|
+
"status and duration, and its output. An ephemeral run read after it ended has its summary only " +
|
|
37
|
+
"(steps_kept: false, no steps).",
|
|
38
|
+
op: "routinesGetRun",
|
|
39
|
+
path: { run_id: {} },
|
|
40
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "routine_validate",
|
|
44
|
+
group: "routines",
|
|
45
|
+
title: "Check a routine definition",
|
|
46
|
+
description:
|
|
47
|
+
"Compile a routine definition without publishing it. Returns every problem with a JSON pointer: schema, " +
|
|
48
|
+
"unknown callables or steps, cycles, CEL types, inputs against each callable's schema. Fix and check again " +
|
|
49
|
+
"until it is valid.",
|
|
50
|
+
op: "routinesValidateRoutine",
|
|
51
|
+
args: {
|
|
52
|
+
definition: {
|
|
53
|
+
type: "object",
|
|
54
|
+
description: "The definition as JSON: name and steps, optionally inputs, triggers, vars, output, defaults.",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
example: { definition: { name: "hello", steps: [{ id: "say", uses: "core/log@1", with: { message: "hi" } }] } },
|
|
58
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "routine_signal",
|
|
62
|
+
group: "routines",
|
|
63
|
+
title: "Signal a routine run",
|
|
64
|
+
description: "Send a named signal (with an optional payload) to a run waiting on it (a wait.signal step).",
|
|
65
|
+
op: "routinesSignalRun",
|
|
66
|
+
path: { run_id: {} },
|
|
67
|
+
body: { name: {}, payload: {} },
|
|
68
|
+
hints: { readOnlyHint: false, openWorldHint: false },
|
|
69
|
+
},
|
|
70
|
+
];
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
// Sandboxes tools of the MCP tool table (owner: sandboxes, plan 1.2). table/tools.mjs composes every
|
|
2
|
+
// product's TOOLS with core.mjs; the field options are described there. Keep the entries in tools/list order:
|
|
3
|
+
// core tools follow CORE in core.mjs, the rest of this list keeps its order within the sandboxes toolset.
|
|
4
|
+
|
|
5
|
+
/** @type {import("../../scripts/gen-table.mjs").ToolSource[]} */
|
|
6
|
+
export const TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: "sandbox_create",
|
|
9
|
+
group: "core",
|
|
10
|
+
title: "Create a sandbox",
|
|
11
|
+
description:
|
|
12
|
+
"Start a sandbox: an isolated Firecracker microVM (the base template has Ubuntu 24.04, Python 3.12, Node 24 and " +
|
|
13
|
+
"git). It stops after timeout_s seconds. Use sandbox_exec, sandbox_read_file and sandbox_write_file on its id.",
|
|
14
|
+
op: "sandboxesCreateSandbox",
|
|
15
|
+
body: {
|
|
16
|
+
template: {},
|
|
17
|
+
snapshot: {},
|
|
18
|
+
vcpu: {},
|
|
19
|
+
memory_mib: {},
|
|
20
|
+
timeout_s: {},
|
|
21
|
+
env: {},
|
|
22
|
+
secrets: {
|
|
23
|
+
schema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
description:
|
|
26
|
+
"Environment variables never returned or logged (code inside the VM can read them): a value, or " +
|
|
27
|
+
"{connection: conn_…, field?} to take a stored vault connection's secret.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
egress: { collapse: true },
|
|
31
|
+
metadata: { collapse: true, description: "Up to 16 string key-value pairs for your own use." },
|
|
32
|
+
},
|
|
33
|
+
hints: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "sandbox_exec",
|
|
37
|
+
group: "core",
|
|
38
|
+
title: "Run a command in a sandbox",
|
|
39
|
+
description:
|
|
40
|
+
"Run a shell command (a string, run with /bin/sh -c) or an argv array in a sandbox and return its exit code, " +
|
|
41
|
+
"stdout and stderr. background: true returns at once with the process.",
|
|
42
|
+
op: "sandboxesExec",
|
|
43
|
+
path: { sandbox_id: {} },
|
|
44
|
+
body: { cmd: {}, cwd: {}, env: {}, stdin: {}, timeout_ms: {}, background: {}, user: {} },
|
|
45
|
+
hints: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "sandbox_read_file",
|
|
49
|
+
group: "core",
|
|
50
|
+
title: "Read a file in a sandbox",
|
|
51
|
+
description: "Read a file from a sandbox (UTF-8 text, or base64 for binary), or list a directory with list: true.",
|
|
52
|
+
op: "sandboxesReadFile",
|
|
53
|
+
path: { sandbox_id: {} },
|
|
54
|
+
query: { path: { description: "Absolute path, for example /workspace/main.py." }, list: { type: "boolean" } },
|
|
55
|
+
args: {
|
|
56
|
+
max_chars: {
|
|
57
|
+
type: "integer",
|
|
58
|
+
minimum: 1000,
|
|
59
|
+
default: 100000,
|
|
60
|
+
description: "Truncate text to this many characters.",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "sandbox_write_file",
|
|
67
|
+
group: "core",
|
|
68
|
+
title: "Write a file in a sandbox",
|
|
69
|
+
description: "Write a file in a sandbox, replacing it if it exists; parent directories are created.",
|
|
70
|
+
op: "sandboxesWriteFile",
|
|
71
|
+
path: { sandbox_id: {} },
|
|
72
|
+
query: { path: {}, mode: {} },
|
|
73
|
+
raw: {
|
|
74
|
+
content: { type: "string", description: "The file's content." },
|
|
75
|
+
encoding: { type: "string", enum: ["utf8", "base64"], default: "utf8", description: "How content is encoded." },
|
|
76
|
+
},
|
|
77
|
+
defaults: { mkdir: 1 },
|
|
78
|
+
why: { mkdir: "the description promises parent directories are created" },
|
|
79
|
+
hints: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "sandbox_delete",
|
|
83
|
+
group: "core",
|
|
84
|
+
title: "Delete a sandbox",
|
|
85
|
+
description: "Stop a sandbox and destroy its memory and disk. Its snapshots are kept.",
|
|
86
|
+
op: "sandboxesDeleteSandbox",
|
|
87
|
+
path: { sandbox_id: {} },
|
|
88
|
+
hints: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "sandbox_run_code",
|
|
92
|
+
group: "sandboxes",
|
|
93
|
+
title: "Run code in a sandbox kernel",
|
|
94
|
+
description:
|
|
95
|
+
"Run code in the sandbox's Jupyter kernel (code-interpreter template): state persists between calls; returns " +
|
|
96
|
+
"stdout, stderr, the result and any images.",
|
|
97
|
+
op: "sandboxesRunCode",
|
|
98
|
+
path: { sandbox_id: {} },
|
|
99
|
+
body: { code: {}, language: {}, timeout_ms: {}, env: {} },
|
|
100
|
+
hints: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "sandbox_pause",
|
|
104
|
+
group: "sandboxes",
|
|
105
|
+
title: "Pause a sandbox",
|
|
106
|
+
description: "Pause a running sandbox (memory and disk kept, no CPU used); sandbox_resume continues it.",
|
|
107
|
+
op: "sandboxesPauseSandbox",
|
|
108
|
+
path: { sandbox_id: {} },
|
|
109
|
+
hints: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "sandbox_resume",
|
|
113
|
+
group: "sandboxes",
|
|
114
|
+
title: "Resume a sandbox",
|
|
115
|
+
description: "Resume a paused sandbox.",
|
|
116
|
+
op: "sandboxesResumeSandbox",
|
|
117
|
+
path: { sandbox_id: {} },
|
|
118
|
+
hints: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "sandbox_list",
|
|
122
|
+
group: "sandboxes",
|
|
123
|
+
title: "List sandboxes",
|
|
124
|
+
description: "List this project's sandboxes, newest first (status filter, cursor paging).",
|
|
125
|
+
op: "sandboxesListSandboxes",
|
|
126
|
+
query: { status: {}, limit: {}, cursor: {} },
|
|
127
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "sandbox_get",
|
|
131
|
+
group: "sandboxes",
|
|
132
|
+
title: "Get a sandbox",
|
|
133
|
+
description: "Get a sandbox's status, resources, egress policy, ports and expiry.",
|
|
134
|
+
op: "sandboxesGetSandbox",
|
|
135
|
+
path: { sandbox_id: {} },
|
|
136
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "sandbox_fork",
|
|
140
|
+
group: "sandboxes",
|
|
141
|
+
title: "Fork a sandbox",
|
|
142
|
+
description:
|
|
143
|
+
"Copy a sandbox created with forkable: true into count new running sandboxes that share its memory and disk " +
|
|
144
|
+
"(files, processes, environment) copy-on-write, each with a fresh identity; returns them.",
|
|
145
|
+
op: "sandboxesForkSandbox",
|
|
146
|
+
path: { sandbox_id: {} },
|
|
147
|
+
body: { count: {}, metadata: { collapse: true, description: "Up to 16 string key-value pairs for the copies." } },
|
|
148
|
+
hints: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "sandbox_snapshot",
|
|
152
|
+
group: "sandboxes",
|
|
153
|
+
title: "Snapshot a sandbox",
|
|
154
|
+
description:
|
|
155
|
+
"Save a sandbox's memory and disk as a snapshot (kept 7 days; the sandbox keeps running); sandbox_create " +
|
|
156
|
+
"with snapshot starts new sandboxes from it.",
|
|
157
|
+
op: "sandboxesCreateSnapshot",
|
|
158
|
+
path: { sandbox_id: {} },
|
|
159
|
+
body: { name: {}, metadata: { collapse: true, description: "Up to 16 string key-value pairs." } },
|
|
160
|
+
hints: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "sandbox_list_snapshots",
|
|
164
|
+
group: "sandboxes",
|
|
165
|
+
title: "List snapshots",
|
|
166
|
+
description: "List this project's sandbox snapshots, newest first.",
|
|
167
|
+
op: "sandboxesListSnapshots",
|
|
168
|
+
query: { limit: {}, cursor: {} },
|
|
169
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "sandbox_get_snapshot",
|
|
173
|
+
group: "sandboxes",
|
|
174
|
+
title: "Get a snapshot",
|
|
175
|
+
description: "Get a snapshot's source, size, status and metadata.",
|
|
176
|
+
op: "sandboxesGetSnapshot",
|
|
177
|
+
path: { snapshot_id: {} },
|
|
178
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "sandbox_delete_snapshot",
|
|
182
|
+
group: "sandboxes",
|
|
183
|
+
title: "Delete a snapshot",
|
|
184
|
+
description: "Delete a snapshot. Sandboxes already restored from it keep running.",
|
|
185
|
+
op: "sandboxesDeleteSnapshot",
|
|
186
|
+
path: { snapshot_id: {} },
|
|
187
|
+
hints: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "sandbox_list_templates",
|
|
191
|
+
group: "sandboxes",
|
|
192
|
+
title: "List sandbox templates",
|
|
193
|
+
description: "List the templates sandbox_create can start from: OS, runtimes, capabilities and defaults.",
|
|
194
|
+
op: "sandboxesListTemplates",
|
|
195
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "sandbox_get_template",
|
|
199
|
+
group: "sandboxes",
|
|
200
|
+
title: "Get a sandbox template",
|
|
201
|
+
description: "Get one template by name or tpl_ id.",
|
|
202
|
+
op: "sandboxesGetTemplate",
|
|
203
|
+
path: { template: {} },
|
|
204
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "sandbox_set_timeout",
|
|
208
|
+
group: "sandboxes",
|
|
209
|
+
title: "Change a sandbox's timeout",
|
|
210
|
+
description: "Set how many seconds from now the sandbox stops by itself (extend or shorten its life).",
|
|
211
|
+
op: "sandboxesSetTimeout",
|
|
212
|
+
path: { sandbox_id: {} },
|
|
213
|
+
body: { timeout_s: {} },
|
|
214
|
+
hints: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "sandbox_port_url",
|
|
218
|
+
group: "sandboxes",
|
|
219
|
+
title: "Get a preview URL for a port",
|
|
220
|
+
description:
|
|
221
|
+
"Mint an HTTPS preview URL that reaches a port inside the sandbox (declared in ports at create); anyone with " +
|
|
222
|
+
"the URL reaches the port until ttl_s passes.",
|
|
223
|
+
op: "sandboxesCreatePortUrl",
|
|
224
|
+
path: { sandbox_id: {}, port: {} },
|
|
225
|
+
body: { ttl_s: {} },
|
|
226
|
+
hints: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "sandbox_logs",
|
|
230
|
+
group: "sandboxes",
|
|
231
|
+
title: "Read background process output",
|
|
232
|
+
description:
|
|
233
|
+
"Read the buffered stdout and stderr of a sandbox's background processes (sandbox_exec with background: " +
|
|
234
|
+
"true), and which of them exited.",
|
|
235
|
+
op: "sandboxesStreamLogs",
|
|
236
|
+
path: { sandbox_id: {} },
|
|
237
|
+
query: { pid: {} },
|
|
238
|
+
defaults: { follow: false },
|
|
239
|
+
why: { follow: "a tool call returns once: it reads what is buffered instead of waiting for new output" },
|
|
240
|
+
args: {
|
|
241
|
+
max_chars: {
|
|
242
|
+
type: "integer",
|
|
243
|
+
minimum: 1000,
|
|
244
|
+
default: 50000,
|
|
245
|
+
description: "Keep the last this many characters of each stream.",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: "sandbox_list_processes",
|
|
252
|
+
group: "sandboxes",
|
|
253
|
+
title: "List sandbox processes",
|
|
254
|
+
description: "List the sandbox's background processes with their status and exit code.",
|
|
255
|
+
op: "sandboxesListProcesses",
|
|
256
|
+
path: { sandbox_id: {} },
|
|
257
|
+
hints: { readOnlyHint: true, openWorldHint: false },
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "sandbox_kill_process",
|
|
261
|
+
group: "sandboxes",
|
|
262
|
+
title: "Stop a sandbox process",
|
|
263
|
+
description: "Send a signal (default TERM) to a background process and its process group.",
|
|
264
|
+
op: "sandboxesKillProcess",
|
|
265
|
+
path: { sandbox_id: {}, pid: {} },
|
|
266
|
+
body: { signal: {} },
|
|
267
|
+
hints: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
268
|
+
},
|
|
269
|
+
];
|