@opencraw/mcp 0.1.45 → 0.1.47
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 +27 -1
- package/dist/diff-tool/diff-tool.handler.d.ts +42 -0
- package/dist/diff-tool/index.d.ts +3 -0
- package/dist/docs-tool/docs-folder.repository.d.ts +24 -0
- package/dist/docs-tool/docs-root.client.d.ts +8 -0
- package/dist/docs-tool/docs-tool.handler.d.ts +21 -0
- package/dist/docs-tool/docs-topics.algorithm.d.ts +39 -0
- package/dist/docs-tool/index.d.ts +3 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.esm.js +430 -1
- package/dist/list-tool/index.d.ts +3 -0
- package/dist/list-tool/list-recipes-tool.handler.d.ts +32 -0
- package/dist/main.d.ts +7 -0
- package/dist/probe-tool/index.d.ts +2 -0
- package/dist/probe-tool/probe-tool.handler.d.ts +27 -0
- package/dist/recipe-source/index.d.ts +3 -0
- package/dist/recipe-source/recipe-source.mapper.d.ts +21 -0
- package/dist/run-tool/index.d.ts +3 -0
- package/dist/run-tool/run-tool.handler.d.ts +51 -0
- package/dist/server/create-server.use-case.d.ts +11 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/src/docs-tool/docs-folder.repository.d.ts +24 -0
- package/dist/src/docs-tool/docs-root.client.d.ts +8 -0
- package/dist/src/docs-tool/docs-tool.handler.d.ts +21 -0
- package/dist/src/docs-tool/docs-topics.algorithm.d.ts +39 -0
- package/dist/src/docs-tool/index.d.ts +3 -0
- package/dist/src/server/create-server.use-case.d.ts +1 -1
- package/dist/src/studio-tool/index.d.ts +2 -0
- package/dist/src/studio-tool/studio-command.client.d.ts +11 -0
- package/dist/src/studio-tool/studio-instance.repository.d.ts +22 -0
- package/dist/src/studio-tool/studio-tools.handler.d.ts +47 -0
- package/dist/studio-tool/index.d.ts +2 -0
- package/dist/studio-tool/studio-command.client.d.ts +11 -0
- package/dist/studio-tool/studio-instance.repository.d.ts +22 -0
- package/dist/studio-tool/studio-tools.handler.d.ts +47 -0
- package/dist/validate-tool/index.d.ts +3 -0
- package/dist/validate-tool/validate-tool.handler.d.ts +31 -0
- package/docs/how-it-works/01-recipes.md +698 -0
- package/docs/how-it-works/02-page-steps.md +672 -0
- package/docs/how-it-works/03-data-steps.md +813 -0
- package/docs/how-it-works/04-flow-steps.md +738 -0
- package/docs/how-it-works/05-templates-and-scope.md +428 -0
- package/docs/how-it-works/06-documents.md +1413 -0
- package/docs/how-it-works/07-mapping-and-transforms.md +699 -0
- package/docs/how-it-works/08-policies.md +405 -0
- package/docs/how-it-works/09-running.md +804 -0
- package/docs/how-it-works/README.md +225 -0
- package/docs/recipes/README.md +22 -0
- package/docs/recipes/access.md +440 -0
- package/docs/recipes/authoring.md +1503 -0
- package/docs/recipes/azure-durable.md +180 -0
- package/docs/recipes/captcha.md +204 -0
- package/docs/recipes/movies-example.md +12 -0
- package/docs/recipes/programmatic-authoring.md +101 -0
- package/docs/recipes/quick-guide.md +157 -0
- package/docs/recipes/vehicles-example.md +9 -0
- package/docs/recipes/worker-mode.md +221 -0
- package/docs/studio/manual.md +312 -0
- package/docs/studio/pdf-agreements.md +150 -0
- package/package.json +29 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Input schema for the `list_recipes` tool. */
|
|
4
|
+
export declare const listRecipesInputShape: {
|
|
5
|
+
dir: z.ZodString;
|
|
6
|
+
};
|
|
7
|
+
/** What the `list_recipes` tool returns. */
|
|
8
|
+
export interface ListRecipesResult {
|
|
9
|
+
outputs: {
|
|
10
|
+
path: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
}[];
|
|
13
|
+
inputs: {
|
|
14
|
+
path: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
output?: string;
|
|
17
|
+
mode?: string;
|
|
18
|
+
}[];
|
|
19
|
+
others: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `list_recipes` tool: what recipes already exist in a directory, cheaper
|
|
23
|
+
* than a full `validate` call, so an agent can check before writing a new one
|
|
24
|
+
* or find what an existing output recipe already covers.
|
|
25
|
+
*
|
|
26
|
+
* @param args - The tool's parsed input.
|
|
27
|
+
* @returns The MCP tool result.
|
|
28
|
+
*/
|
|
29
|
+
export declare function listRecipesTool(args: {
|
|
30
|
+
dir: string;
|
|
31
|
+
}): Promise<CallToolResult>;
|
|
32
|
+
//# sourceMappingURL=list-recipes-tool.handler.d.ts.map
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs the server over stdio until the transport closes. This is what
|
|
3
|
+
* `bin/opencraw-mcp.mjs` calls; an MCP host launches it as a subprocess and
|
|
4
|
+
* talks JSON-RPC over stdin/stdout, so there is no argv to parse.
|
|
5
|
+
*/
|
|
6
|
+
export declare function main(): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Input schema for the `probe` tool: a raw zod shape, as `McpServer.registerTool` expects. */
|
|
4
|
+
export declare const probeInputShape: {
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
browser: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
browserPath: z.ZodOptional<z.ZodString>;
|
|
8
|
+
insecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
10
|
+
access: z.ZodOptional<z.ZodString>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The `probe` tool: fetches a page and reports where its data lives, so an
|
|
14
|
+
* agent can write an extraction recipe without guessing selectors.
|
|
15
|
+
*
|
|
16
|
+
* @param args - The tool's parsed input.
|
|
17
|
+
* @returns The MCP tool result: the probe findings as JSON text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function probeTool(args: {
|
|
20
|
+
url: string;
|
|
21
|
+
browser?: boolean;
|
|
22
|
+
browserPath?: string;
|
|
23
|
+
insecureTls?: boolean;
|
|
24
|
+
userAgent?: string;
|
|
25
|
+
access?: string;
|
|
26
|
+
}): Promise<CallToolResult>;
|
|
27
|
+
//# sourceMappingURL=probe-tool.handler.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RecipeSource } from '@opencraw/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** The two ways a tool takes recipes: files, or the recipes themselves. */
|
|
4
|
+
export declare const recipeSourceShape: {
|
|
5
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
+
recipes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
7
|
+
};
|
|
8
|
+
/** A tool's recipe arguments. */
|
|
9
|
+
export interface RecipeSourceArgs {
|
|
10
|
+
paths?: string[];
|
|
11
|
+
recipes?: string | Record<string, unknown>[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The recipe source a tool call names.
|
|
15
|
+
*
|
|
16
|
+
* @param args - The tool's parsed input.
|
|
17
|
+
* @returns What core reads: the paths, or the inline recipes.
|
|
18
|
+
* @throws Error when the call gives both or neither.
|
|
19
|
+
*/
|
|
20
|
+
export declare function recipeSourceOf(args: RecipeSourceArgs): RecipeSource;
|
|
21
|
+
//# sourceMappingURL=recipe-source.mapper.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { CrawlReport } from '@opencraw/core';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import type { RecipeSourceArgs } from '../recipe-source';
|
|
5
|
+
/** Input schema for the `run` tool. */
|
|
6
|
+
export declare const runInputShape: {
|
|
7
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
recipes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
9
|
+
out: z.ZodOptional<z.ZodString>;
|
|
10
|
+
append: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
resume: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
only: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
headed: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
browserPath: z.ZodOptional<z.ZodString>;
|
|
16
|
+
insecureTls: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
18
|
+
access: z.ZodOptional<z.ZodString>;
|
|
19
|
+
parallel: z.ZodOptional<z.ZodInt>;
|
|
20
|
+
};
|
|
21
|
+
interface RunArgs extends RecipeSourceArgs {
|
|
22
|
+
out?: string;
|
|
23
|
+
append?: boolean;
|
|
24
|
+
resume?: boolean;
|
|
25
|
+
only?: string[];
|
|
26
|
+
dryRun?: boolean;
|
|
27
|
+
headed?: boolean;
|
|
28
|
+
browserPath?: string;
|
|
29
|
+
insecureTls?: boolean;
|
|
30
|
+
userAgent?: string;
|
|
31
|
+
access?: string;
|
|
32
|
+
parallel?: number;
|
|
33
|
+
}
|
|
34
|
+
/** What the `run` tool returns. */
|
|
35
|
+
export interface RunResult {
|
|
36
|
+
report: CrawlReport;
|
|
37
|
+
/** Present when "out" was not given: the records this call produced, capped. */
|
|
38
|
+
records?: Record<string, unknown>[];
|
|
39
|
+
truncated?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The `run` tool: crawls the recipes in `paths` or `recipes` (exactly one
|
|
43
|
+
* output recipe, any number of inputs) and returns what happened,
|
|
44
|
+
* structured, instead of the cli's printed summary.
|
|
45
|
+
*
|
|
46
|
+
* @param args - The tool's parsed input.
|
|
47
|
+
* @returns The MCP tool result.
|
|
48
|
+
*/
|
|
49
|
+
export declare function runTool(args: RunArgs): Promise<CallToolResult>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=run-tool.handler.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the MCP server: one tool per crawl primitive (`probe`, `validate`,
|
|
4
|
+
* `run`, `list_recipes`, `diff`), `docs` and the `studio_` tools that drive a running Studio, each a thin wrapper over `@opencraw/core` and
|
|
5
|
+
* `@opencraw/cli`'s structured helpers. No transport is attached; `main`
|
|
6
|
+
* connects it over stdio.
|
|
7
|
+
*
|
|
8
|
+
* @returns The server, ready to `connect`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createServer(): McpServer;
|
|
11
|
+
//# sourceMappingURL=create-server.use-case.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** One document the server can show. */
|
|
2
|
+
export interface DocTopic {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** Its size in characters, so an agent knows to ask for a section of a long one. */
|
|
6
|
+
size: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The documents under a docs folder: the Markdown files directly inside `recipes`, `how-it-works` and `studio` (their pictures and capture scripts are
|
|
10
|
+
* not documentation to read).
|
|
11
|
+
*
|
|
12
|
+
* @param root - The docs folder.
|
|
13
|
+
* @returns The topics, ordered by id.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listTopics(root: string): Promise<DocTopic[]>;
|
|
16
|
+
/**
|
|
17
|
+
* One document's text.
|
|
18
|
+
*
|
|
19
|
+
* @param root - The docs folder.
|
|
20
|
+
* @param id - The topic id from `listTopics` (never a path: nothing outside the listed folders is read).
|
|
21
|
+
* @returns The Markdown, or `undefined` when there is no such topic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readTopic(root: string, id: string): Promise<string | undefined>;
|
|
24
|
+
//# sourceMappingURL=docs-folder.repository.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the documentation is: a `docs` folder beside `dist` in the installed package (copied there at build), or the repository's own `docs` when the server runs
|
|
3
|
+
* from a checkout.
|
|
4
|
+
*
|
|
5
|
+
* @returns The docs folder.
|
|
6
|
+
*/
|
|
7
|
+
export declare function docsRoot(): string;
|
|
8
|
+
//# sourceMappingURL=docs-root.client.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Input schema for the `docs` tool. */
|
|
4
|
+
export declare const docsInputShape: {
|
|
5
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
6
|
+
section: z.ZodOptional<z.ZodString>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The `docs` tool: OpenCraw's own documentation, for an agent that has to write recipes right: the authoring guide (every step, selector, transform
|
|
10
|
+
* and policy), how it all works, the examples and the Studio manual. Without a topic it lists what there is; with one it gives the document, or just
|
|
11
|
+
* the section asked for, so a long guide costs only what is read.
|
|
12
|
+
*
|
|
13
|
+
* @param args - The tool's parsed input.
|
|
14
|
+
* @param root - The docs folder (the packaged copy, or the repository's).
|
|
15
|
+
* @returns The MCP tool result.
|
|
16
|
+
*/
|
|
17
|
+
export declare function docsTool(args: {
|
|
18
|
+
topic?: string;
|
|
19
|
+
section?: string;
|
|
20
|
+
}, root: string): Promise<CallToolResult>;
|
|
21
|
+
//# sourceMappingURL=docs-tool.handler.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** One heading of a document: how deep it is, its text and where its line is. */
|
|
2
|
+
export interface DocHeading {
|
|
3
|
+
level: number;
|
|
4
|
+
text: string;
|
|
5
|
+
line: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The topic id of a documentation file: its path under the docs folder, without the extension and with forward slashes, so `recipes/authoring.md` is
|
|
9
|
+
* `recipes/authoring`.
|
|
10
|
+
*
|
|
11
|
+
* @param relativePath - The file's path under the docs folder.
|
|
12
|
+
* @returns The id.
|
|
13
|
+
*/
|
|
14
|
+
export declare function topicIdOf(relativePath: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* The title of a document: its first top-level heading, else its id.
|
|
17
|
+
*
|
|
18
|
+
* @param markdown - The document.
|
|
19
|
+
* @param fallback - The id, when there is no heading.
|
|
20
|
+
* @returns The title.
|
|
21
|
+
*/
|
|
22
|
+
export declare function titleOf(markdown: string, fallback: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Every heading of a Markdown document, in order. A line inside a fenced code block is not a heading (a shell comment starts with `#` too).
|
|
25
|
+
*
|
|
26
|
+
* @param markdown - The document.
|
|
27
|
+
* @returns The headings.
|
|
28
|
+
*/
|
|
29
|
+
export declare function outlineOf(markdown: string): DocHeading[];
|
|
30
|
+
/**
|
|
31
|
+
* One section of a document: from the heading whose text contains `heading` (case-insensitive; an exact match wins over a partial one) to the next
|
|
32
|
+
* heading of the same or a higher level, so its subsections come with it.
|
|
33
|
+
*
|
|
34
|
+
* @param markdown - The document.
|
|
35
|
+
* @param heading - What the heading says, or part of it.
|
|
36
|
+
* @returns The section's text, or `undefined` when no heading matches.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sectionOf(markdown: string, heading: string): string | undefined;
|
|
39
|
+
//# sourceMappingURL=docs-topics.algorithm.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
/**
|
|
3
3
|
* Builds the MCP server: one tool per crawl primitive (`probe`, `validate`,
|
|
4
|
-
* `run`, `list_recipes`, `diff`), each a thin wrapper over `@opencraw/core` and
|
|
4
|
+
* `run`, `list_recipes`, `diff`), `docs` and the `studio_` tools that drive a running Studio, each a thin wrapper over `@opencraw/core` and
|
|
5
5
|
* `@opencraw/cli`'s structured helpers. No transport is attached; `main`
|
|
6
6
|
* connects it over stdio.
|
|
7
7
|
*
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StudioInstance } from './studio-instance.repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Sends one command to a running Studio (`POST /api/command`, the same door its own page uses) and reads the answer.
|
|
4
|
+
*
|
|
5
|
+
* @param instance - The Studio to talk to.
|
|
6
|
+
* @param command - A command `@opencraw/studio`'s `studioCommandSchema` accepts.
|
|
7
|
+
* @returns The JSON the Studio answered.
|
|
8
|
+
* @throws Error with the Studio's own message when it refuses.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sendStudioCommand<T>(instance: StudioInstance, command: Record<string, unknown>): Promise<T>;
|
|
11
|
+
//# sourceMappingURL=studio-command.client.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A running Studio, as it announced itself in `~/.opencraw/studio/<pid>-<port>.json` (`@opencraw/studio`'s
|
|
3
|
+
* `studio-instance`; this is the same shape, change both together).
|
|
4
|
+
*/
|
|
5
|
+
export interface StudioInstance {
|
|
6
|
+
pid: number;
|
|
7
|
+
url: string;
|
|
8
|
+
token: string;
|
|
9
|
+
folder?: string;
|
|
10
|
+
startedAt: string;
|
|
11
|
+
}
|
|
12
|
+
/** Where running Studios announce themselves. */
|
|
13
|
+
export declare function instancesDirectory(): string;
|
|
14
|
+
/**
|
|
15
|
+
* The Studios running on this machine, the newest first. A file whose process is gone (Studio was killed
|
|
16
|
+
* and could not withdraw it) is left out.
|
|
17
|
+
*
|
|
18
|
+
* @param directory - Where Studios announce themselves.
|
|
19
|
+
* @returns The live Studios.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runningStudios(directory?: string): Promise<StudioInstance[]>;
|
|
22
|
+
//# sourceMappingURL=studio-instance.repository.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Input schema for `studio_status`: nothing. */
|
|
4
|
+
export declare const studioStatusInputShape: {};
|
|
5
|
+
/** Input schema for `studio_open_recipe`. */
|
|
6
|
+
export declare const studioOpenRecipeInputShape: {
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
9
|
+
};
|
|
10
|
+
/** Input schema for `studio_run_sample`. */
|
|
11
|
+
export declare const studioRunSampleInputShape: {
|
|
12
|
+
recipeId: z.ZodString;
|
|
13
|
+
maxRecords: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
waitSeconds: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* `studio_status`: whether a Studio is running, which folder it has open, how many pages are watching and what it is running.
|
|
18
|
+
*
|
|
19
|
+
* @param directory - Where Studios announce themselves; the default is the user's own.
|
|
20
|
+
* @returns The MCP tool result.
|
|
21
|
+
*/
|
|
22
|
+
export declare function studioStatusTool(directory?: string): Promise<CallToolResult>;
|
|
23
|
+
/**
|
|
24
|
+
* `studio_open_recipe`: opens a recipe, a folder or a document in the Studio the person is looking at, so they watch the work happen.
|
|
25
|
+
*
|
|
26
|
+
* @param args - What to open.
|
|
27
|
+
* @param directory - Where Studios announce themselves.
|
|
28
|
+
* @returns The MCP tool result.
|
|
29
|
+
*/
|
|
30
|
+
export declare function studioOpenRecipeTool(args: {
|
|
31
|
+
path: string;
|
|
32
|
+
workspace?: string;
|
|
33
|
+
}, directory?: string): Promise<CallToolResult>;
|
|
34
|
+
/**
|
|
35
|
+
* `studio_run_sample`: runs an input recipe as a sample in Studio (the person sees the records arrive), waits for it, and returns the
|
|
36
|
+
* counts and the first records.
|
|
37
|
+
*
|
|
38
|
+
* @param args - The recipe, how many records to stop at and how long to wait.
|
|
39
|
+
* @param directory - Where Studios announce themselves.
|
|
40
|
+
* @returns The MCP tool result.
|
|
41
|
+
*/
|
|
42
|
+
export declare function studioRunSampleTool(args: {
|
|
43
|
+
recipeId: string;
|
|
44
|
+
maxRecords?: number;
|
|
45
|
+
waitSeconds?: number;
|
|
46
|
+
}, directory?: string): Promise<CallToolResult>;
|
|
47
|
+
//# sourceMappingURL=studio-tools.handler.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StudioInstance } from './studio-instance.repository';
|
|
2
|
+
/**
|
|
3
|
+
* Sends one command to a running Studio (`POST /api/command`, the same door its own page uses) and reads the answer.
|
|
4
|
+
*
|
|
5
|
+
* @param instance - The Studio to talk to.
|
|
6
|
+
* @param command - A command `@opencraw/studio`'s `studioCommandSchema` accepts.
|
|
7
|
+
* @returns The JSON the Studio answered.
|
|
8
|
+
* @throws Error with the Studio's own message when it refuses.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sendStudioCommand<T>(instance: StudioInstance, command: Record<string, unknown>): Promise<T>;
|
|
11
|
+
//# sourceMappingURL=studio-command.client.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A running Studio, as it announced itself in `~/.opencraw/studio/<pid>-<port>.json` (`@opencraw/studio`'s
|
|
3
|
+
* `studio-instance`; this is the same shape, change both together).
|
|
4
|
+
*/
|
|
5
|
+
export interface StudioInstance {
|
|
6
|
+
pid: number;
|
|
7
|
+
url: string;
|
|
8
|
+
token: string;
|
|
9
|
+
folder?: string;
|
|
10
|
+
startedAt: string;
|
|
11
|
+
}
|
|
12
|
+
/** Where running Studios announce themselves. */
|
|
13
|
+
export declare function instancesDirectory(): string;
|
|
14
|
+
/**
|
|
15
|
+
* The Studios running on this machine, the newest first. A file whose process is gone (Studio was killed
|
|
16
|
+
* and could not withdraw it) is left out.
|
|
17
|
+
*
|
|
18
|
+
* @param directory - Where Studios announce themselves.
|
|
19
|
+
* @returns The live Studios.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runningStudios(directory?: string): Promise<StudioInstance[]>;
|
|
22
|
+
//# sourceMappingURL=studio-instance.repository.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Input schema for `studio_status`: nothing. */
|
|
4
|
+
export declare const studioStatusInputShape: {};
|
|
5
|
+
/** Input schema for `studio_open_recipe`. */
|
|
6
|
+
export declare const studioOpenRecipeInputShape: {
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
9
|
+
};
|
|
10
|
+
/** Input schema for `studio_run_sample`. */
|
|
11
|
+
export declare const studioRunSampleInputShape: {
|
|
12
|
+
recipeId: z.ZodString;
|
|
13
|
+
maxRecords: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
waitSeconds: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* `studio_status`: whether a Studio is running, which folder it has open, how many pages are watching and what it is running.
|
|
18
|
+
*
|
|
19
|
+
* @param directory - Where Studios announce themselves; the default is the user's own.
|
|
20
|
+
* @returns The MCP tool result.
|
|
21
|
+
*/
|
|
22
|
+
export declare function studioStatusTool(directory?: string): Promise<CallToolResult>;
|
|
23
|
+
/**
|
|
24
|
+
* `studio_open_recipe`: opens a recipe, a folder or a document in the Studio the person is looking at, so they watch the work happen.
|
|
25
|
+
*
|
|
26
|
+
* @param args - What to open.
|
|
27
|
+
* @param directory - Where Studios announce themselves.
|
|
28
|
+
* @returns The MCP tool result.
|
|
29
|
+
*/
|
|
30
|
+
export declare function studioOpenRecipeTool(args: {
|
|
31
|
+
path: string;
|
|
32
|
+
workspace?: string;
|
|
33
|
+
}, directory?: string): Promise<CallToolResult>;
|
|
34
|
+
/**
|
|
35
|
+
* `studio_run_sample`: runs an input recipe as a sample in Studio (the person sees the records arrive), waits for it, and returns the
|
|
36
|
+
* counts and the first records.
|
|
37
|
+
*
|
|
38
|
+
* @param args - The recipe, how many records to stop at and how long to wait.
|
|
39
|
+
* @param directory - Where Studios announce themselves.
|
|
40
|
+
* @returns The MCP tool result.
|
|
41
|
+
*/
|
|
42
|
+
export declare function studioRunSampleTool(args: {
|
|
43
|
+
recipeId: string;
|
|
44
|
+
maxRecords?: number;
|
|
45
|
+
waitSeconds?: number;
|
|
46
|
+
}, directory?: string): Promise<CallToolResult>;
|
|
47
|
+
//# sourceMappingURL=studio-tools.handler.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { RecipeSourceArgs } from '../recipe-source';
|
|
3
|
+
/** Input schema for the `validate` tool. */
|
|
4
|
+
export declare const validateInputShape: {
|
|
5
|
+
paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
6
|
+
recipes: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>]>>;
|
|
7
|
+
};
|
|
8
|
+
interface Issue {
|
|
9
|
+
path: string;
|
|
10
|
+
message: string;
|
|
11
|
+
/** The file (`path:line` in JSON Lines), `recipes[i]` / `recipes:line` for inline recipes, or the recipe id when the issue came from binding. */
|
|
12
|
+
source: string;
|
|
13
|
+
}
|
|
14
|
+
/** What the `validate` tool returns. */
|
|
15
|
+
export interface ValidateResult {
|
|
16
|
+
ok: boolean;
|
|
17
|
+
output?: string;
|
|
18
|
+
inputs: string[];
|
|
19
|
+
issues: Issue[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `validate` tool: loads and binds recipes, returning every problem
|
|
23
|
+
* with its JSON path instead of a printed report, so an agent authoring a
|
|
24
|
+
* recipe can check it without a round trip through a terminal.
|
|
25
|
+
*
|
|
26
|
+
* @param args - The tool's parsed input.
|
|
27
|
+
* @returns The MCP tool result.
|
|
28
|
+
*/
|
|
29
|
+
export declare function validateTool(args: RecipeSourceArgs): Promise<CallToolResult>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=validate-tool.handler.d.ts.map
|