diff --git a/packages/mcp-core/src/api-client/client.test.ts b/packages/mcp-core/src/api-client/client.test.ts index 4924514aa..4b73c4710 100644 --- a/packages/mcp-core/src/api-client/client.test.ts +++ b/packages/mcp-core/src/api-client/client.test.ts @@ -1800,6 +1800,44 @@ describe("API query builders", () => { expect(params.get("attributeType")).toBeNull(); }); + it("should accept 'array' as a valid attributeType", async () => { + const apiService = new SentryApiService({ + host: "sentry.io", + accessToken: "test-token", + }); + + globalThis.fetch = vi.fn().mockResolvedValue({ + ok: true, + headers: { + get: (key: string) => + key === "content-type" ? "application/json" : null, + }, + json: () => + Promise.resolve([ + { + key: "tags[items]", + name: "items", + attributeType: "array", + attributeSource: { source_type: "user" }, + }, + ]), + }); + + const result = await apiService.listTraceItemAttributes({ + organizationSlug: "test-org", + itemType: "spans", + }); + + expect(result).toEqual([ + { + key: "tags[items]", + name: "items", + type: "array", + attributeSource: { source_type: "user" }, + }, + ]); + }); + it("should validate events requests via the validate endpoint", async () => { const apiService = new SentryApiService({ host: "sentry.io", diff --git a/packages/mcp-core/src/api-client/client.ts b/packages/mcp-core/src/api-client/client.ts index 6530a396f..6dda39f1e 100644 --- a/packages/mcp-core/src/api-client/client.ts +++ b/packages/mcp-core/src/api-client/client.ts @@ -325,7 +325,7 @@ type UpdateClientKeyRequest = { browserSdkVersion?: string; dynamicSdkLoaderOptions?: ClientKeyDynamicSdkLoaderOptions; }; -export type TraceItemAttributeType = "string" | "number" | "boolean"; +export type TraceItemAttributeType = "string" | "number" | "boolean" | "array"; export type TraceItemAttributeSourceType = "sentry" | "user"; export type TraceItemAttributeSource = { @@ -381,7 +381,7 @@ export type EventsValidationResult = { orderby: EventsAttributeValidationResult[]; }; -const TraceItemAttributeTypeSchema = z.enum(["string", "number", "boolean"]); +const TraceItemAttributeTypeSchema = z.enum(["string", "number", "boolean", "array"]); const TraceItemAttributeSourceSchema = z.object({ source_type: z.enum(["sentry", "user"]), is_transformed_alias: z.boolean().optional(), diff --git a/packages/mcp-core/src/tools/support/search-events/utils.ts b/packages/mcp-core/src/tools/support/search-events/utils.ts index 79028959a..431f3c952 100644 --- a/packages/mcp-core/src/tools/support/search-events/utils.ts +++ b/packages/mcp-core/src/tools/support/search-events/utils.ts @@ -950,7 +950,7 @@ export function createDatasetAttributesTool(options: { projectId?: string; }) { const { apiService, organizationSlug, projectId } = options; - const traceItemAttributeTypeSchema = z.enum(["string", "number", "boolean"]); + const traceItemAttributeTypeSchema = z.enum(["string", "number", "boolean", "array"]); return agentTool({ description: