| 1 | /** |
| 2 | * Exact MCP v2024-11-05 wire schemas. |
| 3 | * |
| 4 | * Transport topology is intentionally not represented here. This module owns |
| 5 | * the dated JSON-RPC method payloads and results only. |
| 6 | * |
| 7 | * @internal |
| 8 | */ |
| 9 | import * as Option from "../../../Option.ts" |
| 10 | import * as Rpc from "../../../rpc/Rpc.ts" |
| 11 | import * as RpcGroup from "../../../rpc/RpcGroup.ts" |
| 12 | import * as Schema from "../../../Schema.ts" |
| 13 | import * as SchemaGetter from "../../../SchemaGetter.ts" |
| 14 | |
| 15 | /** |
| 16 | * @internal |
| 17 | */ |
| 18 | export const protocolVersion = "2024-11-05" |
| 19 | |
| 20 | /** |
| 21 | * @internal |
| 22 | */ |
| 23 | export const optional = <S extends Schema.Constraint>( |
| 24 | schema: S |
| 25 | ): Schema.decodeTo<Schema.toType<Schema.optional<S>>, Schema.optionalKey<S>> => |
| 26 | Schema.optionalKey(schema).pipe( |
| 27 | Schema.decodeTo(Schema.toType(Schema.optional(schema)), { |
| 28 | decode: SchemaGetter.passthrough(), |
| 29 | encode: SchemaGetter.transformOptional(Option.flatMap(Option.fromUndefinedOr)) |
| 30 | }) |
| 31 | ) |
| 32 | const JsonObject = Schema.JsonObject |
| 33 | |
| 34 | /** |
| 35 | * @internal |
| 36 | */ |
| 37 | export const RequestId = Schema.Union([Schema.String, Schema.Finite]) |
| 38 | /** |
| 39 | * @internal |
| 40 | */ |
| 41 | export const ProgressToken = Schema.Union([Schema.String, Schema.Finite]) |
| 42 | /** |
| 43 | * @internal |
| 44 | */ |
| 45 | export const Role = Schema.Literals(["user", "assistant"]) |
| 46 | /** |
| 47 | * @internal |
| 48 | */ |
| 49 | export const LoggingLevel = Schema.Literals([ |
| 50 | "debug", |
| 51 | "info", |
| 52 | "notice", |
| 53 | "warning", |
| 54 | "error", |
| 55 | "critical", |
| 56 | "alert", |
| 57 | "emergency" |
| 58 | ]) |
| 59 | |
| 60 | /** |
| 61 | * @internal |
| 62 | */ |
| 63 | export const RequestMeta = Schema.Struct({ |
| 64 | _meta: optional(Schema.StructWithRest( |
| 65 | Schema.Struct({ |
| 66 | progressToken: optional(ProgressToken) |
| 67 | }), |
| 68 | [Schema.JsonObject] |
| 69 | )) |
| 70 | }) |
| 71 | |
| 72 | /** |
| 73 | * @internal |
| 74 | */ |
| 75 | export const NotificationMeta = Schema.Struct({ |
| 76 | _meta: optional(JsonObject) |
| 77 | }) |
| 78 | |
| 79 | /** |
| 80 | * @internal |
| 81 | */ |
| 82 | export const ResultMeta = Schema.Struct({ |
| 83 | _meta: optional(JsonObject) |
| 84 | }) |
| 85 | |
| 86 | /** |
| 87 | * @internal |
| 88 | */ |
| 89 | export const PaginatedRequest = Schema.Struct({ |
| 90 | ...RequestMeta.fields, |
| 91 | cursor: optional(Schema.String) |
| 92 | }) |
| 93 | |
| 94 | /** |
| 95 | * @internal |
| 96 | */ |
| 97 | export const PaginatedResult = Schema.Struct({ |
| 98 | ...ResultMeta.fields, |
| 99 | nextCursor: optional(Schema.String) |
| 100 | }) |
| 101 | |
| 102 | /** |
| 103 | * @internal |
| 104 | */ |
| 105 | export const Implementation = Schema.Struct({ |
| 106 | name: Schema.String, |
| 107 | version: Schema.String |
| 108 | }) |
| 109 | |
| 110 | /** |
| 111 | * @internal |
| 112 | */ |
| 113 | export const ClientCapabilities = Schema.Struct({ |
| 114 | extensions: optional(Schema.Record(Schema.TemplateLiteral([Schema.String, "/", Schema.String]), Schema.Json)), |
| 115 | experimental: optional(Schema.Record(Schema.String, JsonObject)), |
| 116 | roots: optional(Schema.Struct({ |
| 117 | listChanged: optional(Schema.Boolean) |
| 118 | })), |
| 119 | sampling: optional(JsonObject) |
| 120 | }) |
| 121 | |
| 122 | /** |
| 123 | * @internal |
| 124 | */ |
| 125 | export const ServerCapabilities = Schema.Struct({ |
| 126 | extensions: optional(Schema.Record(Schema.TemplateLiteral([Schema.String, "/", Schema.String]), Schema.Json)), |
| 127 | experimental: optional(Schema.Record(Schema.String, JsonObject)), |
| 128 | logging: optional(JsonObject), |
| 129 | prompts: optional(Schema.Struct({ |
| 130 | listChanged: optional(Schema.Boolean) |
| 131 | })), |
| 132 | resources: optional(Schema.Struct({ |
| 133 | subscribe: optional(Schema.Boolean), |
| 134 | listChanged: optional(Schema.Boolean) |
| 135 | })), |
| 136 | tools: optional(Schema.Struct({ |
| 137 | listChanged: optional(Schema.Boolean) |
| 138 | })) |
| 139 | }) |
| 140 | |
| 141 | /** |
| 142 | * @internal |
| 143 | */ |
| 144 | export const McpError = Schema.Struct({ |
| 145 | code: Schema.Int, |
| 146 | message: Schema.String, |
| 147 | data: optional(Schema.Any) |
| 148 | }) |
| 149 | /** |
| 150 | * @internal |
| 151 | */ |
| 152 | export type McpError = typeof McpError.Type |
| 153 | |
| 154 | /** |
| 155 | * @internal |
| 156 | */ |
| 157 | export const Annotation = Schema.Struct({ |
| 158 | audience: optional(Schema.Array(Role)), |
| 159 | priority: optional(Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 1 }))) |
| 160 | }) |
| 161 | |
| 162 | /** |
| 163 | * @internal |
| 164 | */ |
| 165 | export const TextResourceContents = Schema.Struct({ |
| 166 | uri: Schema.String, |
| 167 | mimeType: optional(Schema.String), |
| 168 | text: Schema.String |
| 169 | }) |
| 170 | |
| 171 | /** |
| 172 | * @internal |
| 173 | */ |
| 174 | export const BlobResourceContents = Schema.Struct({ |
| 175 | uri: Schema.String, |
| 176 | mimeType: optional(Schema.String), |
| 177 | blob: Schema.String |
| 178 | }) |
| 179 | |
| 180 | /** |
| 181 | * @internal |
| 182 | */ |
| 183 | export const ResourceContents = Schema.Union([ |
| 184 | TextResourceContents, |
| 185 | BlobResourceContents |
| 186 | ]) |
| 187 | |
| 188 | /** |
| 189 | * @internal |
| 190 | */ |
| 191 | export const TextContent = Schema.Struct({ |
| 192 | type: Schema.Literal("text"), |
| 193 | text: Schema.String, |
| 194 | annotations: optional(Annotation) |
| 195 | }) |
| 196 | |
| 197 | /** |
| 198 | * @internal |
| 199 | */ |
| 200 | export const ImageContent = Schema.Struct({ |
| 201 | type: Schema.Literal("image"), |
| 202 | data: Schema.String, |
| 203 | mimeType: Schema.String, |
| 204 | annotations: optional(Annotation) |
| 205 | }) |
| 206 | |
| 207 | /** |
| 208 | * @internal |
| 209 | */ |
| 210 | export const EmbeddedResource = Schema.Struct({ |
| 211 | type: Schema.Literal("resource"), |
| 212 | resource: ResourceContents, |
| 213 | annotations: optional(Annotation) |
| 214 | }) |
| 215 | |
| 216 | /** |
| 217 | * @internal |
| 218 | */ |
| 219 | export const PromptOrToolContent = Schema.Union([ |
| 220 | TextContent, |
| 221 | ImageContent, |
| 222 | EmbeddedResource |
| 223 | ]) |
| 224 | |
| 225 | /** |
| 226 | * @internal |
| 227 | */ |
| 228 | export const SamplingContent = Schema.Union([ |
| 229 | TextContent, |
| 230 | ImageContent |
| 231 | ]) |
| 232 | |
| 233 | /** |
| 234 | * @internal |
| 235 | */ |
| 236 | export const Resource = Schema.Struct({ |
| 237 | uri: Schema.String, |
| 238 | name: Schema.String, |
| 239 | description: optional(Schema.String), |
| 240 | mimeType: optional(Schema.String), |
| 241 | size: optional(Schema.Finite), |
| 242 | annotations: optional(Annotation) |
| 243 | }) |
| 244 | |
| 245 | /** |
| 246 | * @internal |
| 247 | */ |
| 248 | export const ResourceTemplate = Schema.Struct({ |
| 249 | uriTemplate: Schema.String, |
| 250 | name: Schema.String, |
| 251 | description: optional(Schema.String), |
| 252 | mimeType: optional(Schema.String), |
| 253 | annotations: optional(Annotation) |
| 254 | }) |
| 255 | |
| 256 | /** |
| 257 | * @internal |
| 258 | */ |
| 259 | export const PromptArgument = Schema.Struct({ |
| 260 | name: Schema.String, |
| 261 | description: optional(Schema.String), |
| 262 | required: optional(Schema.Boolean) |
| 263 | }) |
| 264 | |
| 265 | /** |
| 266 | * @internal |
| 267 | */ |
| 268 | export const Prompt = Schema.Struct({ |
| 269 | name: Schema.String, |
| 270 | description: optional(Schema.String), |
| 271 | arguments: optional(Schema.Array(PromptArgument)) |
| 272 | }) |
| 273 | |
| 274 | /** |
| 275 | * @internal |
| 276 | */ |
| 277 | export const PromptMessage = Schema.Struct({ |
| 278 | role: Role, |
| 279 | content: PromptOrToolContent |
| 280 | }) |
| 281 | |
| 282 | /** |
| 283 | * @internal |
| 284 | */ |
| 285 | export const ToolInputSchema = Schema.Struct({ |
| 286 | type: Schema.Literal("object"), |
| 287 | properties: optional(Schema.Record(Schema.String, JsonObject)), |
| 288 | required: optional(Schema.Array(Schema.String)) |
| 289 | }) |
| 290 | |
| 291 | /** |
| 292 | * @internal |
| 293 | */ |
| 294 | export const Tool = Schema.Struct({ |
| 295 | name: Schema.String, |
| 296 | description: optional(Schema.String), |
| 297 | inputSchema: ToolInputSchema |
| 298 | }) |
| 299 | |
| 300 | /** |
| 301 | * @internal |
| 302 | */ |
| 303 | export const ModelHint = Schema.Struct({ |
| 304 | name: optional(Schema.String) |
| 305 | }) |
| 306 | |
| 307 | /** |
| 308 | * @internal |
| 309 | */ |
| 310 | export const ModelPreferences = Schema.Struct({ |
| 311 | hints: optional(Schema.Array(ModelHint)), |
| 312 | costPriority: optional(Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 1 }))), |
| 313 | speedPriority: optional(Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 1 }))), |
| 314 | intelligencePriority: optional(Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: 1 }))) |
| 315 | }) |
| 316 | |
| 317 | /** |
| 318 | * @internal |
| 319 | */ |
| 320 | export const SamplingMessage = Schema.Struct({ |
| 321 | role: Role, |
| 322 | content: SamplingContent |
| 323 | }) |
| 324 | |
| 325 | /** |
| 326 | * @internal |
| 327 | */ |
| 328 | export const ResourceReference = Schema.Struct({ |
| 329 | type: Schema.Literal("ref/resource"), |
| 330 | uri: Schema.String |
| 331 | }) |
| 332 | |
| 333 | /** |
| 334 | * @internal |
| 335 | */ |
| 336 | export const PromptReference = Schema.Struct({ |
| 337 | type: Schema.Literal("ref/prompt"), |
| 338 | name: Schema.String |
| 339 | }) |
| 340 | |
| 341 | /** |
| 342 | * @internal |
| 343 | */ |
| 344 | export const Root = Schema.Struct({ |
| 345 | uri: Schema.String, |
| 346 | name: optional(Schema.String) |
| 347 | }) |
| 348 | |
| 349 | /** |
| 350 | * @internal |
| 351 | */ |
| 352 | export const InitializeResult = Schema.Struct({ |
| 353 | ...ResultMeta.fields, |
| 354 | protocolVersion: Schema.String, |
| 355 | capabilities: ServerCapabilities, |
| 356 | serverInfo: Implementation, |
| 357 | instructions: optional(Schema.String) |
| 358 | }) |
| 359 | |
| 360 | /** |
| 361 | * @internal |
| 362 | */ |
| 363 | export const ListResourcesResult = Schema.Struct({ |
| 364 | ...PaginatedResult.fields, |
| 365 | resources: Schema.Array(Resource) |
| 366 | }) |
| 367 | |
| 368 | /** |
| 369 | * @internal |
| 370 | */ |
| 371 | export const ListResourceTemplatesResult = Schema.Struct({ |
| 372 | ...PaginatedResult.fields, |
| 373 | resourceTemplates: Schema.Array(ResourceTemplate) |
| 374 | }) |
| 375 | |
| 376 | /** |
| 377 | * @internal |
| 378 | */ |
| 379 | export const ReadResourceResult = Schema.Struct({ |
| 380 | ...ResultMeta.fields, |
| 381 | contents: Schema.Array(ResourceContents) |
| 382 | }) |
| 383 | |
| 384 | /** |
| 385 | * @internal |
| 386 | */ |
| 387 | export const ListPromptsResult = Schema.Struct({ |
| 388 | ...PaginatedResult.fields, |
| 389 | prompts: Schema.Array(Prompt) |
| 390 | }) |
| 391 | |
| 392 | /** |
| 393 | * @internal |
| 394 | */ |
| 395 | export const GetPromptResult = Schema.Struct({ |
| 396 | ...ResultMeta.fields, |
| 397 | description: optional(Schema.String), |
| 398 | messages: Schema.Array(PromptMessage) |
| 399 | }) |
| 400 | |
| 401 | /** |
| 402 | * @internal |
| 403 | */ |
| 404 | export const ListToolsResult = Schema.Struct({ |
| 405 | ...PaginatedResult.fields, |
| 406 | tools: Schema.Array(Tool) |
| 407 | }) |
| 408 | |
| 409 | /** |
| 410 | * @internal |
| 411 | */ |
| 412 | export const CallToolResult = Schema.Struct({ |
| 413 | ...ResultMeta.fields, |
| 414 | content: Schema.Array(PromptOrToolContent), |
| 415 | isError: optional(Schema.Boolean) |
| 416 | }) |
| 417 | |
| 418 | /** |
| 419 | * @internal |
| 420 | */ |
| 421 | export const CreateMessageResult = Schema.Struct({ |
| 422 | ...ResultMeta.fields, |
| 423 | role: Role, |
| 424 | content: SamplingContent, |
| 425 | model: Schema.String, |
| 426 | stopReason: optional(Schema.String) |
| 427 | }) |
| 428 | |
| 429 | /** |
| 430 | * @internal |
| 431 | */ |
| 432 | export const CompleteResult = Schema.Struct({ |
| 433 | ...ResultMeta.fields, |
| 434 | completion: Schema.Struct({ |
| 435 | values: Schema.Array(Schema.String), |
| 436 | total: optional(Schema.Finite), |
| 437 | hasMore: optional(Schema.Boolean) |
| 438 | }) |
| 439 | }) |
| 440 | |
| 441 | /** |
| 442 | * @internal |
| 443 | */ |
| 444 | export const ListRootsResult = Schema.Struct({ |
| 445 | ...ResultMeta.fields, |
| 446 | roots: Schema.Array(Root) |
| 447 | }) |
| 448 | |
| 449 | /** |
| 450 | * @internal |
| 451 | */ |
| 452 | export class Ping extends Rpc.make("ping", { |
| 453 | success: ResultMeta, |
| 454 | error: McpError, |
| 455 | payload: Schema.UndefinedOr(RequestMeta) |
| 456 | }) {} |
| 457 | |
| 458 | /** |
| 459 | * @internal |
| 460 | */ |
| 461 | export class Initialize extends Rpc.make("initialize", { |
| 462 | success: InitializeResult, |
| 463 | error: McpError, |
| 464 | payload: { |
| 465 | ...RequestMeta.fields, |
| 466 | protocolVersion: Schema.String, |
| 467 | capabilities: ClientCapabilities, |
| 468 | clientInfo: Implementation |
| 469 | } |
| 470 | }) {} |
| 471 | |
| 472 | /** |
| 473 | * @internal |
| 474 | */ |
| 475 | export class Complete extends Rpc.make("completion/complete", { |
| 476 | success: CompleteResult, |
| 477 | error: McpError, |
| 478 | payload: { |
| 479 | ...RequestMeta.fields, |
| 480 | ref: Schema.Union([PromptReference, ResourceReference]), |
| 481 | argument: Schema.Struct({ |
| 482 | name: Schema.String, |
| 483 | value: Schema.String |
| 484 | }) |
| 485 | } |
| 486 | }) {} |
| 487 | |
| 488 | /** |
| 489 | * @internal |
| 490 | */ |
| 491 | export class SetLevel extends Rpc.make("logging/setLevel", { |
| 492 | success: ResultMeta, |
| 493 | error: McpError, |
| 494 | payload: { |
| 495 | ...RequestMeta.fields, |
| 496 | level: LoggingLevel |
| 497 | } |
| 498 | }) {} |
| 499 | |
| 500 | /** |
| 501 | * @internal |
| 502 | */ |
| 503 | export class GetPrompt extends Rpc.make("prompts/get", { |
| 504 | success: GetPromptResult, |
| 505 | error: McpError, |
| 506 | payload: { |
| 507 | ...RequestMeta.fields, |
| 508 | name: Schema.String, |
| 509 | arguments: optional(Schema.Record(Schema.String, Schema.String)) |
| 510 | } |
| 511 | }) {} |
| 512 | |
| 513 | /** |
| 514 | * @internal |
| 515 | */ |
| 516 | export class ListPrompts extends Rpc.make("prompts/list", { |
| 517 | success: ListPromptsResult, |
| 518 | error: McpError, |
| 519 | payload: Schema.UndefinedOr(PaginatedRequest) |
| 520 | }) {} |
| 521 | |
| 522 | /** |
| 523 | * @internal |
| 524 | */ |
| 525 | export class ListResources extends Rpc.make("resources/list", { |
| 526 | success: ListResourcesResult, |
| 527 | error: McpError, |
| 528 | payload: Schema.UndefinedOr(PaginatedRequest) |
| 529 | }) {} |
| 530 | |
| 531 | /** |
| 532 | * @internal |
| 533 | */ |
| 534 | export class ListResourceTemplates extends Rpc.make("resources/templates/list", { |
| 535 | success: ListResourceTemplatesResult, |
| 536 | error: McpError, |
| 537 | payload: Schema.UndefinedOr(PaginatedRequest) |
| 538 | }) {} |
| 539 | |
| 540 | /** |
| 541 | * @internal |
| 542 | */ |
| 543 | export class ReadResource extends Rpc.make("resources/read", { |
| 544 | success: ReadResourceResult, |
| 545 | error: McpError, |
| 546 | payload: { |
| 547 | ...RequestMeta.fields, |
| 548 | uri: Schema.String |
| 549 | } |
| 550 | }) {} |
| 551 | |
| 552 | /** |
| 553 | * @internal |
| 554 | */ |
| 555 | export class Subscribe extends Rpc.make("resources/subscribe", { |
| 556 | success: ResultMeta, |
| 557 | error: McpError, |
| 558 | payload: { |
| 559 | ...RequestMeta.fields, |
| 560 | uri: Schema.String |
| 561 | } |
| 562 | }) {} |
| 563 | |
| 564 | /** |
| 565 | * @internal |
| 566 | */ |
| 567 | export class Unsubscribe extends Rpc.make("resources/unsubscribe", { |
| 568 | success: ResultMeta, |
| 569 | error: McpError, |
| 570 | payload: { |
| 571 | ...RequestMeta.fields, |
| 572 | uri: Schema.String |
| 573 | } |
| 574 | }) {} |
| 575 | |
| 576 | /** |
| 577 | * @internal |
| 578 | */ |
| 579 | export class CallTool extends Rpc.make("tools/call", { |
| 580 | success: CallToolResult, |
| 581 | error: McpError, |
| 582 | payload: { |
| 583 | ...RequestMeta.fields, |
| 584 | name: Schema.String, |
| 585 | arguments: optional(JsonObject) |
| 586 | } |
| 587 | }) {} |
| 588 | |
| 589 | /** |
| 590 | * @internal |
| 591 | */ |
| 592 | export class ListTools extends Rpc.make("tools/list", { |
| 593 | success: ListToolsResult, |
| 594 | error: McpError, |
| 595 | payload: Schema.UndefinedOr(PaginatedRequest) |
| 596 | }) {} |
| 597 | |
| 598 | /** |
| 599 | * @internal |
| 600 | */ |
| 601 | export class CreateMessage extends Rpc.make("sampling/createMessage", { |
| 602 | success: CreateMessageResult, |
| 603 | error: McpError, |
| 604 | payload: { |
| 605 | ...RequestMeta.fields, |
| 606 | messages: Schema.Array(SamplingMessage), |
| 607 | modelPreferences: optional(ModelPreferences), |
| 608 | systemPrompt: optional(Schema.String), |
| 609 | includeContext: optional(Schema.Literals(["none", "thisServer", "allServers"])), |
| 610 | temperature: optional(Schema.Finite), |
| 611 | maxTokens: Schema.Finite, |
| 612 | stopSequences: optional(Schema.Array(Schema.String)), |
| 613 | metadata: optional(JsonObject) |
| 614 | } |
| 615 | }) {} |
| 616 | |
| 617 | /** |
| 618 | * @internal |
| 619 | */ |
| 620 | export class ListRoots extends Rpc.make("roots/list", { |
| 621 | success: ListRootsResult, |
| 622 | error: McpError, |
| 623 | payload: Schema.UndefinedOr(RequestMeta) |
| 624 | }) {} |
| 625 | |
| 626 | /** |
| 627 | * @internal |
| 628 | */ |
| 629 | export class CancelledNotification extends Rpc.make("notifications/cancelled", { |
| 630 | payload: { |
| 631 | ...NotificationMeta.fields, |
| 632 | requestId: RequestId, |
| 633 | reason: optional(Schema.String) |
| 634 | } |
| 635 | }) {} |
| 636 | |
| 637 | /** |
| 638 | * @internal |
| 639 | */ |
| 640 | export class ProgressNotification extends Rpc.make("notifications/progress", { |
| 641 | payload: { |
| 642 | ...NotificationMeta.fields, |
| 643 | progressToken: ProgressToken, |
| 644 | progress: Schema.Finite, |
| 645 | total: optional(Schema.Finite) |
| 646 | } |
| 647 | }) {} |
| 648 | |
| 649 | /** |
| 650 | * @internal |
| 651 | */ |
| 652 | export class InitializedNotification extends Rpc.make("notifications/initialized", { |
| 653 | payload: Schema.UndefinedOr(NotificationMeta) |
| 654 | }) {} |
| 655 | |
| 656 | /** |
| 657 | * @internal |
| 658 | */ |
| 659 | export class RootsListChangedNotification extends Rpc.make("notifications/roots/list_changed", { |
| 660 | payload: Schema.UndefinedOr(NotificationMeta) |
| 661 | }) {} |
| 662 | |
| 663 | /** |
| 664 | * @internal |
| 665 | */ |
| 666 | export class LoggingMessageNotification extends Rpc.make("notifications/message", { |
| 667 | payload: { |
| 668 | ...NotificationMeta.fields, |
| 669 | level: LoggingLevel, |
| 670 | logger: optional(Schema.String), |
| 671 | data: Schema.Any |
| 672 | } |
| 673 | }) {} |
| 674 | |
| 675 | /** |
| 676 | * @internal |
| 677 | */ |
| 678 | export class ResourceUpdatedNotification extends Rpc.make("notifications/resources/updated", { |
| 679 | payload: { |
| 680 | ...NotificationMeta.fields, |
| 681 | uri: Schema.String |
| 682 | } |
| 683 | }) {} |
| 684 | |
| 685 | /** |
| 686 | * @internal |
| 687 | */ |
| 688 | export class ResourceListChangedNotification extends Rpc.make("notifications/resources/list_changed", { |
| 689 | payload: Schema.UndefinedOr(NotificationMeta) |
| 690 | }) {} |
| 691 | |
| 692 | /** |
| 693 | * @internal |
| 694 | */ |
| 695 | export class ToolListChangedNotification extends Rpc.make("notifications/tools/list_changed", { |
| 696 | payload: Schema.UndefinedOr(NotificationMeta) |
| 697 | }) {} |
| 698 | |
| 699 | /** |
| 700 | * @internal |
| 701 | */ |
| 702 | export class PromptListChangedNotification extends Rpc.make("notifications/prompts/list_changed", { |
| 703 | payload: Schema.UndefinedOr(NotificationMeta) |
| 704 | }) {} |
| 705 | |
| 706 | /** |
| 707 | * @internal |
| 708 | */ |
| 709 | export class ClientRequestRpcs extends RpcGroup.make( |
| 710 | Ping, |
| 711 | Initialize, |
| 712 | Complete, |
| 713 | SetLevel, |
| 714 | GetPrompt, |
| 715 | ListPrompts, |
| 716 | ListResources, |
| 717 | ListResourceTemplates, |
| 718 | ReadResource, |
| 719 | Subscribe, |
| 720 | Unsubscribe, |
| 721 | CallTool, |
| 722 | ListTools |
| 723 | ) {} |
| 724 | |
| 725 | /** |
| 726 | * @internal |
| 727 | */ |
| 728 | export class ClientNotificationRpcs extends RpcGroup.make( |
| 729 | CancelledNotification, |
| 730 | ProgressNotification, |
| 731 | InitializedNotification, |
| 732 | RootsListChangedNotification |
| 733 | ) {} |
| 734 | |
| 735 | /** |
| 736 | * @internal |
| 737 | */ |
| 738 | export class ServerRequestRpcs extends RpcGroup.make( |
| 739 | Ping, |
| 740 | CreateMessage, |
| 741 | ListRoots |
| 742 | ) {} |
| 743 | |
| 744 | /** |
| 745 | * @internal |
| 746 | */ |
| 747 | export class ServerNotificationRpcs extends RpcGroup.make( |
| 748 | CancelledNotification, |
| 749 | ProgressNotification, |
| 750 | LoggingMessageNotification, |
| 751 | ResourceUpdatedNotification, |
| 752 | ResourceListChangedNotification, |
| 753 | ToolListChangedNotification, |
| 754 | PromptListChangedNotification |
| 755 | ) {} |