loremfile 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/package.json +3 -2
- package/src/api.js +26 -5
- package/src/cli.js +42 -8
- package/src/mcp.js +400 -0
- package/src/tools.json +307 -0
package/README.md
CHANGED
|
@@ -22,14 +22,39 @@ correctly by default: every file is verified, and a file that fails is not writt
|
|
|
22
22
|
| `loremfile get --format svg --format pdf` | The same for every published file of a format. |
|
|
23
23
|
| `loremfile list [--format F] [--tag T] [--max-bytes N]` | What is published, without downloading. |
|
|
24
24
|
| `loremfile verify [PATH…]` | Check files already on disk against the manifest. |
|
|
25
|
+
| `loremfile mcp` | Serve the same lookups to an agent over MCP; see below. |
|
|
25
26
|
|
|
26
27
|
Every command takes `--json` for scripts, `--quiet`, and `--catalog-version X.Y.Z` to
|
|
27
28
|
refuse to run if loremfile.dev has moved on. `get` also takes `--force` (overwrite) and
|
|
28
|
-
`--dry-run` (what it would fetch, and how many bytes).
|
|
29
|
+
`--dry-run` (what it would fetch, and how many bytes). `get`, `list` and `verify` leave out the
|
|
30
|
+
`sample.{format}` aliases, which repeat another file's bytes, unless you pass `--include-aliases`;
|
|
31
|
+
a path you name is always fetched.
|
|
29
32
|
|
|
30
33
|
Exit codes: `0` fine, `1` a file failed verification or is missing, `2` the request was
|
|
31
34
|
wrong, `3` loremfile.dev could not be read.
|
|
32
35
|
|
|
36
|
+
## MCP server
|
|
37
|
+
|
|
38
|
+
`loremfile mcp` runs a [Model Context Protocol](https://modelcontextprotocol.io) server over
|
|
39
|
+
stdio, so an agent can find a fixture, read its URL and metadata, and check a file it already
|
|
40
|
+
has. It returns URLs and metadata, never file bytes: the agent, or your test, fetches the URL.
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{ "mcpServers": { "loremfile": { "command": "npx", "args": ["-y", "loremfile", "mcp"] } } }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It speaks protocol `2026-07-28` (per-request metadata, `server/discover`) and `2025-11-25`
|
|
47
|
+
(the `initialize` handshake), so clients of either era work. All three tools are read-only.
|
|
48
|
+
|
|
49
|
+
| Tool | Arguments | Returns |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `list_fixtures` | `format`, `tag`, `max_bytes`, `limit`, `offset` | One page of published fixtures, each with `path`, `url`, `format`, `mime`, `bytes`, `tags` and `description`, plus `total` and `next_offset`. `format` and `tag` are lists matched as any of; `limit` defaults to 50, at most 250. |
|
|
52
|
+
| `describe_fixture` | `path` (required) | One fixture's manifest entry: `url`, `mime`, `bytes`, `sha256`, `size_class`, `tags`, `description`, `props` and `added_in`. |
|
|
53
|
+
| `verify_file` | `path` (required), `file` (required) | Whether the local `file` is the published `path`: `status` is `ok`, `changed` or `missing`, with both hashes and sizes. The file is read to hash it and goes nowhere. |
|
|
54
|
+
|
|
55
|
+
The manifest is read once per server process from loremfile.dev, under the same rules as the
|
|
56
|
+
commands above.
|
|
57
|
+
|
|
33
58
|
## What it will not do
|
|
34
59
|
|
|
35
60
|
- **Write a file it could not verify.** Bytes go to a hidden temporary file beside the
|
|
@@ -66,7 +91,7 @@ support because it needs `sha256sum`.
|
|
|
66
91
|
## One name, two clients
|
|
67
92
|
|
|
68
93
|
The Python client, `pip install loremfile`, installs a command with the same name and the
|
|
69
|
-
same
|
|
94
|
+
same `get`, `list` and `verify`. On a machine with both, `loremfile` runs whichever comes first on
|
|
70
95
|
`PATH` — and where the two install into the same directory, whichever was installed last.
|
|
71
96
|
Either one checks every byte the same way.
|
|
72
97
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loremfile",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Download CC0 sample files from loremfile.dev and verify every byte",
|
|
5
|
-
"keywords": ["fixtures", "test-data", "sample-files", "cc0", "download"],
|
|
5
|
+
"keywords": ["fixtures", "test-data", "sample-files", "cc0", "download", "mcp"],
|
|
6
6
|
"homepage": "https://loremfile.dev",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://github.com/kumarprabhashanand/loremfile/issues"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"directory": "client-js"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
|
+
"mcpName": "io.github.kumarprabhashanand/loremfile",
|
|
16
17
|
"author": "the loremfile.dev contributors",
|
|
17
18
|
"type": "module",
|
|
18
19
|
"bin": {
|
package/src/api.js
CHANGED
|
@@ -209,8 +209,23 @@ export function active(document) {
|
|
|
209
209
|
return (document.fixtures ?? []).filter((entry) => (entry.status ?? "active") === "active");
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
/**
|
|
213
|
-
|
|
212
|
+
/**
|
|
213
|
+
* A `sample.{format}` alias is a second URL for bytes that already have one. Its manifest entry
|
|
214
|
+
* is the only place that says so, and the field that does is `generator`; its original is
|
|
215
|
+
* `generator_params.of`. (`aliasOf`, which 1.15.0 carried until 1.15.1, matches nothing.)
|
|
216
|
+
*/
|
|
217
|
+
export const ALIAS_GENERATOR = "alias.copy";
|
|
218
|
+
|
|
219
|
+
export function isAlias(entry) {
|
|
220
|
+
return entry.generator === ALIAS_GENERATOR;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The entries a request names, or `Refused` naming what does not exist. A format selects its
|
|
225
|
+
* files, not the aliases that repeat them, unless `includeAliases`; a path that is named is
|
|
226
|
+
* always honoured, alias or not.
|
|
227
|
+
*/
|
|
228
|
+
export function select(entries, { paths = [], formats = [], includeAliases = false } = {}) {
|
|
214
229
|
const wantedPaths = new Set(paths);
|
|
215
230
|
const wantedFormats = new Set(formats);
|
|
216
231
|
if (wantedPaths.size === 0 && wantedFormats.size === 0) {
|
|
@@ -227,7 +242,11 @@ export function select(entries, { paths = [], formats = [] } = {}) {
|
|
|
227
242
|
throw new Refused(`no such format: ${unknownFormats.join(", ")}`);
|
|
228
243
|
}
|
|
229
244
|
return entries
|
|
230
|
-
.filter(
|
|
245
|
+
.filter(
|
|
246
|
+
(entry) =>
|
|
247
|
+
wantedPaths.has(entry.path) ||
|
|
248
|
+
(wantedFormats.has(entry.format) && (includeAliases || !isAlias(entry))),
|
|
249
|
+
)
|
|
231
250
|
.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
232
251
|
}
|
|
233
252
|
|
|
@@ -354,7 +373,8 @@ export async function download(entry, dest, { force = false } = {}) {
|
|
|
354
373
|
return new Result(entry.path, "written", `${grouped(written)} bytes`);
|
|
355
374
|
}
|
|
356
375
|
|
|
357
|
-
|
|
376
|
+
/** The SHA-256 of a file on disk, read a chunk at a time. */
|
|
377
|
+
export async function hashFile(file) {
|
|
358
378
|
const digest = createHash("sha256");
|
|
359
379
|
for await (const chunk of createReadStream(file)) {
|
|
360
380
|
digest.update(chunk);
|
|
@@ -362,7 +382,8 @@ async function hashFile(file) {
|
|
|
362
382
|
return digest.digest("hex");
|
|
363
383
|
}
|
|
364
384
|
|
|
365
|
-
|
|
385
|
+
/** A regular file's stat, or null for anything that is not one. */
|
|
386
|
+
export async function fileInfo(file) {
|
|
366
387
|
try {
|
|
367
388
|
const info = await stat(file);
|
|
368
389
|
return info.isFile() ? info : null;
|
package/src/cli.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
// `loremfile get | list | verify`, the same three commands as the Python client
|
|
1
|
+
// `loremfile get | list | verify`, the same three commands as the Python client, and
|
|
2
|
+
// `loremfile mcp`, the same tools served to an agent (src/mcp.js).
|
|
2
3
|
//
|
|
3
4
|
// node:util's parseArgs rather than a framework, because the package has no dependencies and
|
|
4
|
-
// this is
|
|
5
|
+
// this is four subcommands. Exit codes are the contract: 0 fine, 1 a file failed
|
|
5
6
|
// verification or is missing, 2 the request was wrong, 3 loremfile.dev could not be read.
|
|
6
7
|
|
|
7
8
|
import { readFileSync } from "node:fs";
|
|
8
9
|
import { parseArgs } from "node:util";
|
|
9
10
|
|
|
10
11
|
import * as api from "./api.js";
|
|
12
|
+
import * as mcp from "./mcp.js";
|
|
11
13
|
|
|
12
14
|
export const OK = 0;
|
|
13
15
|
export const FAILED = 1;
|
|
@@ -31,6 +33,10 @@ const SHARED = {
|
|
|
31
33
|
};
|
|
32
34
|
const FORMAT = { type: "string", multiple: true, value: "FMT" };
|
|
33
35
|
const DEST = { type: "string", value: "DIR", help: `Default: ${DEFAULT_DEST}` };
|
|
36
|
+
const ALIASES = {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
help: "Also the sample.{format} copies, which repeat another file's bytes.",
|
|
39
|
+
};
|
|
34
40
|
|
|
35
41
|
/** Every option each command accepts. Exported so a test can read them off, not the source. */
|
|
36
42
|
export const COMMANDS = {
|
|
@@ -42,6 +48,7 @@ export const COMMANDS = {
|
|
|
42
48
|
dest: DEST,
|
|
43
49
|
force: { type: "boolean", help: "Overwrite files already there." },
|
|
44
50
|
"dry-run": { type: "boolean", help: "List what would be fetched." },
|
|
51
|
+
"include-aliases": ALIASES,
|
|
45
52
|
...SHARED,
|
|
46
53
|
},
|
|
47
54
|
},
|
|
@@ -52,6 +59,7 @@ export const COMMANDS = {
|
|
|
52
59
|
format: { ...FORMAT, help: "Only this format. Repeatable." },
|
|
53
60
|
tag: { type: "string", multiple: true, value: "TAG", help: "Only this tag. Repeatable." },
|
|
54
61
|
"max-bytes": { type: "string", value: "N", help: "Only files of at most N bytes." },
|
|
62
|
+
"include-aliases": ALIASES,
|
|
55
63
|
...SHARED,
|
|
56
64
|
},
|
|
57
65
|
},
|
|
@@ -61,9 +69,15 @@ export const COMMANDS = {
|
|
|
61
69
|
options: {
|
|
62
70
|
format: { ...FORMAT, help: "Every published file of this format. Repeatable." },
|
|
63
71
|
dest: DEST,
|
|
72
|
+
"include-aliases": ALIASES,
|
|
64
73
|
...SHARED,
|
|
65
74
|
},
|
|
66
75
|
},
|
|
76
|
+
mcp: {
|
|
77
|
+
summary: "Serve list, describe and verify to an agent over MCP on stdio.",
|
|
78
|
+
positionals: null,
|
|
79
|
+
options: { help: SHARED.help },
|
|
80
|
+
},
|
|
67
81
|
};
|
|
68
82
|
|
|
69
83
|
class Usage extends Error {}
|
|
@@ -73,7 +87,7 @@ function usage() {
|
|
|
73
87
|
`loremfile ${VERSION}`,
|
|
74
88
|
"Download CC0 sample files from loremfile.dev and check every byte.",
|
|
75
89
|
"",
|
|
76
|
-
"usage: loremfile {get,list,verify} [options]",
|
|
90
|
+
"usage: loremfile {get,list,verify,mcp} [options]",
|
|
77
91
|
...Object.entries(COMMANDS).map(([name, command]) => ` ${name.padEnd(8)}${command.summary}`),
|
|
78
92
|
"",
|
|
79
93
|
"`loremfile COMMAND --help` lists a command's options.",
|
|
@@ -97,7 +111,7 @@ function commandHelp(name) {
|
|
|
97
111
|
function parse(argv) {
|
|
98
112
|
const [name, ...rest] = argv;
|
|
99
113
|
if (name === undefined) {
|
|
100
|
-
throw new Usage("name a command: get, list or
|
|
114
|
+
throw new Usage("name a command: get, list, verify or mcp");
|
|
101
115
|
}
|
|
102
116
|
if (!Object.hasOwn(COMMANDS, name)) {
|
|
103
117
|
throw new Usage(`no such command: ${name}`);
|
|
@@ -131,6 +145,7 @@ function parse(argv) {
|
|
|
131
145
|
dest: values.dest ?? DEFAULT_DEST,
|
|
132
146
|
force: Boolean(values.force),
|
|
133
147
|
dryRun: Boolean(values["dry-run"]),
|
|
148
|
+
includeAliases: Boolean(values["include-aliases"]),
|
|
134
149
|
json: Boolean(values.json),
|
|
135
150
|
quiet: Boolean(values.quiet),
|
|
136
151
|
catalogVersion: values["catalog-version"],
|
|
@@ -166,7 +181,11 @@ function emit(args, summary, results, io) {
|
|
|
166
181
|
|
|
167
182
|
async function runGet(args, io) {
|
|
168
183
|
const published = api.active(await api.manifest({ catalogVersion: args.catalogVersion }));
|
|
169
|
-
const entries = api.select(published, {
|
|
184
|
+
const entries = api.select(published, {
|
|
185
|
+
paths: args.paths,
|
|
186
|
+
formats: args.format,
|
|
187
|
+
includeAliases: args.includeAliases,
|
|
188
|
+
});
|
|
170
189
|
if (args.dryRun) {
|
|
171
190
|
const total = entries.reduce((sum, entry) => sum + entry.bytes, 0);
|
|
172
191
|
emit(
|
|
@@ -190,6 +209,9 @@ async function runGet(args, io) {
|
|
|
190
209
|
|
|
191
210
|
async function runList(args, io) {
|
|
192
211
|
let entries = api.active(await api.manifest({ catalogVersion: args.catalogVersion }));
|
|
212
|
+
if (!args.includeAliases) {
|
|
213
|
+
entries = entries.filter((e) => !api.isAlias(e));
|
|
214
|
+
}
|
|
193
215
|
if (args.format.length > 0) {
|
|
194
216
|
entries = entries.filter((e) => args.format.includes(e.format));
|
|
195
217
|
}
|
|
@@ -209,9 +231,14 @@ async function runList(args, io) {
|
|
|
209
231
|
async function runVerify(args, io) {
|
|
210
232
|
let entries = api.active(await api.manifest({ catalogVersion: args.catalogVersion }));
|
|
211
233
|
if (args.paths.length > 0 || args.format.length > 0) {
|
|
212
|
-
entries = api.select(entries, {
|
|
234
|
+
entries = api.select(entries, {
|
|
235
|
+
paths: args.paths,
|
|
236
|
+
formats: args.format,
|
|
237
|
+
includeAliases: args.includeAliases,
|
|
238
|
+
});
|
|
213
239
|
} else {
|
|
214
|
-
// Everything the destination actually holds, so `verify` alone checks a directory
|
|
240
|
+
// Everything the destination actually holds, so `verify` alone checks a directory,
|
|
241
|
+
// aliases included: a copy that is on disk was put there on purpose.
|
|
215
242
|
const held = [];
|
|
216
243
|
for (const entry of entries) {
|
|
217
244
|
if (await api.held(entry, args.dest)) {
|
|
@@ -229,9 +256,16 @@ async function runVerify(args, io) {
|
|
|
229
256
|
return failing.length > 0 ? FAILED : OK;
|
|
230
257
|
}
|
|
231
258
|
|
|
232
|
-
|
|
259
|
+
// stdout carries protocol messages only, so this writes nothing of its own there.
|
|
260
|
+
async function runMcp(_args, io) {
|
|
261
|
+
await mcp.serve({ input: io.in, write: io.out });
|
|
262
|
+
return OK;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const RUNNERS = { get: runGet, list: runList, verify: runVerify, mcp: runMcp };
|
|
233
266
|
|
|
234
267
|
const STDIO = {
|
|
268
|
+
in: process.stdin,
|
|
235
269
|
out: (text) => process.stdout.write(text),
|
|
236
270
|
err: (text) => process.stderr.write(text),
|
|
237
271
|
};
|
package/src/mcp.js
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
// `loremfile mcp`: a Model Context Protocol server on stdio (modelcontextprotocol.io).
|
|
2
|
+
//
|
|
3
|
+
// Dual-era, as the 2026-07-28 specification permits. A request that carries
|
|
4
|
+
// `io.modelcontextprotocol/protocolVersion` in `_meta` is served on its own, with no session;
|
|
5
|
+
// an `initialize` request opens the 2025-11-25 session older clients expect. One message per
|
|
6
|
+
// line in each direction, and nothing else is ever written to stdout.
|
|
7
|
+
//
|
|
8
|
+
// Node built-ins only, like the rest of the package: no SDK. The tools return URLs and
|
|
9
|
+
// metadata and never a file's bytes — the agent, or the test it is writing, fetches the URL.
|
|
10
|
+
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import { createInterface } from "node:readline";
|
|
14
|
+
|
|
15
|
+
import * as api from "./api.js";
|
|
16
|
+
|
|
17
|
+
export const MODERN = "2026-07-28";
|
|
18
|
+
export const LEGACY = "2025-11-25";
|
|
19
|
+
/** Newest first: what `server/discover` and a version error advertise. */
|
|
20
|
+
export const SUPPORTED = [MODERN, LEGACY];
|
|
21
|
+
|
|
22
|
+
const META = "io.modelcontextprotocol/";
|
|
23
|
+
export const DEFAULT_LIMIT = 50;
|
|
24
|
+
export const MAX_LIMIT = 250;
|
|
25
|
+
|
|
26
|
+
/** JSON-RPC codes, and the one MCP code this server uses. */
|
|
27
|
+
export const CODES = {
|
|
28
|
+
PARSE: -32700,
|
|
29
|
+
INVALID_REQUEST: -32600,
|
|
30
|
+
METHOD_NOT_FOUND: -32601,
|
|
31
|
+
INVALID_PARAMS: -32602,
|
|
32
|
+
INTERNAL: -32603,
|
|
33
|
+
UNSUPPORTED_VERSION: -32022,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const SERVER_INFO = {
|
|
37
|
+
name: "loremfile",
|
|
38
|
+
version: JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const INSTRUCTIONS =
|
|
42
|
+
"CC0 sample files and test fixtures from loremfile.dev, each at a stable URL. Use " +
|
|
43
|
+
"list_fixtures to find one, describe_fixture for its size, hash and measured properties, " +
|
|
44
|
+
"and verify_file to check a copy on disk. The tools return URLs, never file contents.";
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The tool surface, shared byte for byte with the Python client (tools.json in both trees;
|
|
48
|
+
* a test at the repository root holds the two copies together, and client-js/README.md
|
|
49
|
+
* documents it). Read-only tools, URLs and metadata only.
|
|
50
|
+
*/
|
|
51
|
+
export const TOOLS = JSON.parse(readFileSync(new URL("./tools.json", import.meta.url), "utf8"));
|
|
52
|
+
|
|
53
|
+
/** A failure the model can act on: a tool result with `isError`, not a protocol error. */
|
|
54
|
+
export class ToolError extends Error {}
|
|
55
|
+
|
|
56
|
+
class ProtocolError extends Error {
|
|
57
|
+
constructor(code, message, data) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.code = code;
|
|
60
|
+
this.data = data;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// --- arguments ----------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
function only(args, allowed) {
|
|
67
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) {
|
|
68
|
+
throw new ToolError("arguments must be an object");
|
|
69
|
+
}
|
|
70
|
+
const unknown = Object.keys(args).filter((key) => !allowed.includes(key));
|
|
71
|
+
if (unknown.length > 0) {
|
|
72
|
+
throw new ToolError(
|
|
73
|
+
`unknown argument ${unknown.join(", ")}; this tool takes ${allowed.join(", ")}`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return args;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function strings(value, name) {
|
|
80
|
+
if (value === undefined) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
const list = typeof value === "string" ? [value] : value;
|
|
84
|
+
if (!Array.isArray(list) || !list.every((item) => typeof item === "string")) {
|
|
85
|
+
throw new ToolError(`${name} must be a list of strings`);
|
|
86
|
+
}
|
|
87
|
+
return list;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function integer(value, name, { min, max, fallback }) {
|
|
91
|
+
if (value === undefined) {
|
|
92
|
+
return fallback;
|
|
93
|
+
}
|
|
94
|
+
if (!Number.isInteger(value) || value < min || (max !== undefined && value > max)) {
|
|
95
|
+
const range = max === undefined ? `at least ${min}` : `from ${min} to ${max}`;
|
|
96
|
+
throw new ToolError(`${name} must be a whole number ${range}, not ${JSON.stringify(value)}`);
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function text(value, name) {
|
|
102
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
103
|
+
throw new ToolError(`${name} is required and must be a non-empty string`);
|
|
104
|
+
}
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// --- the tools ----------------------------------------------------------------------------
|
|
109
|
+
|
|
110
|
+
function url(entry) {
|
|
111
|
+
return `${api.baseUrl()}${entry.path}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function byPath(document, fixturePath) {
|
|
115
|
+
const entry = api.active(document).find((candidate) => candidate.path === fixturePath);
|
|
116
|
+
if (entry === undefined) {
|
|
117
|
+
throw new ToolError(
|
|
118
|
+
`no published fixture at ${JSON.stringify(fixturePath)}; ` +
|
|
119
|
+
"list_fixtures shows what is published",
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return entry;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function listFixtures(document, args) {
|
|
126
|
+
only(args, ["format", "tag", "max_bytes", "limit", "offset"]);
|
|
127
|
+
const formats = strings(args.format, "format");
|
|
128
|
+
const tags = strings(args.tag, "tag");
|
|
129
|
+
const maxBytes = integer(args.max_bytes, "max_bytes", { min: 0, fallback: null });
|
|
130
|
+
const limit = integer(args.limit, "limit", { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
131
|
+
const offset = integer(args.offset, "offset", { min: 0, fallback: 0 });
|
|
132
|
+
// The same filters as `loremfile list`: any of the formats, any of the tags, all three kinds.
|
|
133
|
+
// The sample.{format} aliases repeat another file's bytes and stay out; describe_fixture and
|
|
134
|
+
// verify_file still take one by path.
|
|
135
|
+
const matches = api
|
|
136
|
+
.active(document)
|
|
137
|
+
.filter((e) => !api.isAlias(e))
|
|
138
|
+
.filter((e) => formats.length === 0 || formats.includes(e.format))
|
|
139
|
+
.filter((e) => tags.length === 0 || (e.tags ?? []).some((tag) => tags.includes(tag)))
|
|
140
|
+
.filter((e) => maxBytes === null || e.bytes <= maxBytes)
|
|
141
|
+
.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
142
|
+
const page = matches.slice(offset, offset + limit);
|
|
143
|
+
return {
|
|
144
|
+
catalog_version: String(document.catalog_version ?? ""),
|
|
145
|
+
total: matches.length,
|
|
146
|
+
offset,
|
|
147
|
+
limit,
|
|
148
|
+
count: page.length,
|
|
149
|
+
next_offset: offset + limit < matches.length ? offset + limit : null,
|
|
150
|
+
fixtures: page.map((e) => ({
|
|
151
|
+
path: e.path,
|
|
152
|
+
url: url(e),
|
|
153
|
+
format: e.format,
|
|
154
|
+
mime: e.mime,
|
|
155
|
+
bytes: e.bytes,
|
|
156
|
+
tags: e.tags ?? [],
|
|
157
|
+
description: e.description ?? "",
|
|
158
|
+
})),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function describeFixture(document, args) {
|
|
163
|
+
only(args, ["path"]);
|
|
164
|
+
const entry = byPath(document, text(args.path, "path"));
|
|
165
|
+
return {
|
|
166
|
+
catalog_version: String(document.catalog_version ?? ""),
|
|
167
|
+
path: entry.path,
|
|
168
|
+
url: url(entry),
|
|
169
|
+
format: entry.format,
|
|
170
|
+
mime: entry.mime,
|
|
171
|
+
bytes: entry.bytes,
|
|
172
|
+
sha256: entry.sha256,
|
|
173
|
+
size_class: entry.size_class ?? null,
|
|
174
|
+
tags: entry.tags ?? [],
|
|
175
|
+
description: entry.description ?? "",
|
|
176
|
+
props: entry.props ?? null,
|
|
177
|
+
added_in: entry.added_in ?? null,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async function verifyFile(document, args) {
|
|
182
|
+
only(args, ["path", "file"]);
|
|
183
|
+
const entry = byPath(document, text(args.path, "path"));
|
|
184
|
+
const file = path.resolve(text(args.file, "file"));
|
|
185
|
+
const info = await api.fileInfo(file);
|
|
186
|
+
const actual = info === null ? null : await api.hashFile(file);
|
|
187
|
+
return {
|
|
188
|
+
path: entry.path,
|
|
189
|
+
file,
|
|
190
|
+
status: info === null ? "missing" : actual === entry.sha256 ? "ok" : "changed",
|
|
191
|
+
expected_sha256: entry.sha256,
|
|
192
|
+
actual_sha256: actual,
|
|
193
|
+
expected_bytes: entry.bytes,
|
|
194
|
+
actual_bytes: info === null ? null : info.size,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const HANDLERS = {
|
|
199
|
+
list_fixtures: listFixtures,
|
|
200
|
+
describe_fixture: describeFixture,
|
|
201
|
+
verify_file: verifyFile,
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// --- the protocol -------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* One server's state: the manifest, read once, and the legacy session if a client opened one.
|
|
208
|
+
* `load` exists so tests can count reads; it defaults to the client's own manifest fetch.
|
|
209
|
+
*/
|
|
210
|
+
export function createServer({ load = () => api.manifest() } = {}) {
|
|
211
|
+
let manifest = null;
|
|
212
|
+
let session = null; // the negotiated legacy version, once `initialize` arrives
|
|
213
|
+
|
|
214
|
+
function published() {
|
|
215
|
+
// Kept for the process; dropped on failure, so a later call can try again.
|
|
216
|
+
manifest ??= load().catch((error) => {
|
|
217
|
+
manifest = null;
|
|
218
|
+
throw error;
|
|
219
|
+
});
|
|
220
|
+
return manifest;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async function callTool(params) {
|
|
224
|
+
if (params === null || typeof params !== "object" || typeof params.name !== "string") {
|
|
225
|
+
throw new ProtocolError(CODES.INVALID_PARAMS, "tools/call needs a tool name");
|
|
226
|
+
}
|
|
227
|
+
const handler = HANDLERS[params.name];
|
|
228
|
+
if (handler === undefined) {
|
|
229
|
+
throw new ProtocolError(CODES.INVALID_PARAMS, `Unknown tool: ${params.name}`);
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const structured = await handler(await published(), params.arguments ?? {});
|
|
233
|
+
return {
|
|
234
|
+
content: [{ type: "text", text: JSON.stringify(structured) }],
|
|
235
|
+
structuredContent: structured,
|
|
236
|
+
};
|
|
237
|
+
} catch (error) {
|
|
238
|
+
if (
|
|
239
|
+
error instanceof ToolError ||
|
|
240
|
+
error instanceof api.Refused ||
|
|
241
|
+
error instanceof api.Unreachable
|
|
242
|
+
) {
|
|
243
|
+
const prefix = error instanceof api.Unreachable ? "loremfile.dev could not be read: " : "";
|
|
244
|
+
return { content: [{ type: "text", text: `${prefix}${error.message}` }], isError: true };
|
|
245
|
+
}
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function dispatch(method, params, modern) {
|
|
251
|
+
if (method === "tools/list") {
|
|
252
|
+
return modern ? { tools: TOOLS, ttlMs: 3_600_000, cacheScope: "public" } : { tools: TOOLS };
|
|
253
|
+
}
|
|
254
|
+
if (method === "tools/call") {
|
|
255
|
+
return callTool(params);
|
|
256
|
+
}
|
|
257
|
+
if (method === "server/discover" && modern) {
|
|
258
|
+
return {
|
|
259
|
+
supportedVersions: SUPPORTED,
|
|
260
|
+
capabilities: { tools: {} },
|
|
261
|
+
instructions: INSTRUCTIONS,
|
|
262
|
+
ttlMs: 3_600_000,
|
|
263
|
+
cacheScope: "public",
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
if (method === "ping" && !modern) {
|
|
267
|
+
return {};
|
|
268
|
+
}
|
|
269
|
+
throw new ProtocolError(CODES.METHOD_NOT_FOUND, `Method not found: ${method}`);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async function request(method, params) {
|
|
273
|
+
if (method === "initialize") {
|
|
274
|
+
// 2025-11-25 negotiation: echo a version this server speaks, otherwise offer its own.
|
|
275
|
+
const asked = params?.protocolVersion;
|
|
276
|
+
session = asked === LEGACY ? asked : LEGACY;
|
|
277
|
+
return {
|
|
278
|
+
protocolVersion: session,
|
|
279
|
+
capabilities: { tools: {} },
|
|
280
|
+
serverInfo: SERVER_INFO,
|
|
281
|
+
instructions: INSTRUCTIONS,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
const meta = params?._meta;
|
|
285
|
+
const version = meta?.[`${META}protocolVersion`];
|
|
286
|
+
if (version !== undefined) {
|
|
287
|
+
if (!SUPPORTED.includes(version)) {
|
|
288
|
+
throw new ProtocolError(CODES.UNSUPPORTED_VERSION, "Unsupported protocol version", {
|
|
289
|
+
supported: SUPPORTED,
|
|
290
|
+
requested: version,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const capabilities = meta[`${META}clientCapabilities`];
|
|
294
|
+
if (
|
|
295
|
+
capabilities === null ||
|
|
296
|
+
typeof capabilities !== "object" ||
|
|
297
|
+
Array.isArray(capabilities)
|
|
298
|
+
) {
|
|
299
|
+
throw new ProtocolError(
|
|
300
|
+
CODES.INVALID_PARAMS,
|
|
301
|
+
`_meta lacks the required ${META}clientCapabilities`,
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
const result = await dispatch(method, params, version === MODERN);
|
|
305
|
+
if (version !== MODERN) {
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
return { resultType: "complete", ...result, _meta: { [`${META}serverInfo`]: SERVER_INFO } };
|
|
309
|
+
}
|
|
310
|
+
if (session !== null || method === "ping") {
|
|
311
|
+
return dispatch(method, params, false);
|
|
312
|
+
}
|
|
313
|
+
throw new ProtocolError(
|
|
314
|
+
CODES.INVALID_PARAMS,
|
|
315
|
+
`_meta lacks the required ${META}protocolVersion; send it on every request ` +
|
|
316
|
+
`(protocol ${MODERN}) or open a session with initialize (protocol ${LEGACY})`,
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** The reply to one parsed message, or null when there is nothing to send. */
|
|
321
|
+
async function handle(message) {
|
|
322
|
+
if (message === null || typeof message !== "object" || Array.isArray(message)) {
|
|
323
|
+
return {
|
|
324
|
+
jsonrpc: "2.0",
|
|
325
|
+
error: { code: CODES.INVALID_REQUEST, message: "not a JSON-RPC object" },
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const hasId = Object.hasOwn(message, "id");
|
|
329
|
+
if (!hasId) {
|
|
330
|
+
return null; // a notification: initialized, cancelled; nothing to answer
|
|
331
|
+
}
|
|
332
|
+
const { id } = message;
|
|
333
|
+
if (
|
|
334
|
+
message.jsonrpc !== "2.0" ||
|
|
335
|
+
typeof message.method !== "string" ||
|
|
336
|
+
!(typeof id === "string" || Number.isInteger(id))
|
|
337
|
+
) {
|
|
338
|
+
return {
|
|
339
|
+
jsonrpc: "2.0",
|
|
340
|
+
id,
|
|
341
|
+
error: { code: CODES.INVALID_REQUEST, message: "not a JSON-RPC 2.0 request" },
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
try {
|
|
345
|
+
return { jsonrpc: "2.0", id, result: await request(message.method, message.params) };
|
|
346
|
+
} catch (error) {
|
|
347
|
+
if (error instanceof ProtocolError) {
|
|
348
|
+
const body = { code: error.code, message: error.message };
|
|
349
|
+
return {
|
|
350
|
+
jsonrpc: "2.0",
|
|
351
|
+
id,
|
|
352
|
+
error: error.data === undefined ? body : { ...body, data: error.data },
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
jsonrpc: "2.0",
|
|
357
|
+
id,
|
|
358
|
+
error: { code: CODES.INTERNAL, message: String(error?.message ?? error) },
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** The reply to one line of input, or null. */
|
|
364
|
+
async function line(raw) {
|
|
365
|
+
if (raw.trim() === "") {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
let message;
|
|
369
|
+
try {
|
|
370
|
+
message = JSON.parse(raw);
|
|
371
|
+
} catch {
|
|
372
|
+
return { jsonrpc: "2.0", error: { code: CODES.PARSE, message: "Parse error" } };
|
|
373
|
+
}
|
|
374
|
+
return handle(message);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return { handle, line };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Serve until the input ends: one message per line in, one per line out, in order.
|
|
382
|
+
* Resolves once every reply has been written, so the process can exit cleanly.
|
|
383
|
+
*/
|
|
384
|
+
export async function serve({
|
|
385
|
+
input = process.stdin,
|
|
386
|
+
write = (text) => process.stdout.write(text),
|
|
387
|
+
server = createServer(),
|
|
388
|
+
} = {}) {
|
|
389
|
+
const lines = createInterface({ input, crlfDelay: Infinity });
|
|
390
|
+
let pending = Promise.resolve();
|
|
391
|
+
for await (const raw of lines) {
|
|
392
|
+
pending = pending.then(async () => {
|
|
393
|
+
const reply = await server.line(raw);
|
|
394
|
+
if (reply !== null) {
|
|
395
|
+
write(`${JSON.stringify(reply)}\n`);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
await pending;
|
|
400
|
+
}
|
package/src/tools.json
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "list_fixtures",
|
|
4
|
+
"title": "List loremfile.dev fixtures",
|
|
5
|
+
"description": "One page of the published sample files, filtered by format, tag and size. Each comes with its URL and a description of what it is for. `total` counts every match and `next_offset` fetches the next page; it is null on the last.",
|
|
6
|
+
"inputSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"format": {
|
|
10
|
+
"anyOf": [
|
|
11
|
+
{
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "array",
|
|
16
|
+
"items": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"description": "Formats to include, any of, e.g. [\"pdf\", \"png\"]."
|
|
22
|
+
},
|
|
23
|
+
"tag": {
|
|
24
|
+
"anyOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"description": "Tags to include, any of, e.g. [\"encrypted\"]."
|
|
36
|
+
},
|
|
37
|
+
"max_bytes": {
|
|
38
|
+
"type": "integer",
|
|
39
|
+
"minimum": 0,
|
|
40
|
+
"description": "Only files of at most this size."
|
|
41
|
+
},
|
|
42
|
+
"limit": {
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"minimum": 1,
|
|
45
|
+
"maximum": 250,
|
|
46
|
+
"default": 50,
|
|
47
|
+
"description": "Fixtures per page, 50 unless set, at most 250."
|
|
48
|
+
},
|
|
49
|
+
"offset": {
|
|
50
|
+
"type": "integer",
|
|
51
|
+
"minimum": 0,
|
|
52
|
+
"default": 0,
|
|
53
|
+
"description": "Matches to skip."
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
},
|
|
58
|
+
"outputSchema": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"catalog_version": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"total": {
|
|
65
|
+
"type": "integer"
|
|
66
|
+
},
|
|
67
|
+
"offset": {
|
|
68
|
+
"type": "integer"
|
|
69
|
+
},
|
|
70
|
+
"limit": {
|
|
71
|
+
"type": "integer"
|
|
72
|
+
},
|
|
73
|
+
"count": {
|
|
74
|
+
"type": "integer"
|
|
75
|
+
},
|
|
76
|
+
"next_offset": {
|
|
77
|
+
"type": [
|
|
78
|
+
"integer",
|
|
79
|
+
"null"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"fixtures": {
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"path": {
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"url": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
"format": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"mime": {
|
|
97
|
+
"type": "string"
|
|
98
|
+
},
|
|
99
|
+
"bytes": {
|
|
100
|
+
"type": "integer"
|
|
101
|
+
},
|
|
102
|
+
"tags": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"items": {
|
|
105
|
+
"type": "string"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"description": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"required": [
|
|
113
|
+
"path",
|
|
114
|
+
"url",
|
|
115
|
+
"format",
|
|
116
|
+
"mime",
|
|
117
|
+
"bytes",
|
|
118
|
+
"tags",
|
|
119
|
+
"description"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"required": [
|
|
125
|
+
"catalog_version",
|
|
126
|
+
"total",
|
|
127
|
+
"offset",
|
|
128
|
+
"limit",
|
|
129
|
+
"count",
|
|
130
|
+
"next_offset",
|
|
131
|
+
"fixtures"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"annotations": {
|
|
135
|
+
"readOnlyHint": true,
|
|
136
|
+
"destructiveHint": false,
|
|
137
|
+
"idempotentHint": true,
|
|
138
|
+
"openWorldHint": false
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "describe_fixture",
|
|
143
|
+
"title": "Describe one loremfile.dev fixture",
|
|
144
|
+
"description": "The published manifest entry for one fixture: its URL, MIME type, size, SHA-256, tags, description and measured properties. Metadata only; fetch the URL for the file.",
|
|
145
|
+
"inputSchema": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": {
|
|
148
|
+
"path": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"description": "A fixture path, e.g. \"pdf/minimal.pdf\"."
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": [
|
|
154
|
+
"path"
|
|
155
|
+
],
|
|
156
|
+
"additionalProperties": false
|
|
157
|
+
},
|
|
158
|
+
"outputSchema": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"properties": {
|
|
161
|
+
"catalog_version": {
|
|
162
|
+
"type": "string"
|
|
163
|
+
},
|
|
164
|
+
"path": {
|
|
165
|
+
"type": "string"
|
|
166
|
+
},
|
|
167
|
+
"url": {
|
|
168
|
+
"type": "string"
|
|
169
|
+
},
|
|
170
|
+
"format": {
|
|
171
|
+
"type": "string"
|
|
172
|
+
},
|
|
173
|
+
"mime": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
},
|
|
176
|
+
"bytes": {
|
|
177
|
+
"type": "integer"
|
|
178
|
+
},
|
|
179
|
+
"sha256": {
|
|
180
|
+
"type": "string"
|
|
181
|
+
},
|
|
182
|
+
"size_class": {
|
|
183
|
+
"type": [
|
|
184
|
+
"string",
|
|
185
|
+
"null"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"tags": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"description": {
|
|
195
|
+
"type": "string"
|
|
196
|
+
},
|
|
197
|
+
"props": {
|
|
198
|
+
"type": [
|
|
199
|
+
"object",
|
|
200
|
+
"null"
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
"added_in": {
|
|
204
|
+
"type": [
|
|
205
|
+
"string",
|
|
206
|
+
"null"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"required": [
|
|
211
|
+
"catalog_version",
|
|
212
|
+
"path",
|
|
213
|
+
"url",
|
|
214
|
+
"format",
|
|
215
|
+
"mime",
|
|
216
|
+
"bytes",
|
|
217
|
+
"sha256",
|
|
218
|
+
"size_class",
|
|
219
|
+
"tags",
|
|
220
|
+
"description",
|
|
221
|
+
"props",
|
|
222
|
+
"added_in"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"annotations": {
|
|
226
|
+
"readOnlyHint": true,
|
|
227
|
+
"destructiveHint": false,
|
|
228
|
+
"idempotentHint": true,
|
|
229
|
+
"openWorldHint": false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "verify_file",
|
|
234
|
+
"title": "Verify a local copy of a loremfile.dev fixture",
|
|
235
|
+
"description": "Hash a file on this machine and compare it with the published SHA-256 and size of a fixture. `status` is ok, changed or missing. The file is read only to hash it.",
|
|
236
|
+
"inputSchema": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"path": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"description": "The fixture path, e.g. \"pdf/minimal.pdf\"."
|
|
242
|
+
},
|
|
243
|
+
"file": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"description": "The local file: absolute, or relative to where the server was started."
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"required": [
|
|
249
|
+
"path",
|
|
250
|
+
"file"
|
|
251
|
+
],
|
|
252
|
+
"additionalProperties": false
|
|
253
|
+
},
|
|
254
|
+
"outputSchema": {
|
|
255
|
+
"type": "object",
|
|
256
|
+
"properties": {
|
|
257
|
+
"path": {
|
|
258
|
+
"type": "string"
|
|
259
|
+
},
|
|
260
|
+
"file": {
|
|
261
|
+
"type": "string"
|
|
262
|
+
},
|
|
263
|
+
"status": {
|
|
264
|
+
"type": "string",
|
|
265
|
+
"enum": [
|
|
266
|
+
"ok",
|
|
267
|
+
"changed",
|
|
268
|
+
"missing"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
"expected_sha256": {
|
|
272
|
+
"type": "string"
|
|
273
|
+
},
|
|
274
|
+
"actual_sha256": {
|
|
275
|
+
"type": [
|
|
276
|
+
"string",
|
|
277
|
+
"null"
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
"expected_bytes": {
|
|
281
|
+
"type": "integer"
|
|
282
|
+
},
|
|
283
|
+
"actual_bytes": {
|
|
284
|
+
"type": [
|
|
285
|
+
"integer",
|
|
286
|
+
"null"
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"required": [
|
|
291
|
+
"path",
|
|
292
|
+
"file",
|
|
293
|
+
"status",
|
|
294
|
+
"expected_sha256",
|
|
295
|
+
"actual_sha256",
|
|
296
|
+
"expected_bytes",
|
|
297
|
+
"actual_bytes"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"annotations": {
|
|
301
|
+
"readOnlyHint": true,
|
|
302
|
+
"destructiveHint": false,
|
|
303
|
+
"idempotentHint": true,
|
|
304
|
+
"openWorldHint": false
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
]
|