Skip to content

Fix params being required on paginated requests #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -9,11 +9,12 @@ import WebSocket from "ws";
import express from "express";
import { Client } from "./client/index.js";
import { SSEClientTransport } from "./client/sse.js";
import { StdioClientTransport } from "./client/stdio.js";
import { WebSocketClientTransport } from "./client/websocket.js";
import { Server } from "./server/index.js";
import { SSEServerTransport } from "./server/sse.js";
import { WebSocketClientTransport } from "./client/websocket.js";
import { StdioClientTransport } from "./client/stdio.js";
import { StdioServerTransport } from "./server/stdio.js";
import { ListResourcesResultSchema } from "./types.js";

async function runClient(url_or_command: string, args: string[]) {
const client = new Client({
@@ -46,6 +47,8 @@ async function runClient(url_or_command: string, args: string[]) {
await client.connect(clientTransport);
console.log("Initialized.");

await client.request({ method: "resources/list" }, ListResourcesResultSchema);

await client.close();
console.log("Closed.");
}
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -338,7 +338,7 @@ export const ProgressNotificationSchema = NotificationSchema.extend({
/**
* The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
*/
progressToken: z.optional(ProgressTokenSchema),
progressToken: ProgressTokenSchema,
}),
});

@@ -350,7 +350,7 @@ export const PaginatedRequestSchema = RequestSchema.extend({
* If provided, the server should return results starting after this cursor.
*/
cursor: z.optional(CursorSchema),
}),
}).optional(),
});

export const PaginatedResultSchema = ResultSchema.extend({