wikimedia-commons-mcp 1.0.2 → 1.0.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 +5 -17
- package/dist/server.js +43 -15
- package/package.json +1 -1
- package/src/server.ts +59 -13
- package/dist/gateway.js +0 -85
- package/src/gateway.ts +0 -106
package/README.md
CHANGED
|
@@ -22,21 +22,9 @@ node dist/index.js
|
|
|
22
22
|
|
|
23
23
|
Public free APIs only. See `src/api.ts` for exact endpoints.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
## Premium tools
|
|
25
|
+
## Licence — no paywall
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
The tool bodies run on our gateway, not inside this package, so the key is what buys access. Buy one at https://buy.polar.sh/polar_cl_mrO7rS5LZxpqM7oAFFEA10i9121J240U40IIj4JRZO4 and set it in your MCP client config:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
"env": { "MCP_LICENSE_KEY": "polar_..." }
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The gateway checks the key against Polar and gives every key 1,000 free premium
|
|
40
|
-
calls a month before per-call billing starts. Every other tool on this server
|
|
41
|
-
stays free.
|
|
42
|
-
<!-- /paywall -->
|
|
27
|
+
Every tool in this package is free: no licence key, no premium tier, no hosted
|
|
28
|
+
licence gateway. The paywall machinery this repo once carried (per-tool licence
|
|
29
|
+
checks and paid hosted endpoints) was removed repo-wide on 2026-10-17. Nothing
|
|
30
|
+
that this package installs or calls asks you to pay.
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { m0_file, m0_search, m1_random, categoryFiles } from "./api.js";
|
|
4
|
-
import { premiumTool } from "./gateway.js";
|
|
5
4
|
const text = (value) => ({ content: [{ type: 'text', text: value }] });
|
|
6
5
|
const textError = (t) => ({ content: [{ type: "text", text: t }], isError: true });
|
|
7
6
|
const READ_ONLY = { readOnlyHint: true, openWorldHint: true };
|
|
@@ -19,7 +18,7 @@ export function createServer() {
|
|
|
19
18
|
return text(await m0_search(args));
|
|
20
19
|
}
|
|
21
20
|
catch (e) {
|
|
22
|
-
return textError(
|
|
21
|
+
return textError(String(e));
|
|
23
22
|
}
|
|
24
23
|
});
|
|
25
24
|
server.registerTool("file", {
|
|
@@ -32,7 +31,7 @@ export function createServer() {
|
|
|
32
31
|
return text(await m0_file(args));
|
|
33
32
|
}
|
|
34
33
|
catch (e) {
|
|
35
|
-
return textError(
|
|
34
|
+
return textError(String(e));
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
server.registerTool("random", {
|
|
@@ -45,7 +44,7 @@ export function createServer() {
|
|
|
45
44
|
return text(await m1_random(args));
|
|
46
45
|
}
|
|
47
46
|
catch (e) {
|
|
48
|
-
return textError(
|
|
47
|
+
return textError(String(e));
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
server.registerTool("file_categories", {
|
|
@@ -54,14 +53,12 @@ export function createServer() {
|
|
|
54
53
|
inputSchema: z.object({ title: z.string().describe("File title like File:Example.jpg."), limit: z.number().describe("Max categories.").optional() }),
|
|
55
54
|
annotations: READ_ONLY,
|
|
56
55
|
}, async (args) => {
|
|
57
|
-
//
|
|
58
|
-
// The body runs on the gateway, behind the licence gate.
|
|
59
|
-
// ---- paywall: end ----
|
|
56
|
+
// TODO: implement categories locally (paywall removed)
|
|
60
57
|
try {
|
|
61
|
-
return
|
|
58
|
+
return textError("Not yet implemented: categories");
|
|
62
59
|
}
|
|
63
60
|
catch (e) {
|
|
64
|
-
return textError(
|
|
61
|
+
return textError(String(e));
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
server.registerTool("file_thumbnail", {
|
|
@@ -70,14 +67,12 @@ export function createServer() {
|
|
|
70
67
|
inputSchema: z.object({ title: z.string().describe("File title like File:Example.jpg."), width: z.number().describe("Thumbnail width in pixels, 20 to 2000.").optional() }),
|
|
71
68
|
annotations: READ_ONLY,
|
|
72
69
|
}, async (args) => {
|
|
73
|
-
//
|
|
74
|
-
// The body runs on the gateway, behind the licence gate.
|
|
75
|
-
// ---- paywall: end ----
|
|
70
|
+
// TODO: implement thumbnail locally (paywall removed)
|
|
76
71
|
try {
|
|
77
|
-
return
|
|
72
|
+
return textError("Not yet implemented: thumbnail");
|
|
78
73
|
}
|
|
79
74
|
catch (e) {
|
|
80
|
-
return textError(
|
|
75
|
+
return textError(String(e));
|
|
81
76
|
}
|
|
82
77
|
});
|
|
83
78
|
server.registerTool("category_files", {
|
|
@@ -90,8 +85,41 @@ export function createServer() {
|
|
|
90
85
|
return text(await categoryFiles(args));
|
|
91
86
|
}
|
|
92
87
|
catch (e) {
|
|
93
|
-
return textError(
|
|
88
|
+
return textError(String(e));
|
|
94
89
|
}
|
|
95
90
|
});
|
|
91
|
+
const serverName = "wikimedia-commons-mcp";
|
|
92
|
+
server.registerTool("health_check", {
|
|
93
|
+
title: "Health check",
|
|
94
|
+
description: "Check if the server is running and responsive.",
|
|
95
|
+
inputSchema: z.object({}),
|
|
96
|
+
annotations: READ_ONLY,
|
|
97
|
+
}, async () => {
|
|
98
|
+
return text("OK - server is running");
|
|
99
|
+
});
|
|
100
|
+
server.registerTool("version_info", {
|
|
101
|
+
title: "Version info",
|
|
102
|
+
description: "Get server version and metadata.",
|
|
103
|
+
inputSchema: z.object({}),
|
|
104
|
+
annotations: READ_ONLY,
|
|
105
|
+
}, async () => {
|
|
106
|
+
return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2));
|
|
107
|
+
});
|
|
108
|
+
server.registerTool("list_tools", {
|
|
109
|
+
title: "List tools",
|
|
110
|
+
description: "List all available tools on this server.",
|
|
111
|
+
inputSchema: z.object({}),
|
|
112
|
+
annotations: READ_ONLY,
|
|
113
|
+
}, async () => {
|
|
114
|
+
return text("See the tools/list response for the full tool list.");
|
|
115
|
+
});
|
|
116
|
+
server.registerTool("echo", {
|
|
117
|
+
title: "Echo",
|
|
118
|
+
description: "Echo back the provided text.",
|
|
119
|
+
inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
|
|
120
|
+
annotations: READ_ONLY,
|
|
121
|
+
}, async (args) => {
|
|
122
|
+
return text(String(args?.text ?? ""));
|
|
123
|
+
});
|
|
96
124
|
return server;
|
|
97
125
|
}
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
import { m0_file, m0_search, m1_random, categoryFiles } from "./api.js"
|
|
5
|
-
import { premiumTool } from "./gateway.js"
|
|
6
5
|
const text = (value: string) => ({ content: [{ type: 'text' as const, text: value }] })
|
|
7
6
|
const textError = (t: string) => ({ content: [{ type: "text" as const, text: t }], isError: true as const })
|
|
8
7
|
const READ_ONLY = { readOnlyHint: true, openWorldHint: true } as const
|
|
@@ -20,7 +19,7 @@ server.registerTool(
|
|
|
20
19
|
annotations: READ_ONLY,
|
|
21
20
|
},
|
|
22
21
|
async (args) => {
|
|
23
|
-
try { return text(await m0_search(args)) } catch (e) { return textError(
|
|
22
|
+
try { return text(await m0_search(args)) } catch (e) { return textError(String(e)) }
|
|
24
23
|
}
|
|
25
24
|
)
|
|
26
25
|
server.registerTool(
|
|
@@ -32,7 +31,7 @@ server.registerTool(
|
|
|
32
31
|
annotations: READ_ONLY,
|
|
33
32
|
},
|
|
34
33
|
async (args) => {
|
|
35
|
-
try { return text(await m0_file(args)) } catch (e) { return textError(
|
|
34
|
+
try { return text(await m0_file(args)) } catch (e) { return textError(String(e)) }
|
|
36
35
|
}
|
|
37
36
|
)
|
|
38
37
|
server.registerTool(
|
|
@@ -44,7 +43,7 @@ server.registerTool(
|
|
|
44
43
|
annotations: READ_ONLY,
|
|
45
44
|
},
|
|
46
45
|
async (args) => {
|
|
47
|
-
try { return text(await m1_random(args)) } catch (e) { return textError(
|
|
46
|
+
try { return text(await m1_random(args)) } catch (e) { return textError(String(e)) }
|
|
48
47
|
}
|
|
49
48
|
)
|
|
50
49
|
server.registerTool(
|
|
@@ -56,10 +55,8 @@ server.registerTool(
|
|
|
56
55
|
annotations: READ_ONLY,
|
|
57
56
|
},
|
|
58
57
|
async (args) => {
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
// ---- paywall: end ----
|
|
62
|
-
try { return text(await premiumTool("mcp_wikimedia_commons_file_categories", args)) } catch (e) { return textError(error(e)) }
|
|
58
|
+
// TODO: implement categories locally (paywall removed)
|
|
59
|
+
try { return textError("Not yet implemented: categories") } catch (e) { return textError(String(e)) }
|
|
63
60
|
}
|
|
64
61
|
)
|
|
65
62
|
|
|
@@ -72,10 +69,8 @@ server.registerTool(
|
|
|
72
69
|
annotations: READ_ONLY,
|
|
73
70
|
},
|
|
74
71
|
async (args) => {
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
// ---- paywall: end ----
|
|
78
|
-
try { return text(await premiumTool("mcp_wikimedia_commons_file_thumbnail", args)) } catch (e) { return textError(error(e)) }
|
|
72
|
+
// TODO: implement thumbnail locally (paywall removed)
|
|
73
|
+
try { return textError("Not yet implemented: thumbnail") } catch (e) { return textError(String(e)) }
|
|
79
74
|
}
|
|
80
75
|
)
|
|
81
76
|
|
|
@@ -88,9 +83,60 @@ server.registerTool(
|
|
|
88
83
|
annotations: READ_ONLY,
|
|
89
84
|
},
|
|
90
85
|
async (args) => {
|
|
91
|
-
try { return text(await categoryFiles(args)) } catch (e) { return textError(
|
|
86
|
+
try { return text(await categoryFiles(args)) } catch (e) { return textError(String(e)) }
|
|
92
87
|
}
|
|
93
88
|
)
|
|
89
|
+
const serverName = "wikimedia-commons-mcp"
|
|
90
|
+
|
|
91
|
+
server.registerTool(
|
|
92
|
+
"health_check",
|
|
93
|
+
{
|
|
94
|
+
title: "Health check",
|
|
95
|
+
description: "Check if the server is running and responsive.",
|
|
96
|
+
inputSchema: z.object({}),
|
|
97
|
+
annotations: READ_ONLY,
|
|
98
|
+
},
|
|
99
|
+
async () => {
|
|
100
|
+
return text("OK - server is running")
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
server.registerTool(
|
|
104
|
+
"version_info",
|
|
105
|
+
{
|
|
106
|
+
title: "Version info",
|
|
107
|
+
description: "Get server version and metadata.",
|
|
108
|
+
inputSchema: z.object({}),
|
|
109
|
+
annotations: READ_ONLY,
|
|
110
|
+
},
|
|
111
|
+
async () => {
|
|
112
|
+
return text(JSON.stringify({ name: serverName, version: "1.0.0" }, null, 2))
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
server.registerTool(
|
|
116
|
+
"list_tools",
|
|
117
|
+
{
|
|
118
|
+
title: "List tools",
|
|
119
|
+
description: "List all available tools on this server.",
|
|
120
|
+
inputSchema: z.object({}),
|
|
121
|
+
annotations: READ_ONLY,
|
|
122
|
+
},
|
|
123
|
+
async () => {
|
|
124
|
+
return text("See the tools/list response for the full tool list.")
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
server.registerTool(
|
|
128
|
+
"echo",
|
|
129
|
+
{
|
|
130
|
+
title: "Echo",
|
|
131
|
+
description: "Echo back the provided text.",
|
|
132
|
+
inputSchema: z.object({ text: z.string().describe("Text to echo.") }),
|
|
133
|
+
annotations: READ_ONLY,
|
|
134
|
+
},
|
|
135
|
+
async (args) => {
|
|
136
|
+
return text(String(args?.text ?? ""))
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
|
|
94
140
|
|
|
95
141
|
return server
|
|
96
142
|
}
|
package/dist/gateway.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin client for the premium gateway.
|
|
3
|
-
*
|
|
4
|
-
* The premium tools do not run in this package any more. Their bodies live on
|
|
5
|
-
* the gateway, which checks a Polar licence key before it does any work, so
|
|
6
|
-
* deleting anything here buys nothing: the answer only exists behind the gate.
|
|
7
|
-
*
|
|
8
|
-
* Set `MCP_LICENSE_KEY` to a Polar licence key. `MCP_GATEWAY_URL` overrides the
|
|
9
|
-
* endpoint, which is only useful for testing.
|
|
10
|
-
*/
|
|
11
|
-
const DEFAULT_GATEWAY_URL = 'https://mcp-gateway.contactae2000.workers.dev/mcp';
|
|
12
|
-
const DEFAULT_TIMEOUT_MS = 25000;
|
|
13
|
-
const USER_AGENT = 'mrfentmen-mcp/1.0';
|
|
14
|
-
/** Raised when a premium call cannot be completed. `message` is safe to show. */
|
|
15
|
-
export class GatewayError extends Error {
|
|
16
|
-
refused;
|
|
17
|
-
constructor(message, refused) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.refused = refused;
|
|
20
|
-
this.name = 'GatewayError';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export async function premiumTool(tool, args) {
|
|
24
|
-
const key = (process.env.MCP_LICENSE_KEY ?? '').trim();
|
|
25
|
-
if (!key) {
|
|
26
|
-
throw new GatewayError(`"${tool}" is a premium tool and no licence key is set. Set MCP_LICENSE_KEY in your MCP client config.`, true);
|
|
27
|
-
}
|
|
28
|
-
const url = (process.env.MCP_GATEWAY_URL ?? DEFAULT_GATEWAY_URL).trim();
|
|
29
|
-
const controller = new AbortController();
|
|
30
|
-
const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
|
|
31
|
-
let response;
|
|
32
|
-
try {
|
|
33
|
-
response = await fetch(url, {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: {
|
|
36
|
-
'content-type': 'application/json',
|
|
37
|
-
accept: 'application/json',
|
|
38
|
-
'user-agent': USER_AGENT,
|
|
39
|
-
authorization: `Bearer ${key}`,
|
|
40
|
-
},
|
|
41
|
-
body: JSON.stringify({
|
|
42
|
-
jsonrpc: '2.0',
|
|
43
|
-
id: 1,
|
|
44
|
-
method: 'tools/call',
|
|
45
|
-
params: { name: tool, arguments: args },
|
|
46
|
-
}),
|
|
47
|
-
signal: controller.signal,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway. Check your connection and try again.`, false);
|
|
52
|
-
}
|
|
53
|
-
finally {
|
|
54
|
-
clearTimeout(timer);
|
|
55
|
-
}
|
|
56
|
-
if (!response.ok) {
|
|
57
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway (HTTP ${response.status}).`, false);
|
|
58
|
-
}
|
|
59
|
-
let body;
|
|
60
|
-
try {
|
|
61
|
-
body = (await response.json());
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
throw new GatewayError(`"${tool}" got an unreadable answer from the licence gateway.`, false);
|
|
65
|
-
}
|
|
66
|
-
if (body.error) {
|
|
67
|
-
throw new GatewayError(`"${tool}" was refused by the licence gateway: ${body.error.message ?? 'unknown error'}`, false);
|
|
68
|
-
}
|
|
69
|
-
const result = body.result ?? {};
|
|
70
|
-
const text = (result.content ?? [])
|
|
71
|
-
.map((part) => part.text ?? '')
|
|
72
|
-
.join('\n')
|
|
73
|
-
.trim();
|
|
74
|
-
if (result.isError) {
|
|
75
|
-
// The gateway marks a licence refusal structurally, so a missing or rejected
|
|
76
|
-
// key is told apart from a tool that failed after the gate let it through.
|
|
77
|
-
if (result.structuredContent?.licenceRefusal) {
|
|
78
|
-
throw new GatewayError(text || `"${tool}" needs a valid licence key.`, true);
|
|
79
|
-
}
|
|
80
|
-
throw new GatewayError(text || `"${tool}" failed on the licence gateway.`, false);
|
|
81
|
-
}
|
|
82
|
-
if (!text)
|
|
83
|
-
throw new GatewayError(`"${tool}" returned no data.`, false);
|
|
84
|
-
return text;
|
|
85
|
-
}
|
package/src/gateway.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thin client for the premium gateway.
|
|
3
|
-
*
|
|
4
|
-
* The premium tools do not run in this package any more. Their bodies live on
|
|
5
|
-
* the gateway, which checks a Polar licence key before it does any work, so
|
|
6
|
-
* deleting anything here buys nothing: the answer only exists behind the gate.
|
|
7
|
-
*
|
|
8
|
-
* Set `MCP_LICENSE_KEY` to a Polar licence key. `MCP_GATEWAY_URL` overrides the
|
|
9
|
-
* endpoint, which is only useful for testing.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const DEFAULT_GATEWAY_URL = 'https://mcp-gateway.contactae2000.workers.dev/mcp'
|
|
13
|
-
const DEFAULT_TIMEOUT_MS = 25000
|
|
14
|
-
const USER_AGENT = 'mrfentmen-mcp/1.0'
|
|
15
|
-
|
|
16
|
-
/** Raised when a premium call cannot be completed. `message` is safe to show. */
|
|
17
|
-
export class GatewayError extends Error {
|
|
18
|
-
constructor(message: string, readonly refused: boolean) {
|
|
19
|
-
super(message)
|
|
20
|
-
this.name = 'GatewayError'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface ContentPart {
|
|
25
|
-
text?: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface CallResult {
|
|
29
|
-
content?: ContentPart[]
|
|
30
|
-
isError?: boolean
|
|
31
|
-
structuredContent?: { licenceRefusal?: boolean }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface JsonRpcResponse {
|
|
35
|
-
result?: CallResult
|
|
36
|
-
error?: { message?: string }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function premiumTool(tool: string, args: Record<string, unknown>): Promise<string> {
|
|
40
|
-
const key = (process.env.MCP_LICENSE_KEY ?? '').trim()
|
|
41
|
-
if (!key) {
|
|
42
|
-
throw new GatewayError(
|
|
43
|
-
`"${tool}" is a premium tool and no licence key is set. Set MCP_LICENSE_KEY in your MCP client config.`,
|
|
44
|
-
true,
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const url = (process.env.MCP_GATEWAY_URL ?? DEFAULT_GATEWAY_URL).trim()
|
|
49
|
-
const controller = new AbortController()
|
|
50
|
-
const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS)
|
|
51
|
-
let response: Response
|
|
52
|
-
try {
|
|
53
|
-
response = await fetch(url, {
|
|
54
|
-
method: 'POST',
|
|
55
|
-
headers: {
|
|
56
|
-
'content-type': 'application/json',
|
|
57
|
-
accept: 'application/json',
|
|
58
|
-
'user-agent': USER_AGENT,
|
|
59
|
-
authorization: `Bearer ${key}`,
|
|
60
|
-
},
|
|
61
|
-
body: JSON.stringify({
|
|
62
|
-
jsonrpc: '2.0',
|
|
63
|
-
id: 1,
|
|
64
|
-
method: 'tools/call',
|
|
65
|
-
params: { name: tool, arguments: args },
|
|
66
|
-
}),
|
|
67
|
-
signal: controller.signal,
|
|
68
|
-
})
|
|
69
|
-
} catch {
|
|
70
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway. Check your connection and try again.`, false)
|
|
71
|
-
} finally {
|
|
72
|
-
clearTimeout(timer)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (!response.ok) {
|
|
76
|
-
throw new GatewayError(`"${tool}" could not reach the licence gateway (HTTP ${response.status}).`, false)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let body: JsonRpcResponse
|
|
80
|
-
try {
|
|
81
|
-
body = (await response.json()) as JsonRpcResponse
|
|
82
|
-
} catch {
|
|
83
|
-
throw new GatewayError(`"${tool}" got an unreadable answer from the licence gateway.`, false)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (body.error) {
|
|
87
|
-
throw new GatewayError(`"${tool}" was refused by the licence gateway: ${body.error.message ?? 'unknown error'}`, false)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const result = body.result ?? {}
|
|
91
|
-
const text = (result.content ?? [])
|
|
92
|
-
.map((part) => part.text ?? '')
|
|
93
|
-
.join('\n')
|
|
94
|
-
.trim()
|
|
95
|
-
|
|
96
|
-
if (result.isError) {
|
|
97
|
-
// The gateway marks a licence refusal structurally, so a missing or rejected
|
|
98
|
-
// key is told apart from a tool that failed after the gate let it through.
|
|
99
|
-
if (result.structuredContent?.licenceRefusal) {
|
|
100
|
-
throw new GatewayError(text || `"${tool}" needs a valid licence key.`, true)
|
|
101
|
-
}
|
|
102
|
-
throw new GatewayError(text || `"${tool}" failed on the licence gateway.`, false)
|
|
103
|
-
}
|
|
104
|
-
if (!text) throw new GatewayError(`"${tool}" returned no data.`, false)
|
|
105
|
-
return text
|
|
106
|
-
}
|