@plune-ai/cli 0.39.13 → 0.39.14
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 +13 -1
- package/dist/cli.cjs +65 -21
- package/dist/{execute-CR3Ixbxj.d.cts → execute-DLNnhkEM.d.cts} +13 -3
- package/dist/{execute-CR3Ixbxj.d.ts → execute-DLNnhkEM.d.ts} +13 -3
- package/dist/mcp-http.cjs +24 -15
- package/dist/mcp-http.d.cts +3 -2
- package/dist/mcp-http.d.ts +3 -2
- package/dist/mcp-http.js +24 -15
- package/dist/mcp-tools.cjs +14 -9
- package/dist/mcp-tools.d.cts +1 -1
- package/dist/mcp-tools.d.ts +1 -1
- package/dist/mcp-tools.js +14 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ the last resort, used only when `PLUNE_TOKEN` is set nowhere else. Nothing write
|
|
|
125
125
|
| `plune init` | Scaffold `plune.yaml`, a sample dataset, and `.env.example`. Flags: `--yes` (non-interactive), `--force`, `--from-openai-eval <eval.json>` (build it from an exported OpenAI eval). |
|
|
126
126
|
| `plune login` | Save a [Plune platform](https://plune.ai/platform) API token so `sync` and `ingest` can reach it. The token is **checked against the API before it is saved**, so a wrong one fails here rather than two commands later. Get one at `https://beta.plune.ai` → Account → API tokens. Flags: `--token <token>` (omit to paste it or pipe it via stdin), `--skip-verify` (save without checking, for offline setup). In CI, skip this step: every platform command reads `PLUNE_TOKEN` from the environment first, and the saved login only when it is not set. |
|
|
127
127
|
| `plune logout` | Remove the saved token. |
|
|
128
|
-
| `plune mcp serve` | Serve the Plune tools to an AI agent (Claude Code, Codex, any MCP client) over **MCP stdio**. See [Plune tools for AI agents](#plune-tools-for-ai-agents-plune-mcp). Flags: `--project <id>` (default `PLUNE_PROJECT`), `--read-only` (offer only the read tools). |
|
|
128
|
+
| `plune mcp serve` | Serve the Plune tools to an AI agent (Claude Code, Codex, any MCP client) over **MCP stdio**. See [Plune tools for AI agents](#plune-tools-for-ai-agents-plune-mcp). Flags: `--project <id>` (default `PLUNE_PROJECT`), `--read-only` (offer only the read tools), `--disable-tool <name>` (switch one tool off; repeatable). |
|
|
129
129
|
| `plune mcp check` | Check that **any** MCP server starts and answers: handshake, protocol version, capabilities, the lists, `ping`. See [Is the server alive](#is-the-server-alive-plune-mcp-check). Flags: `--check-timeout <duration>`, `--wait <duration>`, `--smoke` (with `--smoke-limit`, `--smoke-timeout`, `--budget`, `--allow-write-calls`), `--out [<format>=]<path>` (repeatable), `--reporter junit-xml`, `--format human\|json\|github\|markdown`, and the connection flags. Exit `0` healthy, `1` a check failed, `2` the server did not start, could not be reached or wants credentials, or a flag is wrong, `3` something could not be measured. |
|
|
130
130
|
| `plune mcp lint` | Check the tool list of **any** MCP server for what confuses a model — no account, no model. See [Checking any MCP server](#checking-any-mcp-server-plune-mcp-lint). Flags: `--fail-on error\|warn\|info\|never`, `--show-info`, `--format human\|json\|github\|markdown`, `--reporter junit-xml`, `--out [<format>=]<path>`, `--ignore-file <path>`, `--list-rules`, `--call`, `--call-limit <n>`, `--call-timeout <duration>`, and the connection flags (`--url`, `--header-env`, `--env`, …). Exit `0` clean, `1` findings, `2` the server did not start or a flag is wrong, `3` nothing measured. |
|
|
131
131
|
| `plune mcp snapshot` | Write the contract of **any** MCP server — tools, resources, resource templates, prompts, capabilities, instructions — as one stable JSON file to commit. See [Contract snapshots](#contract-snapshots-plune-mcp-snapshot-and-plune-mcp-diff). Flags: `--out <path>` (default stdout), `--push` with `--server <id>` or `--server-name <name>` and optional `--environment <text>` (send it to the platform's MCP catalog; nothing is sent without `--push`), and the connection flags. Exit `0` written (or sent), `1` with `--push` the platform could not be reached (the snapshot is kept in a file), `2` the server did not start, a declared list could not be read, or the platform refused the push (login, body, quota), `3` the server lists nothing. |
|
|
@@ -740,6 +740,18 @@ The server reads the token the way every platform command does: `PLUNE_TOKEN` fr
|
|
|
740
740
|
(set it in the client's `env` block), else the login `plune login` saved. A read token, or
|
|
741
741
|
`--read-only`, offers only the read tools.
|
|
742
742
|
|
|
743
|
+
`--disable-tool <name>` switches one tool off, and can be given several times: the tool is not in the
|
|
744
|
+
tool list, `plune_discover_tools` neither lists nor reveals it, and a call by its name is answered with
|
|
745
|
+
a tool error (code `tool_disabled`) that says it is switched off, before anything is sent to Plune, a
|
|
746
|
+
`dry_run` included. `plune_discover_tools` itself leaves the list once every tool it could find is off.
|
|
747
|
+
A name that is not a Plune tool ends the command with exit `2` and the list of names. Switching a tool
|
|
748
|
+
off hides that tool, not the API route behind it: `plune_api_request` can still reach any route the
|
|
749
|
+
token may use, so switch it off too, or use `--read-only`, when the point is to stop changes.
|
|
750
|
+
|
|
751
|
+
```bash
|
|
752
|
+
claude mcp add plune -- npx -y @plune-ai/cli mcp serve --disable-tool plune_api_request --disable-tool plune_cases_update
|
|
753
|
+
```
|
|
754
|
+
|
|
743
755
|
`plune_project_context`, the call an agent starts with, also answers `memoryRules`: the rules of the
|
|
744
756
|
project's memory that a person accepted in the review queue and has not retired, each as its `id` and
|
|
745
757
|
`text`, for the agent to follow without asking again. A rule that is only proposed, or was rejected, is
|
package/dist/cli.cjs
CHANGED
|
@@ -15183,13 +15183,13 @@ function pluneTool(name) {
|
|
|
15183
15183
|
function isPluneToolName(name) {
|
|
15184
15184
|
return BY_NAME.has(name);
|
|
15185
15185
|
}
|
|
15186
|
-
function offeredTo(tool2, scope) {
|
|
15187
|
-
|
|
15188
|
-
if (tool2
|
|
15189
|
-
return tool2.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t
|
|
15186
|
+
function offeredTo(tool2, scope, disabled = []) {
|
|
15187
|
+
const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
|
|
15188
|
+
if (refused(tool2)) return false;
|
|
15189
|
+
return tool2.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
|
|
15190
15190
|
}
|
|
15191
|
-
function defaultVisibleTools(scope) {
|
|
15192
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
15191
|
+
function defaultVisibleTools(scope, disabled = []) {
|
|
15192
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
|
|
15193
15193
|
}
|
|
15194
15194
|
var import_zod5, MAX_VISIBLE_TOOLS, define, measuredCost, listPage, missionId, projectId, PLUNE_TOOLS, PLUNE_TOOL_NAMES, BY_NAME;
|
|
15195
15195
|
var init_contract = __esm({
|
|
@@ -15662,11 +15662,12 @@ function createPluneToolExecutor(opts) {
|
|
|
15662
15662
|
const now = opts.now ?? Date.now;
|
|
15663
15663
|
const request = createPluneApi({ ...opts, sessionId });
|
|
15664
15664
|
let scope = opts.scope;
|
|
15665
|
+
const disabled = opts.disabledTools ?? [];
|
|
15665
15666
|
const revealed = /* @__PURE__ */ new Set();
|
|
15666
15667
|
const confirms = /* @__PURE__ */ new Map();
|
|
15667
15668
|
const visibleTools = () => {
|
|
15668
|
-
const core = defaultVisibleTools(scope);
|
|
15669
|
-
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
15669
|
+
const core = defaultVisibleTools(scope, disabled);
|
|
15670
|
+
const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
15670
15671
|
return [...core, ...extra];
|
|
15671
15672
|
};
|
|
15672
15673
|
async function call2(req) {
|
|
@@ -15866,13 +15867,15 @@ function createPluneToolExecutor(opts) {
|
|
|
15866
15867
|
const names = i["names"] ?? [];
|
|
15867
15868
|
const unknown = names.filter((n) => !isPluneToolName(n));
|
|
15868
15869
|
if (unknown.length > 0) return fail2("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
|
|
15870
|
+
const off = names.filter((n) => disabled.includes(n));
|
|
15871
|
+
if (off.length > 0) return fail2("tool_disabled", off.map(switchedOffMessage).join(" "));
|
|
15869
15872
|
const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
|
|
15870
15873
|
if (refused.length > 0) return fail2("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
|
|
15871
15874
|
const fixed = opts.fixedToolList === true;
|
|
15872
15875
|
if (!fixed) for (const n of names) revealed.add(n);
|
|
15873
15876
|
const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
15874
15877
|
const visible2 = visibleTools();
|
|
15875
|
-
const available = PLUNE_TOOLS.filter((t) => !visible2.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
15878
|
+
const available = PLUNE_TOOLS.filter((t) => !visible2.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
15876
15879
|
name: t.name,
|
|
15877
15880
|
title: t.title,
|
|
15878
15881
|
description: t.description,
|
|
@@ -15956,6 +15959,7 @@ function createPluneToolExecutor(opts) {
|
|
|
15956
15959
|
async execute(name, input) {
|
|
15957
15960
|
const handler = isPluneToolName(name) ? handlers[name] : void 0;
|
|
15958
15961
|
if (handler === void 0) return fail2("unknown_tool", `No such tool: ${name}.`);
|
|
15962
|
+
if (disabled.includes(name)) return fail2("tool_disabled", switchedOffMessage(name));
|
|
15959
15963
|
const tool2 = pluneTool(name);
|
|
15960
15964
|
const parsed4 = tool2.input.safeParse(input ?? {});
|
|
15961
15965
|
if (!parsed4.success) return fail2("invalid_input", `The input does not fit: ${zodMessage(parsed4.error)}`);
|
|
@@ -15971,7 +15975,7 @@ function createPluneToolExecutor(opts) {
|
|
|
15971
15975
|
}
|
|
15972
15976
|
};
|
|
15973
15977
|
}
|
|
15974
|
-
var import_node_crypto6, import_zod6, CONFIRM_TTL_MS, READ_ONLY_REFUSAL, NO_PROJECT, readScopeMessage, fail2, zodMessage, path22, withoutUndefined, asRecord, asArray, cursorOf, rawWrites;
|
|
15978
|
+
var import_node_crypto6, import_zod6, CONFIRM_TTL_MS, READ_ONLY_REFUSAL, NO_PROJECT, readScopeMessage, switchedOffMessage, fail2, zodMessage, path22, withoutUndefined, asRecord, asArray, cursorOf, rawWrites;
|
|
15975
15979
|
var init_execute = __esm({
|
|
15976
15980
|
"src/mcp-tools/execute.ts"() {
|
|
15977
15981
|
"use strict";
|
|
@@ -15985,6 +15989,7 @@ var init_execute = __esm({
|
|
|
15985
15989
|
READ_ONLY_REFUSAL = "read-only token";
|
|
15986
15990
|
NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
|
|
15987
15991
|
readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
|
|
15992
|
+
switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
|
|
15988
15993
|
fail2 = (code, message2, extra = {}) => ({
|
|
15989
15994
|
ok: false,
|
|
15990
15995
|
error: { code, message: message2, ...extra }
|
|
@@ -16003,6 +16008,21 @@ var init_execute = __esm({
|
|
|
16003
16008
|
});
|
|
16004
16009
|
|
|
16005
16010
|
// src/mcp-tools/index.ts
|
|
16011
|
+
var mcp_tools_exports = {};
|
|
16012
|
+
__export(mcp_tools_exports, {
|
|
16013
|
+
BATCH_MAX: () => BATCH_MAX2,
|
|
16014
|
+
CONFIRM_TTL_MS: () => CONFIRM_TTL_MS,
|
|
16015
|
+
MAX_VISIBLE_TOOLS: () => MAX_VISIBLE_TOOLS,
|
|
16016
|
+
PLUNE_TOOLS: () => PLUNE_TOOLS,
|
|
16017
|
+
PLUNE_TOOL_NAMES: () => PLUNE_TOOL_NAMES,
|
|
16018
|
+
PluneApiError: () => PluneApiError,
|
|
16019
|
+
PluneNetworkError: () => PluneNetworkError,
|
|
16020
|
+
createPluneToolExecutor: () => createPluneToolExecutor,
|
|
16021
|
+
defaultVisibleTools: () => defaultVisibleTools,
|
|
16022
|
+
isPluneToolName: () => isPluneToolName,
|
|
16023
|
+
offeredTo: () => offeredTo,
|
|
16024
|
+
pluneTool: () => pluneTool
|
|
16025
|
+
});
|
|
16006
16026
|
var init_mcp_tools = __esm({
|
|
16007
16027
|
"src/mcp-tools/index.ts"() {
|
|
16008
16028
|
"use strict";
|
|
@@ -16052,12 +16072,16 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
16052
16072
|
else if (!visible2.has(name) && tool2.enabled) tool2.disable();
|
|
16053
16073
|
}
|
|
16054
16074
|
};
|
|
16055
|
-
|
|
16075
|
+
const disabled = opts.disabledTools ?? [];
|
|
16076
|
+
let refusesByName = false;
|
|
16056
16077
|
for (const tool2 of PLUNE_TOOLS) {
|
|
16057
|
-
if (!offeredTo(tool2, opts.scope)) {
|
|
16058
|
-
if (tool2.
|
|
16078
|
+
if (!offeredTo(tool2, opts.scope, disabled)) {
|
|
16079
|
+
if (disabled.includes(tool2.name)) {
|
|
16080
|
+
server2.registerTool(tool2.name, { description: tool2.description }, async () => toResult(await executor.execute(tool2.name, {})));
|
|
16081
|
+
refusesByName = true;
|
|
16082
|
+
} else if (tool2.write) {
|
|
16059
16083
|
server2.registerTool(tool2.name, { description: tool2.description }, () => toResult(readOnlyRefusal(tool2.name)));
|
|
16060
|
-
|
|
16084
|
+
refusesByName = true;
|
|
16061
16085
|
}
|
|
16062
16086
|
continue;
|
|
16063
16087
|
}
|
|
@@ -16079,11 +16103,11 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
16079
16103
|
registered.set(tool2.name, handle);
|
|
16080
16104
|
}
|
|
16081
16105
|
if (fixed) {
|
|
16082
|
-
const tools2 = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
16106
|
+
const tools2 = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope, disabled).includes(t.name)).map(listed);
|
|
16083
16107
|
server2.server.setRequestHandler("tools/list", () => ({ tools: tools2 }));
|
|
16084
16108
|
} else {
|
|
16085
16109
|
sync();
|
|
16086
|
-
if (
|
|
16110
|
+
if (refusesByName)
|
|
16087
16111
|
server2.server.setRequestHandler("tools/list", () => ({
|
|
16088
16112
|
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
16089
16113
|
}));
|
|
@@ -16194,9 +16218,16 @@ var init_server = __esm({
|
|
|
16194
16218
|
// src/cli/commands/mcp.ts
|
|
16195
16219
|
var mcp_exports = {};
|
|
16196
16220
|
__export(mcp_exports, {
|
|
16221
|
+
NoSuchToolError: () => NoSuchToolError,
|
|
16197
16222
|
handleMcpServe: () => handleMcpServe
|
|
16198
16223
|
});
|
|
16199
16224
|
async function handleMcpServe(flags2, deps) {
|
|
16225
|
+
const disabledTools = (flags2.disableTool ?? []).map((n) => n.trim());
|
|
16226
|
+
if (disabledTools.length > 0) {
|
|
16227
|
+
const { PLUNE_TOOL_NAMES: PLUNE_TOOL_NAMES2, isPluneToolName: isPluneToolName2 } = await Promise.resolve().then(() => (init_mcp_tools(), mcp_tools_exports));
|
|
16228
|
+
const unknown = disabledTools.find((n) => !isPluneToolName2(n));
|
|
16229
|
+
if (unknown !== void 0) throw new NoSuchToolError(unknown, PLUNE_TOOL_NAMES2);
|
|
16230
|
+
}
|
|
16200
16231
|
const token2 = (deps.loadToken ?? loadToken)();
|
|
16201
16232
|
if (token2 === null) throw new NotLoggedInError();
|
|
16202
16233
|
const apiUrl = resolveApiUrl(deps.apiUrl);
|
|
@@ -16207,9 +16238,11 @@ async function handleMcpServe(flags2, deps) {
|
|
|
16207
16238
|
apiUrl,
|
|
16208
16239
|
version: deps.version,
|
|
16209
16240
|
...projectId2 !== void 0 ? { projectId: projectId2 } : {},
|
|
16210
|
-
...flags2.readOnly === true ? { scope: "read" } : {}
|
|
16241
|
+
...flags2.readOnly === true ? { scope: "read" } : {},
|
|
16242
|
+
...disabledTools.length > 0 ? { disabledTools } : {}
|
|
16211
16243
|
});
|
|
16212
16244
|
}
|
|
16245
|
+
var NoSuchToolError;
|
|
16213
16246
|
var init_mcp2 = __esm({
|
|
16214
16247
|
"src/cli/commands/mcp.ts"() {
|
|
16215
16248
|
"use strict";
|
|
@@ -16217,6 +16250,12 @@ var init_mcp2 = __esm({
|
|
|
16217
16250
|
init_credentials();
|
|
16218
16251
|
init_api_url();
|
|
16219
16252
|
init_sync();
|
|
16253
|
+
NoSuchToolError = class extends Error {
|
|
16254
|
+
constructor(name, tools2) {
|
|
16255
|
+
super(`no such tool: ${name}. The tools are: ${tools2.join(", ")}`);
|
|
16256
|
+
this.name = "NoSuchToolError";
|
|
16257
|
+
}
|
|
16258
|
+
};
|
|
16220
16259
|
}
|
|
16221
16260
|
});
|
|
16222
16261
|
|
|
@@ -37218,17 +37257,22 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
37218
37257
|
}
|
|
37219
37258
|
});
|
|
37220
37259
|
const mcp = program.command("mcp").description("Plune tools for AI agents over the Model Context Protocol");
|
|
37221
|
-
mcp.command("serve").description("Serve the Plune tools over MCP stdio, for Claude Code, Codex and other MCP clients").option("--project <id>", "Project the tools work in (default: PLUNE_PROJECT, else the token's own project)").option("--read-only", "Offer only the read tools, as for a read token", false).
|
|
37260
|
+
mcp.command("serve").description("Serve the Plune tools over MCP stdio, for Claude Code, Codex and other MCP clients").option("--project <id>", "Project the tools work in (default: PLUNE_PROJECT, else the token's own project)").option("--read-only", "Offer only the read tools, as for a read token", false).option(
|
|
37261
|
+
"--disable-tool <name>",
|
|
37262
|
+
"Switch one tool off: not listed, not found by plune_discover_tools, refused when called by its name (repeatable)",
|
|
37263
|
+
(val, prev) => [...prev, val],
|
|
37264
|
+
[]
|
|
37265
|
+
).action(async (options, command) => {
|
|
37222
37266
|
const verbose = command.optsWithGlobals().verbose === true;
|
|
37223
|
-
const { handleMcpServe: handleMcpServe2 } = await Promise.resolve().then(() => (init_mcp2(), mcp_exports));
|
|
37267
|
+
const { handleMcpServe: handleMcpServe2, NoSuchToolError: NoSuchToolError2 } = await Promise.resolve().then(() => (init_mcp2(), mcp_exports));
|
|
37224
37268
|
const { NotLoggedInError: NotLoggedInError2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
37225
37269
|
try {
|
|
37226
37270
|
await handleMcpServe2(
|
|
37227
|
-
{ project: options.project, readOnly: options.readOnly },
|
|
37271
|
+
{ project: options.project, readOnly: options.readOnly, disableTool: options.disableTool },
|
|
37228
37272
|
{ version: pkg.version }
|
|
37229
37273
|
);
|
|
37230
37274
|
} catch (err) {
|
|
37231
|
-
if (err instanceof NotLoggedInError2) {
|
|
37275
|
+
if (err instanceof NotLoggedInError2 || err instanceof NoSuchToolError2) {
|
|
37232
37276
|
process.stderr.write(`plune: ${err.message}
|
|
37233
37277
|
`);
|
|
37234
37278
|
process.exitCode = 2;
|
|
@@ -883,10 +883,13 @@ declare function isPluneToolName(name: string): name is PluneToolName;
|
|
|
883
883
|
/**
|
|
884
884
|
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
885
|
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*
|
|
887
|
+
* `disabled` names the tools switched off for this caller: none of them is offered, and discovery is offered only while
|
|
888
|
+
* a hidden tool is left for it to find. A name that is no tool is ignored.
|
|
886
889
|
*/
|
|
887
|
-
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
-
/** The tools a client is shown before it asks for more;
|
|
889
|
-
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
890
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write', disabled?: readonly string[]): boolean;
|
|
891
|
+
/** The tools a client is shown before it asks for more; only those it is offered (the scope, the tools switched off). */
|
|
892
|
+
declare function defaultVisibleTools(scope?: 'read' | 'write', disabled?: readonly string[]): PluneToolName[];
|
|
890
893
|
|
|
891
894
|
/**
|
|
892
895
|
* Runs a tool of the contract against the platform's HTTP API. Transport-free: the MCP server wraps it, and so can the
|
|
@@ -915,6 +918,13 @@ interface PluneToolExecutorOptions {
|
|
|
915
918
|
sessionId?: string | undefined;
|
|
916
919
|
/** The token's scope when it is known. `read` refuses every write before a request is made. */
|
|
917
920
|
scope?: TokenScope | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* Tools switched off for this caller, by name: none is shown, found by discover_tools or run, and a call to one by
|
|
923
|
+
* its name is refused with `tool_disabled` before any request. A name that is no tool is ignored (a host may hold a
|
|
924
|
+
* name from an older or newer tool set). It hides the tool, not the API route behind it: `plune_api_request` still
|
|
925
|
+
* reaches every route the token may use.
|
|
926
|
+
*/
|
|
927
|
+
disabledTools?: readonly string[] | undefined;
|
|
918
928
|
fetchImpl?: typeof fetch | undefined;
|
|
919
929
|
userAgent?: string | undefined;
|
|
920
930
|
now?: (() => number) | undefined;
|
|
@@ -883,10 +883,13 @@ declare function isPluneToolName(name: string): name is PluneToolName;
|
|
|
883
883
|
/**
|
|
884
884
|
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
885
|
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*
|
|
887
|
+
* `disabled` names the tools switched off for this caller: none of them is offered, and discovery is offered only while
|
|
888
|
+
* a hidden tool is left for it to find. A name that is no tool is ignored.
|
|
886
889
|
*/
|
|
887
|
-
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
-
/** The tools a client is shown before it asks for more;
|
|
889
|
-
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
890
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write', disabled?: readonly string[]): boolean;
|
|
891
|
+
/** The tools a client is shown before it asks for more; only those it is offered (the scope, the tools switched off). */
|
|
892
|
+
declare function defaultVisibleTools(scope?: 'read' | 'write', disabled?: readonly string[]): PluneToolName[];
|
|
890
893
|
|
|
891
894
|
/**
|
|
892
895
|
* Runs a tool of the contract against the platform's HTTP API. Transport-free: the MCP server wraps it, and so can the
|
|
@@ -915,6 +918,13 @@ interface PluneToolExecutorOptions {
|
|
|
915
918
|
sessionId?: string | undefined;
|
|
916
919
|
/** The token's scope when it is known. `read` refuses every write before a request is made. */
|
|
917
920
|
scope?: TokenScope | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* Tools switched off for this caller, by name: none is shown, found by discover_tools or run, and a call to one by
|
|
923
|
+
* its name is refused with `tool_disabled` before any request. A name that is no tool is ignored (a host may hold a
|
|
924
|
+
* name from an older or newer tool set). It hides the tool, not the API route behind it: `plune_api_request` still
|
|
925
|
+
* reaches every route the token may use.
|
|
926
|
+
*/
|
|
927
|
+
disabledTools?: readonly string[] | undefined;
|
|
918
928
|
fetchImpl?: typeof fetch | undefined;
|
|
919
929
|
userAgent?: string | undefined;
|
|
920
930
|
now?: (() => number) | undefined;
|
package/dist/mcp-http.cjs
CHANGED
|
@@ -730,13 +730,13 @@ function pluneTool(name) {
|
|
|
730
730
|
function isPluneToolName(name) {
|
|
731
731
|
return BY_NAME.has(name);
|
|
732
732
|
}
|
|
733
|
-
function offeredTo(tool, scope) {
|
|
734
|
-
|
|
735
|
-
if (tool
|
|
736
|
-
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t
|
|
733
|
+
function offeredTo(tool, scope, disabled = []) {
|
|
734
|
+
const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
|
|
735
|
+
if (refused(tool)) return false;
|
|
736
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
|
|
737
737
|
}
|
|
738
|
-
function defaultVisibleTools(scope) {
|
|
739
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
738
|
+
function defaultVisibleTools(scope, disabled = []) {
|
|
739
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
|
|
740
740
|
}
|
|
741
741
|
|
|
742
742
|
// src/mcp-tools/execute.ts
|
|
@@ -824,6 +824,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
|
|
|
824
824
|
var READ_ONLY_REFUSAL = "read-only token";
|
|
825
825
|
var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
|
|
826
826
|
var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
|
|
827
|
+
var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
|
|
827
828
|
var fail = (code, message, extra = {}) => ({
|
|
828
829
|
ok: false,
|
|
829
830
|
error: { code, message, ...extra }
|
|
@@ -880,11 +881,12 @@ function createPluneToolExecutor(opts) {
|
|
|
880
881
|
const now = opts.now ?? Date.now;
|
|
881
882
|
const request = createPluneApi({ ...opts, sessionId });
|
|
882
883
|
let scope = opts.scope;
|
|
884
|
+
const disabled = opts.disabledTools ?? [];
|
|
883
885
|
const revealed = /* @__PURE__ */ new Set();
|
|
884
886
|
const confirms = /* @__PURE__ */ new Map();
|
|
885
887
|
const visibleTools = () => {
|
|
886
|
-
const core = defaultVisibleTools(scope);
|
|
887
|
-
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
888
|
+
const core = defaultVisibleTools(scope, disabled);
|
|
889
|
+
const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
888
890
|
return [...core, ...extra];
|
|
889
891
|
};
|
|
890
892
|
async function call(req) {
|
|
@@ -1084,13 +1086,15 @@ function createPluneToolExecutor(opts) {
|
|
|
1084
1086
|
const names = i["names"] ?? [];
|
|
1085
1087
|
const unknown = names.filter((n) => !isPluneToolName(n));
|
|
1086
1088
|
if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
|
|
1089
|
+
const off = names.filter((n) => disabled.includes(n));
|
|
1090
|
+
if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
|
|
1087
1091
|
const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
|
|
1088
1092
|
if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
|
|
1089
1093
|
const fixed = opts.fixedToolList === true;
|
|
1090
1094
|
if (!fixed) for (const n of names) revealed.add(n);
|
|
1091
1095
|
const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
1092
1096
|
const visible = visibleTools();
|
|
1093
|
-
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1097
|
+
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1094
1098
|
name: t.name,
|
|
1095
1099
|
title: t.title,
|
|
1096
1100
|
description: t.description,
|
|
@@ -1174,6 +1178,7 @@ function createPluneToolExecutor(opts) {
|
|
|
1174
1178
|
async execute(name, input) {
|
|
1175
1179
|
const handler = isPluneToolName(name) ? handlers[name] : void 0;
|
|
1176
1180
|
if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
|
|
1181
|
+
if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
|
|
1177
1182
|
const tool = pluneTool(name);
|
|
1178
1183
|
const parsed = tool.input.safeParse(input ?? {});
|
|
1179
1184
|
if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
|
|
@@ -1243,12 +1248,16 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1243
1248
|
else if (!visible.has(name) && tool.enabled) tool.disable();
|
|
1244
1249
|
}
|
|
1245
1250
|
};
|
|
1246
|
-
|
|
1251
|
+
const disabled = opts.disabledTools ?? [];
|
|
1252
|
+
let refusesByName = false;
|
|
1247
1253
|
for (const tool of PLUNE_TOOLS) {
|
|
1248
|
-
if (!offeredTo(tool, opts.scope)) {
|
|
1249
|
-
if (tool.
|
|
1254
|
+
if (!offeredTo(tool, opts.scope, disabled)) {
|
|
1255
|
+
if (disabled.includes(tool.name)) {
|
|
1256
|
+
server.registerTool(tool.name, { description: tool.description }, async () => toResult(await executor.execute(tool.name, {})));
|
|
1257
|
+
refusesByName = true;
|
|
1258
|
+
} else if (tool.write) {
|
|
1250
1259
|
server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
|
|
1251
|
-
|
|
1260
|
+
refusesByName = true;
|
|
1252
1261
|
}
|
|
1253
1262
|
continue;
|
|
1254
1263
|
}
|
|
@@ -1270,11 +1279,11 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1270
1279
|
registered.set(tool.name, handle);
|
|
1271
1280
|
}
|
|
1272
1281
|
if (fixed) {
|
|
1273
|
-
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
1282
|
+
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope, disabled).includes(t.name)).map(listed);
|
|
1274
1283
|
server.server.setRequestHandler("tools/list", () => ({ tools }));
|
|
1275
1284
|
} else {
|
|
1276
1285
|
sync();
|
|
1277
|
-
if (
|
|
1286
|
+
if (refusesByName)
|
|
1278
1287
|
server.server.setRequestHandler("tools/list", () => ({
|
|
1279
1288
|
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
1280
1289
|
}));
|
package/dist/mcp-http.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as PluneToolExecutorOptions } from './execute-
|
|
1
|
+
import { d as PluneToolExecutorOptions } from './execute-DLNnhkEM.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -11,7 +11,8 @@ import 'zod';
|
|
|
11
11
|
* served by the SDK's stateless fallback, a 2026-07-28 one natively.
|
|
12
12
|
*
|
|
13
13
|
* The handler verifies nothing about the caller. The host does, and names the caller with every request: the API
|
|
14
|
-
* address, the token (or its own `fetchImpl`)
|
|
14
|
+
* address, the token (or its own `fetchImpl`), the scope and the tools switched off (`disabledTools`). Origin and Host
|
|
15
|
+
* checks belong in front of it too.
|
|
15
16
|
*/
|
|
16
17
|
interface PluneMcpHttpOptions {
|
|
17
18
|
/** The server version announced to clients. */
|
package/dist/mcp-http.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as PluneToolExecutorOptions } from './execute-
|
|
1
|
+
import { d as PluneToolExecutorOptions } from './execute-DLNnhkEM.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -11,7 +11,8 @@ import 'zod';
|
|
|
11
11
|
* served by the SDK's stateless fallback, a 2026-07-28 one natively.
|
|
12
12
|
*
|
|
13
13
|
* The handler verifies nothing about the caller. The host does, and names the caller with every request: the API
|
|
14
|
-
* address, the token (or its own `fetchImpl`)
|
|
14
|
+
* address, the token (or its own `fetchImpl`), the scope and the tools switched off (`disabledTools`). Origin and Host
|
|
15
|
+
* checks belong in front of it too.
|
|
15
16
|
*/
|
|
16
17
|
interface PluneMcpHttpOptions {
|
|
17
18
|
/** The server version announced to clients. */
|
package/dist/mcp-http.js
CHANGED
|
@@ -706,13 +706,13 @@ function pluneTool(name) {
|
|
|
706
706
|
function isPluneToolName(name) {
|
|
707
707
|
return BY_NAME.has(name);
|
|
708
708
|
}
|
|
709
|
-
function offeredTo(tool, scope) {
|
|
710
|
-
|
|
711
|
-
if (tool
|
|
712
|
-
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t
|
|
709
|
+
function offeredTo(tool, scope, disabled = []) {
|
|
710
|
+
const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
|
|
711
|
+
if (refused(tool)) return false;
|
|
712
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
|
|
713
713
|
}
|
|
714
|
-
function defaultVisibleTools(scope) {
|
|
715
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
714
|
+
function defaultVisibleTools(scope, disabled = []) {
|
|
715
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
|
|
716
716
|
}
|
|
717
717
|
|
|
718
718
|
// src/mcp-tools/execute.ts
|
|
@@ -800,6 +800,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
|
|
|
800
800
|
var READ_ONLY_REFUSAL = "read-only token";
|
|
801
801
|
var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
|
|
802
802
|
var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
|
|
803
|
+
var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
|
|
803
804
|
var fail = (code, message, extra = {}) => ({
|
|
804
805
|
ok: false,
|
|
805
806
|
error: { code, message, ...extra }
|
|
@@ -856,11 +857,12 @@ function createPluneToolExecutor(opts) {
|
|
|
856
857
|
const now = opts.now ?? Date.now;
|
|
857
858
|
const request = createPluneApi({ ...opts, sessionId });
|
|
858
859
|
let scope = opts.scope;
|
|
860
|
+
const disabled = opts.disabledTools ?? [];
|
|
859
861
|
const revealed = /* @__PURE__ */ new Set();
|
|
860
862
|
const confirms = /* @__PURE__ */ new Map();
|
|
861
863
|
const visibleTools = () => {
|
|
862
|
-
const core = defaultVisibleTools(scope);
|
|
863
|
-
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
864
|
+
const core = defaultVisibleTools(scope, disabled);
|
|
865
|
+
const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
864
866
|
return [...core, ...extra];
|
|
865
867
|
};
|
|
866
868
|
async function call(req) {
|
|
@@ -1060,13 +1062,15 @@ function createPluneToolExecutor(opts) {
|
|
|
1060
1062
|
const names = i["names"] ?? [];
|
|
1061
1063
|
const unknown = names.filter((n) => !isPluneToolName(n));
|
|
1062
1064
|
if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
|
|
1065
|
+
const off = names.filter((n) => disabled.includes(n));
|
|
1066
|
+
if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
|
|
1063
1067
|
const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
|
|
1064
1068
|
if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
|
|
1065
1069
|
const fixed = opts.fixedToolList === true;
|
|
1066
1070
|
if (!fixed) for (const n of names) revealed.add(n);
|
|
1067
1071
|
const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
1068
1072
|
const visible = visibleTools();
|
|
1069
|
-
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1073
|
+
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1070
1074
|
name: t.name,
|
|
1071
1075
|
title: t.title,
|
|
1072
1076
|
description: t.description,
|
|
@@ -1150,6 +1154,7 @@ function createPluneToolExecutor(opts) {
|
|
|
1150
1154
|
async execute(name, input) {
|
|
1151
1155
|
const handler = isPluneToolName(name) ? handlers[name] : void 0;
|
|
1152
1156
|
if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
|
|
1157
|
+
if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
|
|
1153
1158
|
const tool = pluneTool(name);
|
|
1154
1159
|
const parsed = tool.input.safeParse(input ?? {});
|
|
1155
1160
|
if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
|
|
@@ -1219,12 +1224,16 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1219
1224
|
else if (!visible.has(name) && tool.enabled) tool.disable();
|
|
1220
1225
|
}
|
|
1221
1226
|
};
|
|
1222
|
-
|
|
1227
|
+
const disabled = opts.disabledTools ?? [];
|
|
1228
|
+
let refusesByName = false;
|
|
1223
1229
|
for (const tool of PLUNE_TOOLS) {
|
|
1224
|
-
if (!offeredTo(tool, opts.scope)) {
|
|
1225
|
-
if (tool.
|
|
1230
|
+
if (!offeredTo(tool, opts.scope, disabled)) {
|
|
1231
|
+
if (disabled.includes(tool.name)) {
|
|
1232
|
+
server.registerTool(tool.name, { description: tool.description }, async () => toResult(await executor.execute(tool.name, {})));
|
|
1233
|
+
refusesByName = true;
|
|
1234
|
+
} else if (tool.write) {
|
|
1226
1235
|
server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
|
|
1227
|
-
|
|
1236
|
+
refusesByName = true;
|
|
1228
1237
|
}
|
|
1229
1238
|
continue;
|
|
1230
1239
|
}
|
|
@@ -1246,11 +1255,11 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1246
1255
|
registered.set(tool.name, handle);
|
|
1247
1256
|
}
|
|
1248
1257
|
if (fixed) {
|
|
1249
|
-
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
1258
|
+
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope, disabled).includes(t.name)).map(listed);
|
|
1250
1259
|
server.server.setRequestHandler("tools/list", () => ({ tools }));
|
|
1251
1260
|
} else {
|
|
1252
1261
|
sync();
|
|
1253
|
-
if (
|
|
1262
|
+
if (refusesByName)
|
|
1254
1263
|
server.server.setRequestHandler("tools/list", () => ({
|
|
1255
1264
|
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
1256
1265
|
}));
|
package/dist/mcp-tools.cjs
CHANGED
|
@@ -732,13 +732,13 @@ function pluneTool(name) {
|
|
|
732
732
|
function isPluneToolName(name) {
|
|
733
733
|
return BY_NAME.has(name);
|
|
734
734
|
}
|
|
735
|
-
function offeredTo(tool, scope) {
|
|
736
|
-
|
|
737
|
-
if (tool
|
|
738
|
-
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t
|
|
735
|
+
function offeredTo(tool, scope, disabled = []) {
|
|
736
|
+
const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
|
|
737
|
+
if (refused(tool)) return false;
|
|
738
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
|
|
739
739
|
}
|
|
740
|
-
function defaultVisibleTools(scope) {
|
|
741
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
740
|
+
function defaultVisibleTools(scope, disabled = []) {
|
|
741
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
|
|
742
742
|
}
|
|
743
743
|
|
|
744
744
|
// src/mcp-tools/execute.ts
|
|
@@ -826,6 +826,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
|
|
|
826
826
|
var READ_ONLY_REFUSAL = "read-only token";
|
|
827
827
|
var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
|
|
828
828
|
var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
|
|
829
|
+
var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
|
|
829
830
|
var fail = (code, message, extra = {}) => ({
|
|
830
831
|
ok: false,
|
|
831
832
|
error: { code, message, ...extra }
|
|
@@ -882,11 +883,12 @@ function createPluneToolExecutor(opts) {
|
|
|
882
883
|
const now = opts.now ?? Date.now;
|
|
883
884
|
const request = createPluneApi({ ...opts, sessionId });
|
|
884
885
|
let scope = opts.scope;
|
|
886
|
+
const disabled = opts.disabledTools ?? [];
|
|
885
887
|
const revealed = /* @__PURE__ */ new Set();
|
|
886
888
|
const confirms = /* @__PURE__ */ new Map();
|
|
887
889
|
const visibleTools = () => {
|
|
888
|
-
const core = defaultVisibleTools(scope);
|
|
889
|
-
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
890
|
+
const core = defaultVisibleTools(scope, disabled);
|
|
891
|
+
const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
890
892
|
return [...core, ...extra];
|
|
891
893
|
};
|
|
892
894
|
async function call(req) {
|
|
@@ -1086,13 +1088,15 @@ function createPluneToolExecutor(opts) {
|
|
|
1086
1088
|
const names = i["names"] ?? [];
|
|
1087
1089
|
const unknown = names.filter((n) => !isPluneToolName(n));
|
|
1088
1090
|
if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
|
|
1091
|
+
const off = names.filter((n) => disabled.includes(n));
|
|
1092
|
+
if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
|
|
1089
1093
|
const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
|
|
1090
1094
|
if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
|
|
1091
1095
|
const fixed = opts.fixedToolList === true;
|
|
1092
1096
|
if (!fixed) for (const n of names) revealed.add(n);
|
|
1093
1097
|
const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
1094
1098
|
const visible = visibleTools();
|
|
1095
|
-
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1099
|
+
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1096
1100
|
name: t.name,
|
|
1097
1101
|
title: t.title,
|
|
1098
1102
|
description: t.description,
|
|
@@ -1176,6 +1180,7 @@ function createPluneToolExecutor(opts) {
|
|
|
1176
1180
|
async execute(name, input) {
|
|
1177
1181
|
const handler = isPluneToolName(name) ? handlers[name] : void 0;
|
|
1178
1182
|
if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
|
|
1183
|
+
if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
|
|
1179
1184
|
const tool = pluneTool(name);
|
|
1180
1185
|
const parsed = tool.input.safeParse(input ?? {});
|
|
1181
1186
|
if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
|
package/dist/mcp-tools.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-
|
|
1
|
+
export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-DLNnhkEM.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/** The platform answered, with a status outside 2xx. */
|
package/dist/mcp-tools.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-
|
|
1
|
+
export { C as CONFIRM_TTL_MS, M as MAX_VISIBLE_TOOLS, P as PLUNE_TOOLS, a as PLUNE_TOOL_NAMES, b as PluneToolDefinition, c as PluneToolExecutor, d as PluneToolExecutorOptions, e as PluneToolName, T as TokenScope, f as ToolError, g as ToolOutcome, h as ToolVisibility, i as createPluneToolExecutor, j as defaultVisibleTools, k as isPluneToolName, o as offeredTo, p as pluneTool } from './execute-DLNnhkEM.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/** The platform answered, with a status outside 2xx. */
|
package/dist/mcp-tools.js
CHANGED
|
@@ -695,13 +695,13 @@ function pluneTool(name) {
|
|
|
695
695
|
function isPluneToolName(name) {
|
|
696
696
|
return BY_NAME.has(name);
|
|
697
697
|
}
|
|
698
|
-
function offeredTo(tool, scope) {
|
|
699
|
-
|
|
700
|
-
if (tool
|
|
701
|
-
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t
|
|
698
|
+
function offeredTo(tool, scope, disabled = []) {
|
|
699
|
+
const refused = (t) => disabled.includes(t.name) || scope === "read" && t.write;
|
|
700
|
+
if (refused(tool)) return false;
|
|
701
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !refused(t));
|
|
702
702
|
}
|
|
703
|
-
function defaultVisibleTools(scope) {
|
|
704
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
703
|
+
function defaultVisibleTools(scope, disabled = []) {
|
|
704
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope, disabled)).map((t) => t.name);
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
// src/mcp-tools/execute.ts
|
|
@@ -789,6 +789,7 @@ var CONFIRM_TTL_MS = 5 * 60 * 1e3;
|
|
|
789
789
|
var READ_ONLY_REFUSAL = "read-only token";
|
|
790
790
|
var NO_PROJECT = "projectId is needed: the server was started without a project (--project or PLUNE_PROJECT). plune_project_context lists the projects.";
|
|
791
791
|
var readScopeMessage = (what) => `This token has the read scope, so ${what}. Use a token with the write scope (Plune \u2192 Account \u2192 API tokens) and restart the server.`;
|
|
792
|
+
var switchedOffMessage = (name) => `\`${name}\` is switched off for this connection. Ask the person who connected Plune to switch it on.`;
|
|
792
793
|
var fail = (code, message, extra = {}) => ({
|
|
793
794
|
ok: false,
|
|
794
795
|
error: { code, message, ...extra }
|
|
@@ -845,11 +846,12 @@ function createPluneToolExecutor(opts) {
|
|
|
845
846
|
const now = opts.now ?? Date.now;
|
|
846
847
|
const request = createPluneApi({ ...opts, sessionId });
|
|
847
848
|
let scope = opts.scope;
|
|
849
|
+
const disabled = opts.disabledTools ?? [];
|
|
848
850
|
const revealed = /* @__PURE__ */ new Set();
|
|
849
851
|
const confirms = /* @__PURE__ */ new Map();
|
|
850
852
|
const visibleTools = () => {
|
|
851
|
-
const core = defaultVisibleTools(scope);
|
|
852
|
-
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
853
|
+
const core = defaultVisibleTools(scope, disabled);
|
|
854
|
+
const extra = [...revealed].filter((n) => !disabled.includes(n) && !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
853
855
|
return [...core, ...extra];
|
|
854
856
|
};
|
|
855
857
|
async function call(req) {
|
|
@@ -1049,13 +1051,15 @@ function createPluneToolExecutor(opts) {
|
|
|
1049
1051
|
const names = i["names"] ?? [];
|
|
1050
1052
|
const unknown = names.filter((n) => !isPluneToolName(n));
|
|
1051
1053
|
if (unknown.length > 0) return fail("invalid_input", `No such tool: ${unknown.join(", ")}. Call this tool without names to see what there is.`);
|
|
1054
|
+
const off = names.filter((n) => disabled.includes(n));
|
|
1055
|
+
if (off.length > 0) return fail("tool_disabled", off.map(switchedOffMessage).join(" "));
|
|
1052
1056
|
const refused = names.filter((n) => scope === "read" && pluneTool(n).write);
|
|
1053
1057
|
if (refused.length > 0) return fail("read_only_token", readScopeMessage(`${refused.join(", ")} cannot be switched on`));
|
|
1054
1058
|
const fixed = opts.fixedToolList === true;
|
|
1055
1059
|
if (!fixed) for (const n of names) revealed.add(n);
|
|
1056
1060
|
const words = (i["query"] ?? "").toLowerCase().split(/\s+/).filter(Boolean);
|
|
1057
1061
|
const visible = visibleTools();
|
|
1058
|
-
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1062
|
+
const available = PLUNE_TOOLS.filter((t) => !visible.includes(t.name) && !disabled.includes(t.name) && !(scope === "read" && t.write)).filter((t) => words.every((w) => `${t.name} ${t.title} ${t.description}`.toLowerCase().includes(w))).map((t) => ({
|
|
1059
1063
|
name: t.name,
|
|
1060
1064
|
title: t.title,
|
|
1061
1065
|
description: t.description,
|
|
@@ -1139,6 +1143,7 @@ function createPluneToolExecutor(opts) {
|
|
|
1139
1143
|
async execute(name, input) {
|
|
1140
1144
|
const handler = isPluneToolName(name) ? handlers[name] : void 0;
|
|
1141
1145
|
if (handler === void 0) return fail("unknown_tool", `No such tool: ${name}.`);
|
|
1146
|
+
if (disabled.includes(name)) return fail("tool_disabled", switchedOffMessage(name));
|
|
1142
1147
|
const tool = pluneTool(name);
|
|
1143
1148
|
const parsed = tool.input.safeParse(input ?? {});
|
|
1144
1149
|
if (!parsed.success) return fail("invalid_input", `The input does not fit: ${zodMessage(parsed.error)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/cli",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.14",
|
|
4
4
|
"mcpName": "ai.plune/cli",
|
|
5
5
|
"description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
|
|
6
6
|
"keywords": [
|