@attrkit/mcp 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14082,15 +14082,16 @@ function toToolResult(result) {
|
|
|
14082
14082
|
const expectedResponse = result.expectedResponse ?? "json";
|
|
14083
14083
|
const isEmptySuccess = result.status === 204 && (result.rawBody === undefined || result.rawBody === "");
|
|
14084
14084
|
const isJsonEnvelope = result.json !== null && typeof result.json === "object" && !Array.isArray(result.json) && Object.hasOwn(result.json, "data");
|
|
14085
|
-
const
|
|
14085
|
+
const contentType = (result.contentType ?? "").toLowerCase();
|
|
14086
|
+
const isExpectedText = expectedResponse === "text" && typeof result.json === "string" && (contentType.includes("text/csv") || contentType.includes("application/csv"));
|
|
14086
14087
|
if (!isEmptySuccess && !isJsonEnvelope && !isExpectedText) {
|
|
14087
|
-
const
|
|
14088
|
+
const reportedContentType = result.contentType ?? "unknown content type";
|
|
14088
14089
|
const received = result.json === null ? "an empty body" : Array.isArray(result.json) ? "a JSON array" : typeof result.json === "object" ? "a JSON object without a data field" : `a ${typeof result.json} body`;
|
|
14089
14090
|
const body = result.rawBody ?? (typeof result.json === "string" ? result.json : JSON.stringify(result.json, null, 2));
|
|
14090
14091
|
return {
|
|
14091
14092
|
content: [{
|
|
14092
14093
|
type: "text",
|
|
14093
|
-
text: `AttrKit API error (${result.status}): invalid_response: expected a JSON data envelope but received ${received} with Content-Type ${
|
|
14094
|
+
text: `AttrKit API error (${result.status}): invalid_response: expected a JSON data envelope but received ${received} with Content-Type ${reportedContentType}. Body:
|
|
14094
14095
|
${body}`
|
|
14095
14096
|
}],
|
|
14096
14097
|
isError: true
|
|
@@ -14102,7 +14103,7 @@ ${body}`
|
|
|
14102
14103
|
structuredContent: structured
|
|
14103
14104
|
};
|
|
14104
14105
|
}
|
|
14105
|
-
var SERVER_VERSION = "0.4.
|
|
14106
|
+
var SERVER_VERSION = "0.4.1";
|
|
14106
14107
|
var periodSchema = z4.enum(["7d", "30d", "90d", "all"]).describe("Reporting window. Defaults to 30d.").optional();
|
|
14107
14108
|
var appIdSchema = z4.string().describe("Optional app id to scope the result to one app.").optional();
|
|
14108
14109
|
var requiredAppIdSchema = z4.string().describe("The AttrKit app id.");
|