Skip to content

Commit cc49983

Browse files
ochafikclaude
andcommitted
refactor: re-export Resource and Logging params schemas
Continue progressive re-export: - ResourceRequestParamsSchema, ReadResourceRequestParamsSchema - SubscribeRequestParamsSchema, UnsubscribeRequestParamsSchema - ResourceUpdatedNotificationParamsSchema - SetLevelRequestParamsSchema Types.ts reduced from ~1299 to ~1275 lines. Total reduction from original ~2600 lines: ~51%. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1705f98 commit cc49983

File tree

1 file changed

+20
-44
lines changed

1 file changed

+20
-44
lines changed

src/types.ts

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ import {
185185
LoggingMessageNotificationParamsSchema,
186186
// EmptyResult (with .strict())
187187
EmptyResultSchema,
188+
// Resource request params schemas
189+
ResourceRequestParamsSchema,
190+
ReadResourceRequestParamsSchema,
191+
SubscribeRequestParamsSchema,
192+
UnsubscribeRequestParamsSchema,
193+
ResourceUpdatedNotificationParamsSchema,
194+
SetLevelRequestParamsSchema,
188195
} from './generated/sdk.schemas.js';
189196

190197
// Alias RequestParamsSchema to BaseRequestParamsSchema for internal use
@@ -323,6 +330,12 @@ export {
323330
GetPromptRequestParamsSchema,
324331
LoggingMessageNotificationParamsSchema,
325332
EmptyResultSchema,
333+
ResourceRequestParamsSchema,
334+
ReadResourceRequestParamsSchema,
335+
SubscribeRequestParamsSchema,
336+
UnsubscribeRequestParamsSchema,
337+
ResourceUpdatedNotificationParamsSchema,
338+
SetLevelRequestParamsSchema,
326339
};
327340

328341
export const LATEST_PROTOCOL_VERSION = '2025-11-25';
@@ -682,39 +695,11 @@ export const ProgressNotificationParamsSchema = z.object({
682695
// Note: ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, SubscribeRequestSchema,
683696
// UnsubscribeRequestSchema are re-exported from generated.
684697

685-
// Note: ListResourcesResultSchema, ListResourceTemplatesResultSchema are re-exported from generated.
686-
687-
export const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({
688-
/**
689-
* The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
690-
*
691-
* @format uri
692-
*/
693-
uri: z.string()
694-
});
695-
696-
/**
697-
* Parameters for a `resources/read` request.
698-
*/
699-
export const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;
700-
701-
// Note: ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema
702-
// are re-exported from generated.
703-
704-
export const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;
705-
export const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;
706-
707-
/**
708-
* Parameters for a `notifications/resources/updated` notification.
709-
*/
710-
export const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({
711-
/**
712-
* The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
713-
*/
714-
uri: z.string()
715-
});
716-
717-
// Note: ResourceUpdatedNotificationSchema is re-exported from generated.
698+
// Note: ListResourcesResultSchema, ListResourceTemplatesResultSchema,
699+
// ResourceRequestParamsSchema, ReadResourceRequestParamsSchema,
700+
// SubscribeRequestParamsSchema, UnsubscribeRequestParamsSchema,
701+
// ReadResourceRequestSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema,
702+
// ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema are re-exported from generated.
718703

719704
/* Prompts */
720705
// Note: PromptArgumentSchema, PromptSchema, ListPromptsRequestSchema, GetPromptRequestSchema
@@ -823,17 +808,8 @@ export type ListChangedHandlers = {
823808
};
824809

825810
/* Logging */
826-
/**
827-
* Parameters for a `logging/setLevel` request.
828-
*/
829-
export const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({
830-
/**
831-
* The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
832-
*/
833-
level: LoggingLevelSchema
834-
});
835-
// Note: SetLevelRequestSchema, LoggingMessageNotificationSchema, LoggingMessageNotificationParamsSchema
836-
// are re-exported from generated.
811+
// Note: SetLevelRequestParamsSchema, SetLevelRequestSchema, LoggingMessageNotificationSchema,
812+
// LoggingMessageNotificationParamsSchema are re-exported from generated.
837813

838814
/* Sampling */
839815
// Note: ToolResultContentSchema is re-exported from generated.

0 commit comments

Comments
 (0)