Initial import
This commit is contained in:
commit
02e421c1f1
1 changed files with 8130 additions and 0 deletions
25
src/types/index.ts
Normal file
25
src/types/index.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { ProgressNotification, PingRequest } from "./schema.js";
|
||||
export * from "./schema.js";
|
||||
|
||||
export const CONNECTION_CLOSED_ERROR = -1;
|
||||
|
||||
export class McpError extends Error {
|
||||
constructor(
|
||||
public readonly code: number,
|
||||
message: string,
|
||||
public readonly data?: unknown,
|
||||
) {
|
||||
super(`MCP error ${code}: ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
export type Progress = Pick<
|
||||
ProgressNotification["params"],
|
||||
"progress" | "total"
|
||||
>;
|
||||
|
||||
export const PROGRESS_NOTIFICATION_METHOD: ProgressNotification["method"] =
|
||||
"notifications/progress";
|
||||
export const PING_REQUEST_METHOD: PingRequest["method"] = "ping";
|
||||
|
||||
export type RequestId = string | number;
|
||||
Loading…
Reference in a new issue