feat(mcp): add convenience methods without cursor parameter
Add overloaded methods for list operations (tools, resources, templates, prompts) that don't require a cursor parameter, simplifying the API for basic use cases where pagination is not needed.
This commit is contained in:
parent
c332300651
commit
be31c6119c
1 changed files with 29 additions and 0 deletions
|
|
@ -111,6 +111,15 @@ public class McpSyncClient implements AutoCloseable {
|
|||
* Send a tools/list request.
|
||||
* @return the list of tools result.
|
||||
*/
|
||||
public McpSchema.ListToolsResult listTools() {
|
||||
return this.delegate.listTools().block();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a tools/list request.
|
||||
* @param cursor the cursor
|
||||
* @return the list of tools result.
|
||||
*/
|
||||
public McpSchema.ListToolsResult listTools(String cursor) {
|
||||
return this.delegate.listTools(cursor).block();
|
||||
}
|
||||
|
|
@ -128,6 +137,14 @@ public class McpSyncClient implements AutoCloseable {
|
|||
return this.delegate.listResources(cursor).block();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a resources/list request.
|
||||
* @return the list of resources result.
|
||||
*/
|
||||
public McpSchema.ListResourcesResult listResources() {
|
||||
return this.delegate.listResources().block();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a resources/read request.
|
||||
* @param resource the resource to read
|
||||
|
|
@ -158,6 +175,14 @@ public class McpSyncClient implements AutoCloseable {
|
|||
return this.delegate.listResourceTemplates(cursor).block();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a list of resource templates the server has.
|
||||
* @return the list of resource templates result.
|
||||
*/
|
||||
public McpSchema.ListResourceTemplatesResult listResourceTemplates() {
|
||||
return this.delegate.listResourceTemplates().block();
|
||||
}
|
||||
|
||||
/**
|
||||
* List Changed Notification. When the list of available resources changes, servers
|
||||
* that declared the listChanged capability SHOULD send a notification:
|
||||
|
|
@ -195,6 +220,10 @@ public class McpSyncClient implements AutoCloseable {
|
|||
return this.delegate.listPrompts(cursor).block();
|
||||
}
|
||||
|
||||
public ListPromptsResult listPrompts() {
|
||||
return this.delegate.listPrompts().block();
|
||||
}
|
||||
|
||||
public GetPromptResult getPrompt(GetPromptRequest getPromptRequest) {
|
||||
return this.delegate.getPrompt(getPromptRequest).block();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue