@mcp-abap-adt/calm-server 0.4.0 → 0.5.0
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/CHANGELOG.md +34 -0
- package/dist/server/connection/AbstractCalmConnection.d.ts.map +1 -1
- package/dist/server/connection/AbstractCalmConnection.js +32 -4
- package/dist/server/connection/AbstractCalmConnection.js.map +1 -1
- package/dist/tools/logs/getLogs.d.ts +4 -0
- package/dist/tools/logs/getLogs.d.ts.map +1 -1
- package/dist/tools/logs/getLogs.js +42 -6
- package/dist/tools/logs/getLogs.js.map +1 -1
- package/dist/tools/logs/otlpLogs.d.ts +11 -0
- package/dist/tools/logs/otlpLogs.d.ts.map +1 -0
- package/dist/tools/logs/otlpLogs.js +39 -0
- package/dist/tools/logs/otlpLogs.js.map +1 -0
- package/dist/tools/logs/otlpProto.d.ts +12 -0
- package/dist/tools/logs/otlpProto.d.ts.map +1 -0
- package/dist/tools/logs/otlpProto.js +67 -0
- package/dist/tools/logs/otlpProto.js.map +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 — 2026-05-26
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`calm_logs_get` now decodes the OTLP response into JSON.** The Cloud
|
|
8
|
+
ALM Logs API returns an OpenTelemetry `application/x-protobuf` body, not
|
|
9
|
+
JSON. The tool decodes it into canonical OTLP JSON under `records`
|
|
10
|
+
(`{ resourceLogs: [{ resource, scopeLogs: [{ scope, logRecords }] }] }`)
|
|
11
|
+
using an embedded minimal OTLP schema (`src/tools/logs/otlpProto.ts`) +
|
|
12
|
+
`protobufjs`. Verified live on tenant `eu10-004`: ABAP Application Log
|
|
13
|
+
records with `service.name`, `sap.exm.*` attributes decode correctly.
|
|
14
|
+
- **`calm_logs_get` gains `raw: true`** — returns the undecoded protobuf as
|
|
15
|
+
a base64 string with `encoding: "base64"`, for debugging or forwarding to
|
|
16
|
+
another OTLP consumer.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **The connection returns a `Buffer` for binary responses.**
|
|
21
|
+
`AbstractCalmConnection` previously read every body via `response.text()`,
|
|
22
|
+
which mangled protobuf bytes through UTF-8. It now reads the raw bytes and
|
|
23
|
+
returns a `Buffer` for non-textual Content-Types (e.g.
|
|
24
|
+
`application/x-protobuf`, `application/octet-stream`); JSON/text/XML
|
|
25
|
+
responses are decoded and parsed exactly as before. Response shaping
|
|
26
|
+
(OTLP→JSON) stays in the tool layer — the client remains transport-only.
|
|
27
|
+
|
|
28
|
+
## 0.4.1 — 2026-05-25
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Realign with `@mcp-abap-adt/calm-client@0.4.2`: `calm_logs_get` exposes an
|
|
33
|
+
optional `onLimit` (defaults to `truncate` in the client when
|
|
34
|
+
`limit`/`offset` is set, so paging no longer 403s). Corrected the
|
|
35
|
+
`period` (`<n>M` minutes, not `1h`) and `serviceId` parameter descriptions.
|
|
36
|
+
|
|
3
37
|
## 0.4.0 — 2026-05-24
|
|
4
38
|
|
|
5
39
|
Follows `@mcp-abap-adt/calm-client@0.4.0` (connection moved out of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractCalmConnection.d.ts","sourceRoot":"","sources":["../../../src/server/connection/AbstractCalmConnection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,OAAO,EACR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC,m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AmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IA+B/B,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,cAAc;YAQR,OAAO;CAwDtB"}
|
|
@@ -125,18 +125,32 @@ class AbstractCalmConnection {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
const response = await fetch(url, init);
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
// Read raw bytes once. Binary responses (e.g. the Logs OTLP
|
|
129
|
+
// `application/x-protobuf` payload) must keep their exact bytes —
|
|
130
|
+
// decoding through `response.text()` would mangle them via UTF-8 and
|
|
131
|
+
// make protobuf undecodable. Textual responses are decoded + JSON-parsed
|
|
132
|
+
// as before. Errors are always JSON/text, so decode them as text.
|
|
133
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
130
134
|
if (!response.ok) {
|
|
131
|
-
|
|
135
|
+
const text = bytes.toString('utf8');
|
|
136
|
+
const parsed = text ? safeJson(text) : undefined;
|
|
137
|
+
throw (0, calm_client_1.calmErrorFromBody)(response.status, parsed ?? text);
|
|
132
138
|
}
|
|
133
139
|
this.logger?.debug(`[calm] ${response.status} ${options.method} ${url}`);
|
|
134
140
|
const outHeaders = {};
|
|
135
141
|
response.headers.forEach((v, k) => {
|
|
136
142
|
outHeaders[k] = v;
|
|
137
143
|
});
|
|
144
|
+
let data;
|
|
145
|
+
if (isBinaryContentType(outHeaders['content-type'])) {
|
|
146
|
+
data = bytes.length ? bytes : undefined;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const text = bytes.toString('utf8');
|
|
150
|
+
data = text ? safeJson(text) : undefined;
|
|
151
|
+
}
|
|
138
152
|
return {
|
|
139
|
-
data:
|
|
153
|
+
data: data,
|
|
140
154
|
status: response.status,
|
|
141
155
|
statusText: response.statusText,
|
|
142
156
|
headers: outHeaders,
|
|
@@ -152,4 +166,18 @@ function safeJson(text) {
|
|
|
152
166
|
return text;
|
|
153
167
|
}
|
|
154
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* A response body is treated as raw bytes (returned as a `Buffer`) unless its
|
|
171
|
+
* Content-Type is textual. Anything that isn't JSON / text / XML / form data —
|
|
172
|
+
* notably `application/x-protobuf` and `application/octet-stream` — is binary.
|
|
173
|
+
*/
|
|
174
|
+
function isBinaryContentType(contentType) {
|
|
175
|
+
if (!contentType)
|
|
176
|
+
return false;
|
|
177
|
+
const ct = contentType.toLowerCase();
|
|
178
|
+
return !(ct.includes('json') ||
|
|
179
|
+
ct.startsWith('text/') ||
|
|
180
|
+
ct.includes('xml') ||
|
|
181
|
+
ct.includes('x-www-form-urlencoded'));
|
|
182
|
+
}
|
|
155
183
|
//# sourceMappingURL=AbstractCalmConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractCalmConnection.js","sourceRoot":"","sources":["../../../src/server/connection/AbstractCalmConnection.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAQ5E,mDAGyB;AAgBzB,SAAS,iBAAiB,CAAC,CAAS;IAClC,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AACD,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,OAAO,CAAC,IAAY,EAAE,IAAY;IACzC,IAAI,CAAC,IAAI;QAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;AAChE,CAAC;AACD,SAAS,aAAa,CAAC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/B,MAAM,EAAE,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,CAAC,CACN,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnB,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QACtB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAClB,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CACrC,CAAC;AACJ,CAAC"}
|
|
@@ -7,9 +7,13 @@ export interface IGetLogsArgs {
|
|
|
7
7
|
period?: string;
|
|
8
8
|
limit?: number;
|
|
9
9
|
offset?: number;
|
|
10
|
+
onLimit?: string;
|
|
11
|
+
raw?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export interface IGetLogsResult {
|
|
12
14
|
records: unknown;
|
|
15
|
+
/** Present only when the body was returned undecoded (`raw: true`). */
|
|
16
|
+
encoding?: 'base64';
|
|
13
17
|
}
|
|
14
18
|
export declare const getLogsTool: ICalmHandlerEntry<IGetLogsArgs, IGetLogsResult>;
|
|
15
19
|
//# sourceMappingURL=getLogs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLogs.d.ts","sourceRoot":"","sources":["../../../src/tools/logs/getLogs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getLogs.d.ts","sourceRoot":"","sources":["../../../src/tools/logs/getLogs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AA6FD,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAGvE,CAAC"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLogsTool = void 0;
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
|
+
const otlpLogs_1 = require("./otlpLogs");
|
|
5
6
|
const definition = {
|
|
6
7
|
name: 'calm_logs_get',
|
|
7
|
-
description: 'Fetch application logs from Cloud ALM Logs (OpenTelemetry-style). Unlike other Cloud ALM services, Logs uses a domain-specific REST query (not OData). `provider` is required; filter by `serviceId`, or a time window via `from`/`to` (ISO timestamps) or `period`.
|
|
8
|
+
description: 'Fetch application logs from Cloud ALM Logs (OpenTelemetry-style). Unlike other Cloud ALM services, Logs uses a domain-specific REST query (not OData). `provider` is required; filter by `serviceId`, or a time window via `from`/`to` (ISO timestamps) or `period`. The Logs API returns an OTLP `application/x-protobuf` body; this tool decodes it into canonical OTLP JSON under `records` (`{ resourceLogs: [...] }`). Set `raw: true` to instead get the undecoded protobuf as a base64 string.',
|
|
8
9
|
inputSchema: {
|
|
9
10
|
type: 'object',
|
|
10
11
|
required: ['provider'],
|
|
@@ -12,16 +13,29 @@ const definition = {
|
|
|
12
13
|
provider: { type: 'string', description: 'Log provider name.' },
|
|
13
14
|
serviceId: {
|
|
14
15
|
type: 'string',
|
|
15
|
-
description: '
|
|
16
|
+
description: 'Service id filter, emitted as a plain `serviceId` query param. The live Logs API requires it alongside `provider` and rejects a request without it (HTTP 428).',
|
|
16
17
|
},
|
|
17
18
|
from: { type: 'string', description: 'ISO timestamp, inclusive start.' },
|
|
18
19
|
to: { type: 'string', description: 'ISO timestamp, exclusive end.' },
|
|
19
20
|
period: {
|
|
20
21
|
type: 'string',
|
|
21
|
-
description: 'Period shorthand (e.g. "
|
|
22
|
+
description: 'Period shorthand in the Logs API format `<n>M` minutes (e.g. "10M" = last 10 minutes), NOT "1h"/"24h". Alternative to from/to. Wide windows can exceed the server count cap (HTTP 403) — narrow the period.',
|
|
23
|
+
},
|
|
24
|
+
limit: {
|
|
25
|
+
type: 'integer',
|
|
26
|
+
minimum: 1,
|
|
27
|
+
maximum: 1000,
|
|
28
|
+
description: 'Max records to return. The Logs API only honours this together with the count-cap strategy — the client auto-sets `onLimit="truncate"` when `limit` is given, so paging works out of the box.',
|
|
22
29
|
},
|
|
23
|
-
limit: { type: 'integer', minimum: 1, maximum: 1000 },
|
|
24
30
|
offset: { type: 'integer', minimum: 0 },
|
|
31
|
+
onLimit: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Server-side count-cap strategy. Defaults to "truncate" when `limit`/`offset` is set (the only value that returns data on a window over the cap; otherwise the API responds HTTP 403). Override only if you know another value the tenant accepts.',
|
|
34
|
+
},
|
|
35
|
+
raw: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
description: 'When true, return the undecoded OTLP protobuf body as a base64 string (with `encoding: "base64"`) instead of decoded JSON. For debugging or feeding another OTLP consumer.',
|
|
38
|
+
},
|
|
25
39
|
},
|
|
26
40
|
},
|
|
27
41
|
};
|
|
@@ -33,7 +47,7 @@ const handler = async (ctx, args) => {
|
|
|
33
47
|
});
|
|
34
48
|
}
|
|
35
49
|
try {
|
|
36
|
-
const
|
|
50
|
+
const body = await ctx.calm.getLogs().get({
|
|
37
51
|
provider: args.provider,
|
|
38
52
|
serviceId: args.serviceId,
|
|
39
53
|
from: args.from,
|
|
@@ -41,13 +55,35 @@ const handler = async (ctx, args) => {
|
|
|
41
55
|
period: args.period,
|
|
42
56
|
limit: args.limit,
|
|
43
57
|
offset: args.offset,
|
|
58
|
+
onLimit: args.onLimit,
|
|
44
59
|
});
|
|
45
|
-
|
|
60
|
+
// The Logs API returns OTLP `application/x-protobuf` (delivered as a
|
|
61
|
+
// Buffer by the connection) when there are records, and a plain JSON
|
|
62
|
+
// body (e.g. `{}`) when the window is empty. Decode the former into
|
|
63
|
+
// canonical OTLP JSON; pass anything non-binary through unchanged.
|
|
64
|
+
const bytes = asBytes(body);
|
|
65
|
+
if (!bytes) {
|
|
66
|
+
return { records: body };
|
|
67
|
+
}
|
|
68
|
+
if (args.raw) {
|
|
69
|
+
return {
|
|
70
|
+
records: Buffer.from(bytes).toString('base64'),
|
|
71
|
+
encoding: 'base64',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return { records: (0, otlpLogs_1.decodeOtlpLogs)(bytes) };
|
|
46
75
|
}
|
|
47
76
|
catch (err) {
|
|
48
77
|
throw (0, utils_1.mapCalmErrorForTool)(err);
|
|
49
78
|
}
|
|
50
79
|
};
|
|
80
|
+
function asBytes(body) {
|
|
81
|
+
if (Buffer.isBuffer(body))
|
|
82
|
+
return body;
|
|
83
|
+
if (body instanceof Uint8Array)
|
|
84
|
+
return body;
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
51
87
|
exports.getLogsTool = {
|
|
52
88
|
toolDefinition: definition,
|
|
53
89
|
handler,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLogs.js","sourceRoot":"","sources":["../../../src/tools/logs/getLogs.ts"],"names":[],"mappings":";;;AAKA,uCAAiE;
|
|
1
|
+
{"version":3,"file":"getLogs.js","sourceRoot":"","sources":["../../../src/tools/logs/getLogs.ts"],"names":[],"mappings":";;;AAKA,uCAAiE;AACjE,yCAA4C;AAoB5C,MAAM,UAAU,GAAwB;IACtC,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,ueAAue;IACze,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC;QACt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M,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,oEAAoE;QACpE,mEAAmE;QACnE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC9C,QAAQ,EAAE,QAAQ;aACnB,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAA,yBAAc,EAAC,KAAK,CAAC,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAA,2BAAmB,EAAC,GAAG,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAAa;IAC5B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,IAAI,YAAY,UAAU;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC;AAEY,QAAA,WAAW,GAAoD;IAC1E,cAAc,EAAE,UAAU;IAC1B,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode a Cloud ALM Logs OTLP `application/x-protobuf` body into canonical
|
|
3
|
+
* OTLP JSON (`{ resourceLogs: [{ resource, scopeLogs: [...] }] }`).
|
|
4
|
+
*
|
|
5
|
+
* `int64`/`fixed64` fields are emitted as decimal strings (JS numbers can't
|
|
6
|
+
* hold nanosecond timestamps); `bytes` fields (trace/span ids) as base64.
|
|
7
|
+
* Throws if the bytes aren't valid OTLP — callers should map this to a tool
|
|
8
|
+
* error rather than return garbage.
|
|
9
|
+
*/
|
|
10
|
+
export declare function decodeOtlpLogs(bytes: Uint8Array): unknown;
|
|
11
|
+
//# sourceMappingURL=otlpLogs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlpLogs.d.ts","sourceRoot":"","sources":["../../../src/tools/logs/otlpLogs.ts"],"names":[],"mappings":"AAeA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAWzD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.decodeOtlpLogs = decodeOtlpLogs;
|
|
7
|
+
const protobufjs_1 = __importDefault(require("protobufjs"));
|
|
8
|
+
const otlpProto_1 = require("./otlpProto");
|
|
9
|
+
// Parse the embedded OTLP schema once and reuse the resolved type.
|
|
10
|
+
let cachedType;
|
|
11
|
+
function exportRequestType() {
|
|
12
|
+
if (!cachedType) {
|
|
13
|
+
const root = protobufjs_1.default.parse(otlpProto_1.OTLP_LOGS_PROTO).root;
|
|
14
|
+
cachedType = root.lookupType('opentelemetry.proto.logs.v1.ExportLogsServiceRequest');
|
|
15
|
+
}
|
|
16
|
+
return cachedType;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Decode a Cloud ALM Logs OTLP `application/x-protobuf` body into canonical
|
|
20
|
+
* OTLP JSON (`{ resourceLogs: [{ resource, scopeLogs: [...] }] }`).
|
|
21
|
+
*
|
|
22
|
+
* `int64`/`fixed64` fields are emitted as decimal strings (JS numbers can't
|
|
23
|
+
* hold nanosecond timestamps); `bytes` fields (trace/span ids) as base64.
|
|
24
|
+
* Throws if the bytes aren't valid OTLP — callers should map this to a tool
|
|
25
|
+
* error rather than return garbage.
|
|
26
|
+
*/
|
|
27
|
+
function decodeOtlpLogs(bytes) {
|
|
28
|
+
const type = exportRequestType();
|
|
29
|
+
const message = type.decode(bytes);
|
|
30
|
+
return type.toObject(message, {
|
|
31
|
+
longs: String,
|
|
32
|
+
bytes: String, // base64
|
|
33
|
+
enums: String,
|
|
34
|
+
defaults: false,
|
|
35
|
+
arrays: true,
|
|
36
|
+
objects: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=otlpLogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlpLogs.js","sourceRoot":"","sources":["../../../src/tools/logs/otlpLogs.ts"],"names":[],"mappings":";;;;;AAwBA,wCAWC;AAnCD,4DAAkC;AAClC,2CAA8C;AAE9C,mEAAmE;AACnE,IAAI,UAAqC,CAAC;AAC1C,SAAS,iBAAiB;IACxB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,oBAAQ,CAAC,KAAK,CAAC,2BAAe,CAAC,CAAC,IAAI,CAAC;QAClD,UAAU,GAAG,IAAI,CAAC,UAAU,CAC1B,sDAAsD,CACvD,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,KAAiB;IAC9C,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;QAC5B,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM,EAAE,SAAS;QACxB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal self-contained subset of the OpenTelemetry protocol (OTLP) needed to
|
|
3
|
+
* decode the Cloud ALM Logs `application/x-protobuf` response. Field numbers
|
|
4
|
+
* match the upstream opentelemetry-proto definitions (common/v1, resource/v1,
|
|
5
|
+
* logs/v1, collector/logs/v1) verbatim — do not renumber.
|
|
6
|
+
*
|
|
7
|
+
* Embedded as a string (parsed at runtime via protobufjs) rather than shipped
|
|
8
|
+
* as a `.proto` asset, so it survives `tsc` compilation into `dist/` with no
|
|
9
|
+
* build-time file copying.
|
|
10
|
+
*/
|
|
11
|
+
export declare const OTLP_LOGS_PROTO = "\nsyntax = \"proto3\";\npackage opentelemetry.proto.logs.v1;\n\nmessage AnyValue {\n oneof value {\n string string_value = 1;\n bool bool_value = 2;\n int64 int_value = 3;\n double double_value = 4;\n ArrayValue array_value = 5;\n KeyValueList kvlist_value = 6;\n bytes bytes_value = 7;\n }\n}\nmessage ArrayValue { repeated AnyValue values = 1; }\nmessage KeyValueList { repeated KeyValue values = 1; }\nmessage KeyValue { string key = 1; AnyValue value = 2; }\nmessage InstrumentationScope {\n string name = 1;\n string version = 2;\n repeated KeyValue attributes = 3;\n uint32 dropped_attributes_count = 4;\n}\nmessage Resource {\n repeated KeyValue attributes = 1;\n uint32 dropped_attributes_count = 2;\n}\nmessage LogsData { repeated ResourceLogs resource_logs = 1; }\nmessage ResourceLogs {\n Resource resource = 1;\n repeated ScopeLogs scope_logs = 2;\n string schema_url = 3;\n}\nmessage ScopeLogs {\n InstrumentationScope scope = 1;\n repeated LogRecord log_records = 2;\n string schema_url = 3;\n}\nmessage LogRecord {\n fixed64 time_unix_nano = 1;\n int32 severity_number = 2;\n string severity_text = 3;\n AnyValue body = 5;\n repeated KeyValue attributes = 6;\n uint32 dropped_attributes_count = 7;\n uint32 flags = 8;\n bytes trace_id = 9;\n bytes span_id = 10;\n fixed64 observed_time_unix_nano = 11;\n}\nmessage ExportLogsServiceRequest { repeated ResourceLogs resource_logs = 1; }\n";
|
|
12
|
+
//# sourceMappingURL=otlpProto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlpProto.d.ts","sourceRoot":"","sources":["../../../src/tools/logs/otlpProto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,06CAoD3B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OTLP_LOGS_PROTO = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Minimal self-contained subset of the OpenTelemetry protocol (OTLP) needed to
|
|
6
|
+
* decode the Cloud ALM Logs `application/x-protobuf` response. Field numbers
|
|
7
|
+
* match the upstream opentelemetry-proto definitions (common/v1, resource/v1,
|
|
8
|
+
* logs/v1, collector/logs/v1) verbatim — do not renumber.
|
|
9
|
+
*
|
|
10
|
+
* Embedded as a string (parsed at runtime via protobufjs) rather than shipped
|
|
11
|
+
* as a `.proto` asset, so it survives `tsc` compilation into `dist/` with no
|
|
12
|
+
* build-time file copying.
|
|
13
|
+
*/
|
|
14
|
+
exports.OTLP_LOGS_PROTO = `
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
package opentelemetry.proto.logs.v1;
|
|
17
|
+
|
|
18
|
+
message AnyValue {
|
|
19
|
+
oneof value {
|
|
20
|
+
string string_value = 1;
|
|
21
|
+
bool bool_value = 2;
|
|
22
|
+
int64 int_value = 3;
|
|
23
|
+
double double_value = 4;
|
|
24
|
+
ArrayValue array_value = 5;
|
|
25
|
+
KeyValueList kvlist_value = 6;
|
|
26
|
+
bytes bytes_value = 7;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
message ArrayValue { repeated AnyValue values = 1; }
|
|
30
|
+
message KeyValueList { repeated KeyValue values = 1; }
|
|
31
|
+
message KeyValue { string key = 1; AnyValue value = 2; }
|
|
32
|
+
message InstrumentationScope {
|
|
33
|
+
string name = 1;
|
|
34
|
+
string version = 2;
|
|
35
|
+
repeated KeyValue attributes = 3;
|
|
36
|
+
uint32 dropped_attributes_count = 4;
|
|
37
|
+
}
|
|
38
|
+
message Resource {
|
|
39
|
+
repeated KeyValue attributes = 1;
|
|
40
|
+
uint32 dropped_attributes_count = 2;
|
|
41
|
+
}
|
|
42
|
+
message LogsData { repeated ResourceLogs resource_logs = 1; }
|
|
43
|
+
message ResourceLogs {
|
|
44
|
+
Resource resource = 1;
|
|
45
|
+
repeated ScopeLogs scope_logs = 2;
|
|
46
|
+
string schema_url = 3;
|
|
47
|
+
}
|
|
48
|
+
message ScopeLogs {
|
|
49
|
+
InstrumentationScope scope = 1;
|
|
50
|
+
repeated LogRecord log_records = 2;
|
|
51
|
+
string schema_url = 3;
|
|
52
|
+
}
|
|
53
|
+
message LogRecord {
|
|
54
|
+
fixed64 time_unix_nano = 1;
|
|
55
|
+
int32 severity_number = 2;
|
|
56
|
+
string severity_text = 3;
|
|
57
|
+
AnyValue body = 5;
|
|
58
|
+
repeated KeyValue attributes = 6;
|
|
59
|
+
uint32 dropped_attributes_count = 7;
|
|
60
|
+
uint32 flags = 8;
|
|
61
|
+
bytes trace_id = 9;
|
|
62
|
+
bytes span_id = 10;
|
|
63
|
+
fixed64 observed_time_unix_nano = 11;
|
|
64
|
+
}
|
|
65
|
+
message ExportLogsServiceRequest { repeated ResourceLogs resource_logs = 1; }
|
|
66
|
+
`;
|
|
67
|
+
//# sourceMappingURL=otlpProto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlpProto.js","sourceRoot":"","sources":["../../../src/tools/logs/otlpProto.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-abap-adt/calm-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP server + reusable tool primitives for SAP Cloud ALM, backed by @mcp-abap-adt/calm-client.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -70,19 +70,20 @@
|
|
|
70
70
|
"@mcp-abap-adt/auth-broker": "^1.0.5",
|
|
71
71
|
"@mcp-abap-adt/auth-providers": "^1.0.5",
|
|
72
72
|
"@mcp-abap-adt/auth-stores": "^1.0.4",
|
|
73
|
-
"@mcp-abap-adt/calm-client": "^0.4.
|
|
73
|
+
"@mcp-abap-adt/calm-client": "^0.4.2",
|
|
74
74
|
"@mcp-abap-adt/interfaces": "^7.1.0",
|
|
75
75
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"dotenv": "^17.3.1"
|
|
78
|
+
"dotenv": "^17.3.1",
|
|
79
|
+
"protobufjs": "^8.4.2"
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
81
82
|
"@biomejs/biome": "^2.4.4",
|
|
82
83
|
"@mcp-abap-adt/auth-broker": "^1.0.5",
|
|
83
84
|
"@mcp-abap-adt/auth-providers": "^1.0.5",
|
|
84
85
|
"@mcp-abap-adt/auth-stores": "^1.0.4",
|
|
85
|
-
"@mcp-abap-adt/calm-client": "^0.4.
|
|
86
|
+
"@mcp-abap-adt/calm-client": "^0.4.2",
|
|
86
87
|
"@mcp-abap-adt/interfaces": "^7.1.0",
|
|
87
88
|
"@mcp-abap-adt/logger": "^0.1.4",
|
|
88
89
|
"@modelcontextprotocol/sdk": "^1.0.0",
|