Skip to content

Commit 593c03b

Browse files
ochafikclaude
andcommitted
fix: resolve lint errors
- Remove unused JSONRPCResponse import from protocol.ts - Remove unused RequestParamsSchema import from types.ts - Remove unused AssertObjectSchema from types.ts (now in generated schemas) - Add eslint-disable for intentional _progressTypeCheck - Add eslint-disable for empty interfaces in generated sdk.types.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c3cc13e commit 593c03b

File tree

9 files changed

+295
-391
lines changed

9 files changed

+295
-391
lines changed

scripts/generate-schemas.ts

Lines changed: 83 additions & 85 deletions
Large diffs are not rendered by default.

src/examples/client/simpleTaskInteractiveClient.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ function getTextContent(result: { content: Array<{ type: string; text?: string }
4141
return textContent?.text ?? '(no text)';
4242
}
4343

44-
async function elicitationCallback(params: {
45-
mode?: string;
46-
message: string;
47-
requestedSchema?: object;
48-
}): Promise<ElicitResult> {
44+
async function elicitationCallback(params: { mode?: string; message: string; requestedSchema?: object }): Promise<ElicitResult> {
4945
console.log(`\n[Elicitation] Server asks: ${params.message}`);
5046

5147
// Simple terminal prompt for y/n

src/generated/sdk.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-empty-object-type */
12
/**
23
* SDK-compatible types generated from spec.types.ts
34
*

src/shared/protocol.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
JSONRPCErrorResponse,
2121
JSONRPCNotification,
2222
JSONRPCRequest,
23-
JSONRPCResponse,
2423
McpError,
2524
PingRequestSchema,
2625
Progress,

src/types.ts

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
ResourceTemplateReference,
2424
PromptReference,
2525
CompleteRequestParams,
26-
ProgressNotificationParams,
26+
ProgressNotificationParams
2727
} from './generated/sdk.types.js';
2828

2929
// =============================================================================
@@ -77,7 +77,6 @@ import {
7777
TextResourceContentsSchema,
7878
BlobResourceContentsSchema,
7979
// Request/notification base schemas (with RELATED_TASK_META_KEY injected)
80-
RequestParamsSchema,
8180
TaskAugmentedRequestParamsSchema,
8281
NotificationParamsSchema,
8382
// Core request/notification schemas (params include proper _meta typing)
@@ -227,7 +226,7 @@ import {
227226
ClientCapabilitiesSchema,
228227
ServerCapabilitiesSchema,
229228
// Progress
230-
ProgressNotificationParamsSchema,
229+
ProgressNotificationParamsSchema
231230
} from './generated/sdk.schemas.js';
232231

233232
export {
@@ -375,7 +374,7 @@ export {
375374
ServerTasksCapabilitySchema,
376375
ClientCapabilitiesSchema,
377376
ServerCapabilitiesSchema,
378-
ProgressNotificationParamsSchema,
377+
ProgressNotificationParamsSchema
379378
};
380379

381380
export const LATEST_PROTOCOL_VERSION = '2025-11-25';
@@ -391,12 +390,6 @@ export const JSONRPC_VERSION = '2.0';
391390
* Utility types
392391
*/
393392
type ExpandRecursively<T> = T extends object ? (T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never) : T;
394-
/**
395-
* Assert 'object' type schema.
396-
*
397-
* @internal
398-
*/
399-
const AssertObjectSchema = z.custom<object>((v): v is object => v !== null && (typeof v === 'object' || typeof v === 'function'));
400393

401394
/**
402395
* Task creation parameters, used to ask that the server create a task to represent a request.
@@ -425,7 +418,6 @@ export const TaskCreationParamsSchema = z.looseObject({
425418
export const isTaskAugmentedRequestParams = (value: unknown): value is TaskAugmentedRequestParams =>
426419
TaskAugmentedRequestParamsSchema.safeParse(value).success;
427420

428-
429421
export const isJSONRPCRequest = (value: unknown): value is JSONRPCRequest => JSONRPCRequestSchema.safeParse(value).success;
430422
export const isJSONRPCNotification = (value: unknown): value is JSONRPCNotification => JSONRPCNotificationSchema.safeParse(value).success;
431423
export const isJSONRPCResultResponse = (value: unknown): value is JSONRPCResultResponse =>
@@ -471,9 +463,6 @@ export const ElicitationCapabilitySchema = ClientCapabilitiesSchema.shape.elicit
471463

472464
export const isInitializeRequest = (value: unknown): value is InitializeRequest => InitializeRequestSchema.safeParse(value).success;
473465

474-
475-
476-
477466
export const isInitializedNotification = (value: unknown): value is InitializedNotification =>
478467
InitializedNotificationSchema.safeParse(value).success;
479468

@@ -492,18 +481,14 @@ export const ProgressSchema = ProgressNotificationParamsSchema.omit({ progressTo
492481

493482
/* Resources */
494483

495-
496-
497484
// ResourceRequestParamsSchema, ReadResourceRequestParamsSchema,
498485
// SubscribeRequestParamsSchema, UnsubscribeRequestParamsSchema,
499486
// ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema,
500487

501488
/* Prompts */
502489

503-
504490
// from generated with Base64 validation for data fields.
505491

506-
507492
/* Tools */
508493
// ListToolsResultSchema, CallToolResultSchema, CallToolRequestParamsSchema,
509494

@@ -613,12 +598,10 @@ export const SamplingContentSchema = z.discriminatedUnion('type', [TextContentSc
613598
* Uses single content block without tool types for v1.x API compatibility.
614599
* For tool use support, use CreateMessageResultWithToolsSchema instead.
615600
*/
616-
export const CreateMessageResultSchema = CreateMessageResultSpecSchema
617-
.omit({ content: true })
618-
.extend({
619-
/** Response content. Single block, basic types only (text/image/audio). */
620-
content: SamplingContentSchema
621-
});
601+
export const CreateMessageResultSchema = CreateMessageResultSpecSchema.omit({ content: true }).extend({
602+
/** Response content. Single block, basic types only (text/image/audio). */
603+
content: SamplingContentSchema
604+
});
622605

623606
/**
624607
* The client's response to a sampling/create_message request when tools were provided.
@@ -653,7 +636,6 @@ export const CreateMessageResultWithToolsSchema = ResultSchema.extend({
653636
// LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, UntitledMultiSelectEnumSchemaSchema,
654637
// TitledMultiSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema, EnumSchemaSchema,
655638

656-
657639
/**
658640
* Parameters for a `notifications/elicitation/complete` notification.
659641
*
@@ -673,7 +655,6 @@ export const ElicitationCompleteNotificationParamsSchema = NotificationParamsSch
673655
*/
674656
export const ResourceReferenceSchema = ResourceTemplateReferenceSchema;
675657

676-
677658
export function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt {
678659
if (request.params.ref.type !== 'ref/prompt') {
679660
throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
@@ -793,11 +774,7 @@ export interface MessageExtraInfo {
793774
}
794775

795776
// Import base types with aliases to avoid DOM collision, then re-export
796-
import type {
797-
Request as _Request,
798-
Notification as _Notification,
799-
Result as _Result,
800-
} from './generated/sdk.types.js';
777+
import type { Request as _Request, Notification as _Notification, Result as _Result } from './generated/sdk.types.js';
801778

802779
// Re-export with original names
803780
export type { _Request as Request, _Notification as Notification, _Result as Result };
@@ -967,7 +944,7 @@ export type {
967944
// Server messages
968945
ServerRequest,
969946
ServerNotification,
970-
ServerResult,
947+
ServerResult
971948
} from './generated/sdk.types.js';
972949

973950
/**
@@ -983,7 +960,9 @@ export type JSONRPCResponse = Infer<typeof JSONRPCResponseSchema>;
983960
// Progress type - derived from ProgressNotificationParams without progressToken
984961
export type Progress = Omit<ProgressNotificationParams, 'progressToken'>;
985962
// Type check: ensure Progress matches the inferred schema type
986-
type _ProgressCheck = Progress extends Infer<typeof ProgressSchema> ? Infer<typeof ProgressSchema> extends Progress ? true : never : never;
963+
type _ProgressCheck =
964+
Progress extends Infer<typeof ProgressSchema> ? (Infer<typeof ProgressSchema> extends Progress ? true : never) : never;
965+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
987966
const _progressTypeCheck: _ProgressCheck = true;
988967

989968
// Task creation params (SDK-specific)
@@ -1023,4 +1002,3 @@ export type CompleteRequestResourceTemplate = ExpandRecursively<
10231002
CompleteRequest & { params: CompleteRequestParams & { ref: ResourceTemplateReference } }
10241003
>;
10251004
export type CompleteRequestPrompt = ExpandRecursively<CompleteRequest & { params: CompleteRequestParams & { ref: PromptReference } }>;
1026-

test/client/stdio.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ test('should read messages', async () => {
5454

5555
// Compare message content instead of JSON.stringify (Zod reorders keys)
5656
const msg1 = messages[1];
57-
if ('method' in message && 'method' in msg1 &&
58-
message.method === msg1.method && message.jsonrpc === msg1.jsonrpc) {
57+
if ('method' in message && 'method' in msg1 && message.method === msg1.method && message.jsonrpc === msg1.jsonrpc) {
5958
resolve();
6059
}
6160
};

0 commit comments

Comments
 (0)