remove server requirements, move requirements to schenario description (#30)
This commit is contained in:
parent
ee60717a06
commit
38443d1a43
1 changed files with 633 additions and 1165 deletions
|
|
@ -7,7 +7,19 @@ import { connectToServer } from './client-helper.js';
|
|||
|
||||
export class ResourcesListScenario implements ClientScenario {
|
||||
name = 'resources-list';
|
||||
description = 'Test listing available resources';
|
||||
description = `Test listing available resources.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
**Endpoint**: \`resources/list\`
|
||||
|
||||
**Requirements**:
|
||||
- Return array of all available **direct resources** (not templates)
|
||||
- Each resource MUST have:
|
||||
- \`uri\` (string)
|
||||
- \`name\` (string)
|
||||
- \`description\` (string)
|
||||
- \`mimeType\` (string, optional)`;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -75,7 +87,23 @@ export class ResourcesListScenario implements ClientScenario {
|
|||
|
||||
export class ResourcesReadTextScenario implements ClientScenario {
|
||||
name = 'resources-read-text';
|
||||
description = 'Test reading text resource';
|
||||
description = `Test reading text resource.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
Implement resource \`test://static-text\` that returns:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"uri": "test://static-text",
|
||||
"mimeType": "text/plain",
|
||||
"text": "This is the content of the static text resource."
|
||||
}
|
||||
]
|
||||
}
|
||||
\`\`\``;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -145,7 +173,23 @@ export class ResourcesReadTextScenario implements ClientScenario {
|
|||
|
||||
export class ResourcesReadBinaryScenario implements ClientScenario {
|
||||
name = 'resources-read-binary';
|
||||
description = 'Test reading binary resource';
|
||||
description = `Test reading binary resource.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
Implement resource \`test://static-binary\` that returns:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"uri": "test://static-binary",
|
||||
"mimeType": "image/png",
|
||||
"blob": "<base64-encoded-png>"
|
||||
}
|
||||
]
|
||||
}
|
||||
\`\`\``;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -213,7 +257,27 @@ export class ResourcesReadBinaryScenario implements ClientScenario {
|
|||
|
||||
export class ResourcesTemplateReadScenario implements ClientScenario {
|
||||
name = 'resources-templates-read';
|
||||
description = 'Test reading resource from template';
|
||||
description = `Test reading resource from template.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
Implement resource template \`test://template/{id}/data\` that substitutes parameters.
|
||||
|
||||
**Behavior**: When client requests \`test://template/123/data\`, substitute \`{id}\` with \`123\`
|
||||
|
||||
Returns (for \`uri: "test://template/123/data"\`):
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"uri": "test://template/123/data",
|
||||
"mimeType": "application/json",
|
||||
"text": "{"id":"123","templateTest":true,"data":"Data for ID: 123"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
\`\`\``;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -286,7 +350,27 @@ export class ResourcesTemplateReadScenario implements ClientScenario {
|
|||
|
||||
export class ResourcesSubscribeScenario implements ClientScenario {
|
||||
name = 'resources-subscribe';
|
||||
description = 'Test subscribing to resource updates';
|
||||
description = `Test subscribing to resource updates.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
**Endpoint**: \`resources/subscribe\`
|
||||
|
||||
**Requirements**:
|
||||
- Accept subscription request with URI
|
||||
- Track subscribed URIs
|
||||
- Return empty object \`{}\`
|
||||
|
||||
Example request:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"method": "resources/subscribe",
|
||||
"params": {
|
||||
"uri": "test://watched-resource"
|
||||
}
|
||||
}
|
||||
\`\`\``;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -336,7 +420,17 @@ export class ResourcesSubscribeScenario implements ClientScenario {
|
|||
|
||||
export class ResourcesUnsubscribeScenario implements ClientScenario {
|
||||
name = 'resources-unsubscribe';
|
||||
description = 'Test unsubscribing from resource';
|
||||
description = `Test unsubscribing from resource.
|
||||
|
||||
**Server Implementation Requirements:**
|
||||
|
||||
**Endpoint**: \`resources/unsubscribe\`
|
||||
|
||||
**Requirements**:
|
||||
- Accept unsubscribe request with URI
|
||||
- Remove URI from subscriptions
|
||||
- Stop sending update notifications for that URI
|
||||
- Return empty object \`{}\``;
|
||||
|
||||
async run(serverUrl: string): Promise<ConformanceCheck[]> {
|
||||
const checks: ConformanceCheck[] = [];
|
||||
|
|
@ -363,7 +457,7 @@ export class ResourcesUnsubscribeScenario implements ClientScenario {
|
|||
specReferences: [
|
||||
{
|
||||
id: 'MCP-Resources-Subscribe',
|
||||
url: 'https://modelcontextprotocol.io/specification/2025-06-18/server/resources#resource-subscriptions'
|
||||
url: 'https://modelcontextprotocol.io/specification/2025-06-18/schema#unsubscriberequest'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue