diff --git a/.oxlintrc.json b/.oxlintrc.json index 6a86d7b0d..a7710f1e6 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -16,7 +16,15 @@ "packages/codemod-cli3to4/tests/**" ], "rules": { - "no-unused-vars": "off", + "no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "caughtErrors": "none", + "ignoreRestSiblings": true + } + ], "typescript/return-await": ["error", "always"], "typescript/no-floating-promises": [ "error", diff --git a/packages/cli/script/generate-skill.ts b/packages/cli/script/generate-skill.ts index 4db8890bd..7a289e992 100644 --- a/packages/cli/script/generate-skill.ts +++ b/packages/cli/script/generate-skill.ts @@ -21,7 +21,7 @@ * docs/public/.well-known/skills/index.json */ -import { existsSync, mkdirSync, rmSync } from "node:fs"; +import { mkdirSync, rmSync } from "node:fs"; import { access, readFile, writeFile } from "node:fs/promises"; import { routes } from "../src/app.js"; import { diff --git a/packages/cli/src/commands/agent-conversation/view.ts b/packages/cli/src/commands/agent-conversation/view.ts index 02efad033..4c5af2fb7 100644 --- a/packages/cli/src/commands/agent-conversation/view.ts +++ b/packages/cli/src/commands/agent-conversation/view.ts @@ -11,7 +11,6 @@ import { ORG_TARGET } from "../../lib/completion-target.js"; import { buildTranscriptResult, formatTranscriptResult, - type TranscriptResult, } from "../../lib/formatters/conversation.js"; import { CommandOutput } from "../../lib/formatters/output.js"; import { ValidationError } from "../../lib/errors.js"; diff --git a/packages/cli/src/commands/auth/switch.ts b/packages/cli/src/commands/auth/switch.ts index bc469843c..bbb6ae668 100644 --- a/packages/cli/src/commands/auth/switch.ts +++ b/packages/cli/src/commands/auth/switch.ts @@ -30,10 +30,7 @@ import { setActiveAccount, } from "../../lib/db/auth.js"; import { AuthError, ResolutionError } from "../../lib/errors.js"; -import { - type AccountSwitchResult, - formatAccountSwitch, -} from "../../lib/formatters/accounts.js"; +import { formatAccountSwitch } from "../../lib/formatters/accounts.js"; import { CommandOutput } from "../../lib/formatters/output.js"; import { parseLoginUrl } from "./login.js"; diff --git a/packages/cli/src/commands/dashboard/create.ts b/packages/cli/src/commands/dashboard/create.ts index 718e513e0..4c279da65 100644 --- a/packages/cli/src/commands/dashboard/create.ts +++ b/packages/cli/src/commands/dashboard/create.ts @@ -31,7 +31,6 @@ import { applySentryUrlContext } from "../../lib/sentry-url-parser.js"; import { buildDashboardUrl } from "../../lib/sentry-web-urls.js"; import { setOrgProjectContext } from "../../lib/telemetry.js"; import { DashboardCreateOutputSchema } from "../../generated/output-schemas/dashboard.js"; -import type { DashboardCreateOutput } from "../../output-schemas/dashboard.js"; import { withDashboardErrors } from "./resolve.js"; type CreateFlags = { @@ -39,8 +38,6 @@ type CreateFlags = { readonly fields?: string[]; }; -type CreateResult = DashboardCreateOutput; - /** `dashboard create`'s positionals, parsed: the title and the target. */ type CreateInput = { readonly title: string; diff --git a/packages/cli/src/commands/dashboard/widget/delete.ts b/packages/cli/src/commands/dashboard/widget/delete.ts index d748a8594..957041670 100644 --- a/packages/cli/src/commands/dashboard/widget/delete.ts +++ b/packages/cli/src/commands/dashboard/widget/delete.ts @@ -19,10 +19,7 @@ import { formatWidgetDeleted } from "../../../lib/formatters/human.js"; import { CommandOutput } from "../../../lib/formatters/output.js"; import { buildDeleteCommand } from "../../../lib/mutate-command.js"; import { buildDashboardUrl } from "../../../lib/sentry-web-urls.js"; -import { - type DashboardWidgetDeleteOutput, - prepareDashboardForUpdate, -} from "../../../types/dashboard.js"; +import { prepareDashboardForUpdate } from "../../../types/dashboard.js"; import { type DashboardArguments, dashboardArguments } from "../arguments.js"; import { withDashboardErrors, resolveWidgetIndex } from "../resolve.js"; import { DashboardWidgetDeleteOutputSchema } from "../../../generated/output-schemas/dashboard.js"; diff --git a/packages/cli/src/commands/replay/download.ts b/packages/cli/src/commands/replay/download.ts index afb5223b0..38be82d27 100644 --- a/packages/cli/src/commands/replay/download.ts +++ b/packages/cli/src/commands/replay/download.ts @@ -17,10 +17,7 @@ import { buildCommand } from "../../lib/command.js"; import { parseFilePath } from "../../lib/completion-target.js"; import { ApiError, ResolutionError } from "../../lib/errors.js"; import { CommandOutput } from "../../lib/formatters/output.js"; -import { - formatReplayDownloadResult, - type ReplayDownloadData, -} from "../../lib/formatters/replay.js"; +import { formatReplayDownloadResult } from "../../lib/formatters/replay.js"; import { applyFreshFlag, FRESH_ALIASES, diff --git a/packages/cli/src/lib/api/conversations.ts b/packages/cli/src/lib/api/conversations.ts index cf338228d..a33c10975 100644 --- a/packages/cli/src/lib/api/conversations.ts +++ b/packages/cli/src/lib/api/conversations.ts @@ -31,7 +31,6 @@ import { resolveOrgRegion } from "../region.js"; import { getSdkClientConfig } from "../sentry-sdk-client.js"; import { - API_MAX_PER_PAGE, getOrgSdkConfig, MAX_PAGINATION_PAGES, type PaginatedResponse, diff --git a/packages/cli/src/lib/api/issues.ts b/packages/cli/src/lib/api/issues.ts index a3db4a90d..af4a4ea73 100644 --- a/packages/cli/src/lib/api/issues.ts +++ b/packages/cli/src/lib/api/issues.ts @@ -31,7 +31,6 @@ import { applyCustomHeaders } from "../custom-headers.js"; import { ApiError, ValidationError } from "../errors.js"; import { - API_MAX_PER_PAGE, getOrgSdkConfig, ORG_FANOUT_CONCURRENCY, type PaginatedResponse, diff --git a/packages/cli/src/lib/api/traces.ts b/packages/cli/src/lib/api/traces.ts index 8d653dd48..607d6564b 100644 --- a/packages/cli/src/lib/api/traces.ts +++ b/packages/cli/src/lib/api/traces.ts @@ -39,7 +39,6 @@ import { getSdkClientConfig } from "../sentry-sdk-client.js"; import { isAllDigits } from "../utils.js"; import { - API_MAX_PER_PAGE, apiRequestToRegion, getOrgSdkConfig, type PaginatedResponse, diff --git a/packages/cli/src/lib/formatters/log.ts b/packages/cli/src/lib/formatters/log.ts index f44435a27..a41a1abf0 100644 --- a/packages/cli/src/lib/formatters/log.ts +++ b/packages/cli/src/lib/formatters/log.ts @@ -7,7 +7,6 @@ import { tableCell, text } from "@sentry/toolkit-core/markdown"; import type { DetailedSentryLog, - SentryLog, TraceItemAttribute, } from "../../types/index.js"; import { stringifyUnknown } from "../errors.js"; diff --git a/packages/cli/src/lib/formatters/table.ts b/packages/cli/src/lib/formatters/table.ts index 50a795c6c..b38a82562 100644 --- a/packages/cli/src/lib/formatters/table.ts +++ b/packages/cli/src/lib/formatters/table.ts @@ -9,7 +9,6 @@ * treats them as zero-width for column sizing. */ -import { tableCell } from "@sentry/toolkit-core/markdown"; import type { Writer } from "../../types/index.js"; import { isPlainOutput, diff --git a/packages/cli/src/types/replay.ts b/packages/cli/src/types/replay.ts index 234ea63da..d1ac68652 100644 --- a/packages/cli/src/types/replay.ts +++ b/packages/cli/src/types/replay.ts @@ -9,7 +9,6 @@ import { nullable, nullish, number, - object, optional, pipe, record, diff --git a/packages/cli/src/types/sentry.ts b/packages/cli/src/types/sentry.ts index 6c6497a9f..697675a46 100644 --- a/packages/cli/src/types/sentry.ts +++ b/packages/cli/src/types/sentry.ts @@ -55,7 +55,6 @@ import { number, object, optional, - partial, pipe, record, string, diff --git a/packages/cli/test/lib/sentry-urls.property.test.ts b/packages/cli/test/lib/sentry-urls.property.test.ts index 65b2bd6e2..32408e6dc 100644 --- a/packages/cli/test/lib/sentry-urls.property.test.ts +++ b/packages/cli/test/lib/sentry-urls.property.test.ts @@ -81,9 +81,6 @@ const traceIdArb = stringMatching(/^[a-f0-9]{32}$/); /** Valid dashboard IDs (numeric strings) */ const dashboardIdArb = stringMatching(/^[1-9][0-9]{0,8}$/); -/** Valid project IDs (numeric strings, same shape as other Sentry IDs) */ -const projectIdArb = stringMatching(/^[1-9][0-9]{0,8}$/); - /** Common Sentry regions */ const sentryRegionArb = constantFrom("us", "de", "eu", "staging"); diff --git a/packages/cli/test/script/zod-v3-stub-plugin.test.ts b/packages/cli/test/script/zod-v3-stub-plugin.test.ts index 68b6f568b..bbe0fd633 100644 --- a/packages/cli/test/script/zod-v3-stub-plugin.test.ts +++ b/packages/cli/test/script/zod-v3-stub-plugin.test.ts @@ -6,7 +6,7 @@ * Zod 3 module reaches the output. */ -import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { createRequire } from "node:module"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; diff --git a/packages/logger/bench/run.mjs b/packages/logger/bench/run.mjs index a6fd98add..8d8543099 100644 --- a/packages/logger/bench/run.mjs +++ b/packages/logger/bench/run.mjs @@ -52,9 +52,9 @@ async function setUp(name) { logfmtReporter, sentryReporter, } = await import(ENTRY); - let sink; - const stream = { write: (chunk) => (sink = chunk) }; - const send = (message, attributes) => (sink = attributes ?? message); + let _sink; + const stream = { write: (chunk) => (_sink = chunk) }; + const send = (message, attributes) => (_sink = attributes ?? message); const sentryLogger = { trace: send, debug: send, @@ -72,15 +72,15 @@ async function setUp(name) { switch (name) { case "noop": { - const noop = (...args) => (sink = args); + const noop = (...args) => (_sink = args); return () => noop("Logged in as %s", "jane"); } case "debug": { - const log = logger({ log: (record) => (sink = record) }); + const log = logger({ log: (record) => (_sink = record) }); return () => log.debug("Logged in as %s", "jane"); } case "noopReporter": { - const log = logger({ log: (record) => (sink = record) }); + const log = logger({ log: (record) => (_sink = record) }); return () => log.info("Logged in as %s", "jane"); } case "formatWrite": diff --git a/packages/mcp-cloudflare/src/client/components/chat/chat-message.tsx b/packages/mcp-cloudflare/src/client/components/chat/chat-message.tsx index e7429d89c..20e9b30d2 100644 --- a/packages/mcp-cloudflare/src/client/components/chat/chat-message.tsx +++ b/packages/mcp-cloudflare/src/client/components/chat/chat-message.tsx @@ -15,7 +15,6 @@ import type { const TextPart = memo(function TextPart({ text, role, - messageId, isStreaming, messageData, onSlashCommand, diff --git a/packages/mcp-cloudflare/src/client/components/chat/tool-invocation.tsx b/packages/mcp-cloudflare/src/client/components/chat/tool-invocation.tsx index 3235d94a2..44e94048f 100644 --- a/packages/mcp-cloudflare/src/client/components/chat/tool-invocation.tsx +++ b/packages/mcp-cloudflare/src/client/components/chat/tool-invocation.tsx @@ -12,11 +12,7 @@ function getTokenCount(content: ToolMessage[]): number { }, 0); } -export function ToolInvocation({ - tool, - messageId, - index, -}: ToolInvocationProps) { +export function ToolInvocation({ tool }: ToolInvocationProps) { const [isExpanded, setIsExpanded] = useState(false); return ( diff --git a/packages/mcp-cloudflare/src/client/components/fragments/remote-setup.tsx b/packages/mcp-cloudflare/src/client/components/fragments/remote-setup.tsx index b6855c624..9a306b541 100644 --- a/packages/mcp-cloudflare/src/client/components/fragments/remote-setup.tsx +++ b/packages/mcp-cloudflare/src/client/components/fragments/remote-setup.tsx @@ -13,10 +13,7 @@ import { VSCodeInstructions } from "./instructions/vscode"; import { WarpInstructions } from "./instructions/warp"; import { ZedInstructions } from "./instructions/zed"; -const mcpServerName = import.meta.env.DEV ? "sentry-dev" : "sentry"; - export default function RemoteSetup() { - const endpoint = new URL("/mcp", window.location.href).href; return ( <> diff --git a/packages/mcp-cloudflare/src/client/components/fragments/stdio-setup.tsx b/packages/mcp-cloudflare/src/client/components/fragments/stdio-setup.tsx index 00f36eb77..6d495df8a 100644 --- a/packages/mcp-cloudflare/src/client/components/fragments/stdio-setup.tsx +++ b/packages/mcp-cloudflare/src/client/components/fragments/stdio-setup.tsx @@ -5,7 +5,6 @@ import CodeSnippet from "../ui/code-snippet"; import { Prose } from "../ui/prose"; import InstallTabs, { Tab } from "./install-tabs"; -const mcpServerName = import.meta.env.DEV ? "sentry-dev" : "sentry"; const orderedSkills = [...skillDefinitions] .filter((skill) => !skill.deprecated) .sort((a, b) => a.order - b.order); diff --git a/packages/mcp-cloudflare/src/server/lib/approval-dialog.ts b/packages/mcp-cloudflare/src/server/lib/approval-dialog.ts index a90dacb14..350f2268a 100644 --- a/packages/mcp-cloudflare/src/server/lib/approval-dialog.ts +++ b/packages/mcp-cloudflare/src/server/lib/approval-dialog.ts @@ -454,15 +454,8 @@ export async function renderApprovalDialog( request: Request, options: ApprovalDialogOptions, ): Promise { - const { - client, - server, - scope, - redirectUri, - state, - cookieSecret, - defaultSkills, - } = options; + const { client, scope, redirectUri, state, cookieSecret, defaultSkills } = + options; const defaultSkillIds = defaultSkills === undefined ? new Set(APPROVABLE_SKILLS.map((skill) => skill.id)) diff --git a/packages/mcp-cloudflare/src/server/lib/constraint-utils.test.ts b/packages/mcp-cloudflare/src/server/lib/constraint-utils.test.ts index d482ae405..b19fd9532 100644 --- a/packages/mcp-cloudflare/src/server/lib/constraint-utils.test.ts +++ b/packages/mcp-cloudflare/src/server/lib/constraint-utils.test.ts @@ -98,7 +98,7 @@ describe("verifyConstraintsAccess", () => { { accessToken: undefined, label: "undefined" }, ]; - for (const { accessToken, label } of testCases) { + for (const { accessToken } of testCases) { const result = await verifyConstraintsAccess( { organizationSlug: "org", projectSlug: null }, { accessToken, sentryHost: host }, diff --git a/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts b/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts index ee3df540e..925c69dbe 100644 --- a/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts +++ b/packages/mcp-cloudflare/src/server/oauth/authorize.test.ts @@ -14,7 +14,7 @@ const mockOAuthProvider = { }; // Create test app with mocked environment -function createTestApp(env: Partial = {}) { +function createTestApp() { const app = new Hono<{ Bindings: Env }>(); app.route("/oauth", oauthRoute); return app; @@ -100,7 +100,7 @@ describe("oauth authorize routes", () => { SENTRY_CLIENT_SECRET: "test-client-secret", SENTRY_HOST: "sentry.io", }; - app = createTestApp(testEnv); + app = createTestApp(); }); describe("GET /oauth/authorize", () => { diff --git a/packages/mcp-cloudflare/src/server/oauth/helpers.test.ts b/packages/mcp-cloudflare/src/server/oauth/helpers.test.ts index ee30d6872..66827d06e 100644 --- a/packages/mcp-cloudflare/src/server/oauth/helpers.test.ts +++ b/packages/mcp-cloudflare/src/server/oauth/helpers.test.ts @@ -24,7 +24,6 @@ vi.mock("@sentry/cloudflare", () => ({ import { OAUTH_GRANT_AGE_BUCKET_ATTRIBUTE, - OAUTH_GRANT_SHAPE_ATTRIBUTE, OAUTH_REFRESH_OUTCOME_ATTRIBUTE, OAUTH_UPSTREAM_EXPIRES_IN_BUCKET_ATTRIBUTE, } from "./telemetry"; diff --git a/packages/mcp-cloudflare/src/server/routes/chat-oauth.ts b/packages/mcp-cloudflare/src/server/routes/chat-oauth.ts index 75eaa96c5..82ec628d4 100644 --- a/packages/mcp-cloudflare/src/server/routes/chat-oauth.ts +++ b/packages/mcp-cloudflare/src/server/routes/chat-oauth.ts @@ -99,10 +99,6 @@ const ClientRegistrationResponseSchema = z.object({ client_id_issued_at: z.number().optional(), }); -type ClientRegistrationResponse = z.infer< - typeof ClientRegistrationResponseSchema ->; - // Get or register OAuth client with the MCP server export async function getOrRegisterChatClient( env: Env, diff --git a/packages/mcp-cloudflare/src/server/routes/chat.ts b/packages/mcp-cloudflare/src/server/routes/chat.ts index 8e256ffbb..62bb7e651 100644 --- a/packages/mcp-cloudflare/src/server/routes/chat.ts +++ b/packages/mcp-cloudflare/src/server/routes/chat.ts @@ -61,7 +61,7 @@ export function syncOpenRouterEnvFromBindings( async function refreshTokenIfNeeded( c: Context<{ Bindings: Env }>, ): Promise<{ token: string; authData: AuthData } | null> { - const { getCookie, setCookie, deleteCookie } = await import("hono/cookie"); + const { getCookie, deleteCookie } = await import("hono/cookie"); const authDataCookie = getCookie(c, "sentry_auth_data"); if (!authDataCookie) { diff --git a/packages/mcp-cloudflare/src/server/routes/mcp.ts b/packages/mcp-cloudflare/src/server/routes/mcp.ts index 359361198..3124d383b 100644 --- a/packages/mcp-cloudflare/src/server/routes/mcp.ts +++ b/packages/mcp-cloudflare/src/server/routes/mcp.ts @@ -21,10 +21,10 @@ function jsonResponse(json: unknown, status = 200) { export default new Hono() // Index: advertise available endpoints - .get("/", (c) => + .get("/", () => jsonResponse({ endpoints: ["/.mcp/tools.json"], }), ) // Tools - .get("/tools.json", (c) => jsonResponse(TOOL_DEFINITIONS)); + .get("/tools.json", () => jsonResponse(TOOL_DEFINITIONS)); diff --git a/packages/mcp-core/scripts/generate-otel-namespaces.ts b/packages/mcp-core/scripts/generate-otel-namespaces.ts index 4066240c1..98fdb990d 100644 --- a/packages/mcp-core/scripts/generate-otel-namespaces.ts +++ b/packages/mcp-core/scripts/generate-otel-namespaces.ts @@ -65,11 +65,6 @@ const OtelYamlFileSchema = z.object({ groups: z.array(OtelGroupSchema), }); -// TypeScript types inferred from Zod schemas -type OtelAttribute = z.infer; -type OtelGroup = z.infer; -type OtelYamlFile = z.infer; - interface JsonAttribute { description: string; type: string; diff --git a/packages/mcp-core/src/api-client/client.ts b/packages/mcp-core/src/api-client/client.ts index acc0d2629..1811e15b0 100644 --- a/packages/mcp-core/src/api-client/client.ts +++ b/packages/mcp-core/src/api-client/client.ts @@ -17,19 +17,15 @@ import { } from "@sentry/api"; import { operations } from "@sentry/api/operations"; import { - ApiError, ApiNotFoundError, apiPath, - ApiRateLimitError, type ApiTarget, ApiValidationError, - applyStatsMixinTimeParams, applyTimeParams, createApiClientCore, createApiError, createApiTransport, createIdempotentOperationMatcher, - parseStatsPeriod, readJsonResponse, type RetryPolicy, selectIdempotentWrites, @@ -99,7 +95,6 @@ import { isProfilesDataset, normalizeEventsDataset, } from "../utils/events-datasets"; -import { isNumericId } from "../utils/slug-validation"; import { type DashboardUrlOptions, getAIConversationsUrl as getAIConversationsUrlUtil, @@ -1021,7 +1016,6 @@ export class SentryApiService { start, end, aggregateFunctions, - groupByFields, } = params; const urlParams = new URLSearchParams(); diff --git a/packages/mcp-core/src/internal/agents/tools/otel-semantics.test.ts b/packages/mcp-core/src/internal/agents/tools/otel-semantics.test.ts index 127a2c648..b5e62d440 100644 --- a/packages/mcp-core/src/internal/agents/tools/otel-semantics.test.ts +++ b/packages/mcp-core/src/internal/agents/tools/otel-semantics.test.ts @@ -1,5 +1,4 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -import type { SentryApiService } from "../../../api-client"; vi.mock("../logging", () => ({ logIssue: vi.fn(), @@ -13,16 +12,9 @@ describe("otel-semantics-lookup", () => { vi.clearAllMocks(); }); - const mockApiService = {} as SentryApiService; - describe("lookupOtelSemantics", () => { it("should return namespace information for valid namespace", async () => { - const result = await lookupOtelSemantics( - "gen_ai", - "spans", - mockApiService, - "test-org", - ); + const result = await lookupOtelSemantics("gen_ai"); expect(result).toContain("# OpenTelemetry Semantic Conventions: gen_ai"); expect(result).toContain("## Attributes"); @@ -33,29 +25,14 @@ describe("otel-semantics-lookup", () => { }); it("should handle namespace with underscore and dash interchangeably", async () => { - const result1 = await lookupOtelSemantics( - "gen_ai", - "spans", - mockApiService, - "test-org", - ); - const result2 = await lookupOtelSemantics( - "gen-ai", - "spans", - mockApiService, - "test-org", - ); + const result1 = await lookupOtelSemantics("gen_ai"); + const result2 = await lookupOtelSemantics("gen-ai"); expect(result1).toBe(result2); }); it("should return all attributes for a namespace", async () => { - const result = await lookupOtelSemantics( - "http", - "spans", - mockApiService, - "test-org", - ); + const result = await lookupOtelSemantics("http"); expect(result).toContain("total)"); expect(result).toContain("`http.request.method`"); @@ -63,12 +40,7 @@ describe("otel-semantics-lookup", () => { }); it("should return MCP semantic attributes", async () => { - const result = await lookupOtelSemantics( - "mcp", - "spans", - mockApiService, - "test-org", - ); + const result = await lookupOtelSemantics("mcp"); expect(result).toContain("# OpenTelemetry Semantic Conventions: mcp"); expect(result).toContain("`mcp.method.name`"); @@ -81,9 +53,6 @@ describe("otel-semantics-lookup", () => { it("should handle invalid namespace", async () => { const result = await lookupOtelSemantics( "totally_invalid_namespace_that_does_not_exist", - "spans", - mockApiService, - "test-org", ); expect(result).toContain( @@ -92,12 +61,7 @@ describe("otel-semantics-lookup", () => { }); it("should suggest similar namespaces", async () => { - const result = await lookupOtelSemantics( - "gen", - "spans", - mockApiService, - "test-org", - ); + const result = await lookupOtelSemantics("gen"); expect(result).toContain("Did you mean:"); expect(result).toContain("gen_ai"); diff --git a/packages/mcp-core/src/internal/agents/tools/otel-semantics.ts b/packages/mcp-core/src/internal/agents/tools/otel-semantics.ts index 1f3773409..3bae25e81 100644 --- a/packages/mcp-core/src/internal/agents/tools/otel-semantics.ts +++ b/packages/mcp-core/src/internal/agents/tools/otel-semantics.ts @@ -1,9 +1,5 @@ import { z } from "zod"; -import type { SentryApiService } from "../../../api-client"; -import { - type EventsDataset, - PUBLIC_EVENTS_DATASETS, -} from "../../../utils/events-datasets"; +import { PUBLIC_EVENTS_DATASETS } from "../../../utils/events-datasets"; import { agentTool, recordAgentToolResultCount } from "./utils"; // Import all JSON files directly @@ -178,13 +174,7 @@ interface NamespaceData { /** * Lookup OpenTelemetry semantic convention attributes for a given namespace */ -export async function lookupOtelSemantics( - namespace: string, - dataset: EventsDataset, - apiService: SentryApiService, - organizationSlug: string, - projectId?: string, -): Promise { +export async function lookupOtelSemantics(namespace: string): Promise { // Normalize namespace (replace - with _) const normalizedNamespace = namespace.replace(/-/g, "_"); @@ -253,14 +243,8 @@ export async function lookupOtelSemantics( */ /** * Create a tool for looking up OpenTelemetry semantic convention attributes - * The tool is pre-bound with the API service and organization configured for the appropriate region */ -export function createOtelLookupTool(options: { - apiService: SentryApiService; - organizationSlug: string; - projectId?: string; -}) { - const { apiService, organizationSlug, projectId } = options; +export function createOtelLookupTool() { return agentTool({ description: "Look up OpenTelemetry semantic convention attributes for a specific namespace. OpenTelemetry attributes are universal standards that work across all datasets.", @@ -276,14 +260,8 @@ export function createOtelLookupTool(options: { "REQUIRED: Dataset to check attribute availability in. The agent MUST specify this based on their chosen dataset.", ), }), - execute: async ({ namespace, dataset }) => { - return await lookupOtelSemantics( - namespace, - dataset, - apiService, - organizationSlug, - projectId, - ); + execute: async ({ namespace }) => { + return await lookupOtelSemantics(namespace); }, }); } diff --git a/packages/mcp-core/src/internal/agents/tools/utils.ts b/packages/mcp-core/src/internal/agents/tools/utils.ts index 843c92659..a07ec6136 100644 --- a/packages/mcp-core/src/internal/agents/tools/utils.ts +++ b/packages/mcp-core/src/internal/agents/tools/utils.ts @@ -9,18 +9,6 @@ import { } from "../../../errors"; import { logIssue, logWarn } from "../../../telem/logging"; -/** - * Standard response schema for all embedded agent tools. - * Tools return either an error message or the result data, never both. - */ -const AgentToolResponseSchema = z.object({ - error: z - .string() - .optional() - .describe("Error message if the operation failed"), - result: z.unknown().optional().describe("The successful result data"), -}); - export type AgentToolResponse = { error?: string; result?: T; diff --git a/packages/mcp-core/src/internal/fetch-utils.test.ts b/packages/mcp-core/src/internal/fetch-utils.test.ts index 467859d90..bb4fdaa1c 100644 --- a/packages/mcp-core/src/internal/fetch-utils.test.ts +++ b/packages/mcp-core/src/internal/fetch-utils.test.ts @@ -208,7 +208,6 @@ describe("fetch-utils", () => { it("caps delay at 30 seconds", async () => { const fn = vi.fn(); - const callCount = 0; // Mock function that fails many times for (let i = 0; i < 10; i++) { diff --git a/packages/mcp-core/src/internal/fetch-utils.ts b/packages/mcp-core/src/internal/fetch-utils.ts index cee0fcc1b..5c069ff05 100644 --- a/packages/mcp-core/src/internal/fetch-utils.ts +++ b/packages/mcp-core/src/internal/fetch-utils.ts @@ -45,7 +45,7 @@ export async function retryWithBackoff( { maxRetries = 3, initialDelay = 1000, - shouldRetry = (error: unknown) => true, + shouldRetry = () => true, }: { maxRetries?: number; initialDelay?: number; diff --git a/packages/mcp-core/src/internal/formatting.test.ts b/packages/mcp-core/src/internal/formatting.test.ts index cf9176e60..54c67f810 100644 --- a/packages/mcp-core/src/internal/formatting.test.ts +++ b/packages/mcp-core/src/internal/formatting.test.ts @@ -19,22 +19,6 @@ import { } from "./test-fixtures"; // Helper functions to reduce duplication in event creation -function createPythonExceptionEvent( - errorType: string, - errorMessage: string, - frames: any[], -): Event { - return new EventBuilder("python") - .withException( - createExceptionValue({ - type: errorType, - value: errorMessage, - stacktrace: createStackTrace(frames), - }), - ) - .build(); -} - function createSimpleExceptionEvent( platform: string, errorType: string, diff --git a/packages/mcp-core/src/internal/formatting.ts b/packages/mcp-core/src/internal/formatting.ts index 2da18eb80..e4bc2df91 100644 --- a/packages/mcp-core/src/internal/formatting.ts +++ b/packages/mcp-core/src/internal/formatting.ts @@ -418,13 +418,7 @@ function formatExceptionInterfaceOutput( // Add language-specific chain indicator for multiple exceptions if (isChained && index > 0) { parts.push(""); - parts.push( - getExceptionChainMessage( - event.platform || null, - index, - exceptions.length, - ), - ); + parts.push(getExceptionChainMessage(event.platform || null, index)); parts.push(""); } @@ -494,7 +488,6 @@ function formatExceptionInterfaceOutput( function getExceptionChainMessage( platform: string | null, index: number, - totalExceptions: number, ): string { // Default message for unknown platforms const defaultMessage = @@ -1553,10 +1546,7 @@ function formatN1QueryEvidence( * This is lower priority as the generic evidenceDisplay fields usually * provide sufficient information for slow query issues. */ -function formatSlowDbQueryEvidence( - evidenceData: SlowDbEvidenceData, - spansData: unknown, -): string { +function formatSlowDbQueryEvidence(evidenceData: SlowDbEvidenceData): string { const parts: string[] = []; // Show parent span if available (generic field that applies to slow queries) @@ -1632,7 +1622,7 @@ function formatPerformanceIssueOutput( } case KNOWN_PERFORMANCE_ISSUE_TYPES.SLOW_DB_QUERY: { - const result = formatSlowDbQueryEvidence(evidenceData, spansData); + const result = formatSlowDbQueryEvidence(evidenceData); if (result) parts.push(result); break; } diff --git a/packages/mcp-core/src/telem/sentry.ts b/packages/mcp-core/src/telem/sentry.ts index a4f097e5a..dc2036b7c 100644 --- a/packages/mcp-core/src/telem/sentry.ts +++ b/packages/mcp-core/src/telem/sentry.ts @@ -92,7 +92,7 @@ function scrubValue(value: unknown, depth = 0): [unknown, boolean, string[]] { * Sentry beforeSend hook that scrubs sensitive data from events * and applies custom fingerprinting for specific error types. */ -export function sentryBeforeSend(event: any, hint: any): any { +export function sentryBeforeSend(event: any, _hint: any): any { // Custom fingerprinting for AI SDK API call errors. // These errors share the same stack trace but have different messages // (e.g., "Country, region, or territory not supported", temperature issues). diff --git a/packages/mcp-core/src/tools/catalog/get-doc.ts b/packages/mcp-core/src/tools/catalog/get-doc.ts index cbd9aba52..3da8dbc0d 100644 --- a/packages/mcp-core/src/tools/catalog/get-doc.ts +++ b/packages/mcp-core/src/tools/catalog/get-doc.ts @@ -4,7 +4,6 @@ import { ApiError } from "../../api-client/index"; import { UserInputError } from "../../errors"; import { fetchWithTimeout } from "../../internal/fetch-utils"; import { defineTool } from "../../internal/tool-helpers/define"; -import type { ServerContext } from "../../types"; import { getUserAgent } from "../../version"; const DOC_NOT_FOUND_MESSAGE = @@ -54,7 +53,7 @@ export default defineTool({ destructiveHint: false, openWorldHint: true, }, - async handler(params, context: ServerContext) { + async handler(params) { const docContext = { "doc.path": params.path }; setTags(docContext); setAttributes(docContext); diff --git a/packages/mcp-core/src/tools/catalog/get-issue-details.ts b/packages/mcp-core/src/tools/catalog/get-issue-details.ts index 5163a6dbd..e70a9efdc 100644 --- a/packages/mcp-core/src/tools/catalog/get-issue-details.ts +++ b/packages/mcp-core/src/tools/catalog/get-issue-details.ts @@ -10,7 +10,6 @@ import type { ExternalIssueList, Issue, Trace, - TransactionEvent, } from "../../api-client/types"; import { ConfigurationError, UserInputError } from "../../errors"; import type { CodeLocation } from "../../internal/code-location"; @@ -895,10 +894,6 @@ function isErrorEvent(event: Event): event is ErrorEvent | DefaultEvent { return event.type === "error" || event.type === "default"; } -function isTransactionEvent(event: Event): event is TransactionEvent { - return event.type === "transaction"; -} - function shouldFetchTraceForEvent(event: Event): { traceId: string } | null { // Only fetch traces for non-error events (transactions, profiling, etc.) if (isErrorEvent(event)) { diff --git a/packages/mcp-core/src/tools/support/profile/analyzer.ts b/packages/mcp-core/src/tools/support/profile/analyzer.ts index 6d54eb994..05eb8490c 100644 --- a/packages/mcp-core/src/tools/support/profile/analyzer.ts +++ b/packages/mcp-core/src/tools/support/profile/analyzer.ts @@ -352,12 +352,11 @@ export function compareFrameStats( // Compare frames that exist in both const comparisons: FrameComparison[] = []; - for (const [fingerprint, indices] of frameMap.entries()) { + for (const indices of frameMap.values()) { if (indices.baselineIdx === undefined || indices.currentIdx === undefined) { continue; // Frame only in one dataset } - const baselineFrame = baselineFrames[indices.baselineIdx]; const currentFrame = currentFrames[indices.currentIdx]; const baselineInfo = baselineInfos[indices.baselineIdx] || DEFAULT_FRAME_INFO; diff --git a/packages/mcp-core/src/tools/support/search-attributes/search.ts b/packages/mcp-core/src/tools/support/search-attributes/search.ts index 42fc333d7..6dcd32e2b 100644 --- a/packages/mcp-core/src/tools/support/search-attributes/search.ts +++ b/packages/mcp-core/src/tools/support/search-attributes/search.ts @@ -1,4 +1,3 @@ -import type { TraceItemType } from "../../../api-client"; import { apiServiceFromContext } from "../../../internal/tool-helpers/api"; import { setTargetTagsAndAttributes } from "../../../telem/scope"; import type { ServerContext } from "../../../types"; diff --git a/packages/mcp-core/src/tools/support/search-events/agent.ts b/packages/mcp-core/src/tools/support/search-events/agent.ts index 8c727cf14..79bc3efa0 100644 --- a/packages/mcp-core/src/tools/support/search-events/agent.ts +++ b/packages/mcp-core/src/tools/support/search-events/agent.ts @@ -208,11 +208,7 @@ export async function searchEventsAgent( organizationSlug: options.organizationSlug, projectId: options.projectId, }); - const otelLookupTool = createOtelLookupTool({ - apiService: options.apiService, - organizationSlug: options.organizationSlug, - projectId: options.projectId, - }); + const otelLookupTool = createOtelLookupTool(); const replayFieldsTool = createDatasetFieldsTool({ apiService: options.apiService, organizationSlug: options.organizationSlug, diff --git a/packages/mcp-server-mocks/src/index.ts b/packages/mcp-server-mocks/src/index.ts index f5e900d24..f8cfd34d9 100644 --- a/packages/mcp-server-mocks/src/index.ts +++ b/packages/mcp-server-mocks/src/index.ts @@ -1102,7 +1102,7 @@ export const restHandlers = buildHandlers([ fields.length > 0 ? null : "Orderby must also be a selected field", })); - const environmentResults = environments.map((environment) => ({ + const environmentResults = environments.map(() => ({ valid: true, error: null, })); @@ -1455,8 +1455,7 @@ export const restHandlers = buildHandlers([ { method: "post", path: "/api/0/projects/sentry-mcp-evals/cloudflare-mcp/teams/:teamSlug/", - fetch: async ({ request, params }) => { - const body = (await request.json()) as any; + fetch: async ({ params }) => { const teamSlug = params.teamSlug as string; return HttpResponse.json({ ...teamFixture, diff --git a/packages/mcp-test-client/src/logger.test.ts b/packages/mcp-test-client/src/logger.test.ts index 7a567375a..3735a4ee0 100644 --- a/packages/mcp-test-client/src/logger.test.ts +++ b/packages/mcp-test-client/src/logger.test.ts @@ -12,17 +12,14 @@ import { } from "./logger.js"; describe("Logger", () => { - let processStdoutWriteSpy: ReturnType; let capturedOutput: string; beforeEach(() => { capturedOutput = ""; - processStdoutWriteSpy = vi - .spyOn(process.stdout, "write") - .mockImplementation((chunk) => { - capturedOutput += chunk; - return true; - }); + vi.spyOn(process.stdout, "write").mockImplementation((chunk) => { + capturedOutput += chunk; + return true; + }); }); afterEach(() => {