style: fixed linting issues
This commit is contained in:
parent
e7d08c738e
commit
d77cd0deb3
1 changed files with 18 additions and 18 deletions
36
src/types.ts
36
src/types.ts
|
|
@ -29,7 +29,7 @@ const BaseRequestParamsSchema = z
|
|||
*/
|
||||
progressToken: z.optional(ProgressTokenSchema),
|
||||
})
|
||||
.passthrough()
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
|
@ -100,16 +100,16 @@ export const JSONRPCResponseSchema = z
|
|||
.strict();
|
||||
|
||||
/**
|
||||
* @author : Sumitesh Naithani
|
||||
* @link : https://docs.trafficserver.apache.org/en/latest/developer-guide/jsonrpc/jsonrpc-node-errors.en.html#standard-errors
|
||||
* @description : An incomplete set of error codes that may appear in JSON-RPC responses.
|
||||
* @note : SDK-specific errors should use the server error range (-32000 to -32099), as per JSON-RPC 2.0 specification.
|
||||
*/
|
||||
* @author : Sumitesh Naithani
|
||||
* @link : https://docs.trafficserver.apache.org/en/latest/developer-guide/jsonrpc/jsonrpc-node-errors.en.html#standard-errors
|
||||
* @description : An incomplete set of error codes that may appear in JSON-RPC responses.
|
||||
* @note : SDK-specific errors should use the server error range (-32000 to -32099), as per JSON-RPC 2.0 specification.
|
||||
*/
|
||||
export enum ErrorCode {
|
||||
// SDK error codes (using server error range)
|
||||
ConnectionClosed = -32000,
|
||||
RequestTimeout = -32001,
|
||||
|
||||
|
||||
// Standard JSON-RPC error codes
|
||||
ParseError = -32700,
|
||||
InvalidRequest = -32600,
|
||||
|
|
@ -217,7 +217,7 @@ export const ClientCapabilitiesSchema = z
|
|||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough()
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
|
@ -261,7 +261,7 @@ export const ServerCapabilitiesSchema = z
|
|||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough()
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any resources to read.
|
||||
|
|
@ -279,7 +279,7 @@ export const ServerCapabilitiesSchema = z
|
|||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough()
|
||||
.passthrough(),
|
||||
),
|
||||
/**
|
||||
* Present if the server offers any tools to call.
|
||||
|
|
@ -292,7 +292,7 @@ export const ServerCapabilitiesSchema = z
|
|||
*/
|
||||
listChanged: z.optional(z.boolean()),
|
||||
})
|
||||
.passthrough()
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.passthrough();
|
||||
|
|
@ -483,7 +483,7 @@ export const ListResourcesResultSchema = PaginatedResultSchema.extend({
|
|||
export const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend(
|
||||
{
|
||||
method: z.literal("resources/templates/list"),
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -511,7 +511,7 @@ export const ReadResourceRequestSchema = RequestSchema.extend({
|
|||
*/
|
||||
export const ReadResourceResultSchema = ResultSchema.extend({
|
||||
contents: z.array(
|
||||
z.union([TextResourceContentsSchema, BlobResourceContentsSchema])
|
||||
z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
||||
),
|
||||
});
|
||||
|
||||
|
|
@ -750,7 +750,7 @@ export const ListToolsResultSchema = PaginatedResultSchema.extend({
|
|||
*/
|
||||
export const CallToolResultSchema = ResultSchema.extend({
|
||||
content: z.array(
|
||||
z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])
|
||||
z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema]),
|
||||
),
|
||||
isError: z.boolean().default(false).optional(),
|
||||
});
|
||||
|
|
@ -761,7 +761,7 @@ export const CallToolResultSchema = ResultSchema.extend({
|
|||
export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(
|
||||
ResultSchema.extend({
|
||||
toolResult: z.unknown(),
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -922,7 +922,7 @@ export const CreateMessageResultSchema = ResultSchema.extend({
|
|||
* The reason why sampling stopped.
|
||||
*/
|
||||
stopReason: z.optional(
|
||||
z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string())
|
||||
z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string()),
|
||||
),
|
||||
role: z.enum(["user", "assistant"]),
|
||||
content: z.discriminatedUnion("type", [
|
||||
|
|
@ -1107,7 +1107,7 @@ export class McpError extends Error {
|
|||
constructor(
|
||||
public readonly code: number,
|
||||
message: string,
|
||||
public readonly data?: unknown
|
||||
public readonly data?: unknown,
|
||||
) {
|
||||
super(`MCP error ${code}: ${message}`);
|
||||
}
|
||||
|
|
@ -1240,4 +1240,4 @@ export type ClientResult = z.infer<typeof ClientResultSchema>;
|
|||
/* Server messages */
|
||||
export type ServerRequest = z.infer<typeof ServerRequestSchema>;
|
||||
export type ServerNotification = z.infer<typeof ServerNotificationSchema>;
|
||||
export type ServerResult = z.infer<typeof ServerResultSchema>;
|
||||
export type ServerResult = z.infer<typeof ServerResultSchema>;
|
||||
Loading…
Reference in a new issue