mc8yp 2.3.2 → 2.3.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/dist/cli.mjs +11 -11
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1545,7 +1545,7 @@ const consola = createConsola();
|
|
|
1545
1545
|
//#endregion
|
|
1546
1546
|
//#region package.json
|
|
1547
1547
|
var name = "mc8yp";
|
|
1548
|
-
var version = "2.3.
|
|
1548
|
+
var version = "2.3.3";
|
|
1549
1549
|
var description$1 = "Cumulocity IoT MCP Server - Model Context Protocol integration for IoT device management";
|
|
1550
1550
|
//#endregion
|
|
1551
1551
|
//#region \0virtual:core-openapi
|
|
@@ -165983,6 +165983,7 @@ async function query(functionCode) {
|
|
|
165983
165983
|
if (!result.ok) throw new Error(`Execution failed with code ${result.error.code}: ${result.error.message}`);
|
|
165984
165984
|
const value = extractDefaultExport(result.exports);
|
|
165985
165985
|
const body = typeof value === "string" ? value : JSON.stringify(value);
|
|
165986
|
+
if (c8yMcpServer.ctx.custom?.env !== "cli") return body;
|
|
165986
165987
|
const tenantUrl = c8yMcpServer.ctx.custom?.auth?.tenantUrl;
|
|
165987
165988
|
return `${body}\n\n---\n${tenantUrl ? `Query ran against tenant: ${tenantUrl}. Visible specs are everything currently available for that tenant.` : "Query ran against bundled OpenAPI snapshots only — no active tenant. Visibility here does NOT guarantee any service is installed on a tenant."}`;
|
|
165988
165989
|
}
|
|
@@ -166021,23 +166022,22 @@ function getOpenApiNote() {
|
|
|
166021
166022
|
return "This MCP exposes a bundled Cumulocity core OpenAPI snapshot. Use `coreSpec` for inventory, alarms, events, measurements, users, tenants, and the broader Cumulocity REST surface. Bundled and discovered microservice APIs available on the current tenant are exposed via `serviceSpecs` (keyed by contextPath).";
|
|
166022
166023
|
}
|
|
166023
166024
|
function getQuerySafetyPreface(env) {
|
|
166024
|
-
|
|
166025
|
-
|
|
166026
|
-
return [
|
|
166027
|
-
"**CLI mode — read first.** The active tenant is global to this CLI session and can be flipped between calls by `set-active-tenant`. Always check the footer line at the bottom of every result. If it says \"no active tenant\" you are looking at bundled reference snapshots — call `cli-status` to see stored credentials and `set-active-tenant` to connect before relying on the result.",
|
|
166028
|
-
"",
|
|
166029
|
-
sharedFooter
|
|
166030
|
-
].join("\n");
|
|
166025
|
+
if (env === "server") return "Searches the bundled and discovered OpenAPI specs available to the current connection.";
|
|
166026
|
+
return "**Read first.** The active tenant is global to this CLI session and can be flipped between calls by `set-active-tenant`. Every result ends with a footer line naming the active tenant (or noting there is none) so you can verify which tenant the result reflects before acting on it. If the footer says \"no active tenant\" you are looking at bundled reference snapshots — call `cli-status` to see stored credentials and `set-active-tenant` to connect before relying on the result.";
|
|
166031
166027
|
}
|
|
166032
166028
|
function getExecuteSafetyPreface(env) {
|
|
166033
166029
|
const sharedFooter = "An endpoint visible in `query` may still return 404 from `execute` when the service is not actually installed on the current tenant.";
|
|
166034
|
-
if (env
|
|
166030
|
+
if (env === "server") return sharedFooter;
|
|
166035
166031
|
return [
|
|
166036
|
-
"**
|
|
166032
|
+
"**Read first.** Every result starts with an `Executed against tenant: <url>` marker line followed by a blank line. Verify it matches the tenant you intend to mutate before reporting the result. The active tenant is global to this CLI session and can be flipped between calls by `set-active-tenant`. If no tenant is active `execute` fails with a missing-auth error — call `cli-status` and `set-active-tenant` to connect first.",
|
|
166037
166033
|
"",
|
|
166038
166034
|
sharedFooter
|
|
166039
166035
|
].join("\n");
|
|
166040
166036
|
}
|
|
166037
|
+
function getQueryResultDescription(env) {
|
|
166038
|
+
if (env === "server") return "If your function returns a string it is returned as-is. Any other value is returned as JSON.";
|
|
166039
|
+
return "If your function returns a string it is returned as-is. Any other value is returned as JSON. A footer line naming the active tenant (or noting there is none) is appended after a `---` separator on every successful result.";
|
|
166040
|
+
}
|
|
166041
166041
|
function createQueryTool(env) {
|
|
166042
166042
|
return defineTool({
|
|
166043
166043
|
name: "query",
|
|
@@ -166080,7 +166080,7 @@ declare const serviceSpecs: Record<string, Spec>
|
|
|
166080
166080
|
- \`coreSpec\` — the main Cumulocity REST surface. Always present.
|
|
166081
166081
|
- \`serviceSpecs\` — microservice APIs available on the active tenant, keyed by contextPath. An entry is **present iff** the service is reachable on this tenant. Paths are already prefixed (e.g. \`/service/myservice/items\`). Check with \`serviceSpecs.dtm\` (or \`'dtm' in serviceSpecs\`) before reaching in.
|
|
166082
166082
|
|
|
166083
|
-
|
|
166083
|
+
${getQueryResultDescription(env)}
|
|
166084
166084
|
The current MCP connection may still block \`execute\` calls even when an operation is visible in a spec.
|
|
166085
166085
|
|
|
166086
166086
|
Examples:
|