Fix example server elicitation conf (#29)
* fix server elicitation conf * Remove empty elicitation object from server config * Use ElicitResultSchema instead of z.any() for proper validation The elicitation/create response should be validated against ElicitResultSchema which ensures the response has the correct structure (action, content fields) rather than accepting any response. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Paul Carleton <paulc@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
This commit is contained in:
parent
82d83f286b
commit
7f0755627f
1 changed files with 4 additions and 9 deletions
|
|
@ -13,6 +13,7 @@ import {
|
||||||
ResourceTemplate
|
ResourceTemplate
|
||||||
} from '@modelcontextprotocol/sdk/server/mcp.js';
|
} from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||||
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
||||||
|
import { ElicitResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
|
|
@ -369,9 +370,7 @@ function createMcpServer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
z
|
ElicitResultSchema
|
||||||
.object({ method: z.literal('elicitation/create') })
|
|
||||||
.passthrough() as any
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const elicitResult = result as any;
|
const elicitResult = result as any;
|
||||||
|
|
@ -445,9 +444,7 @@ function createMcpServer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
z
|
ElicitResultSchema
|
||||||
.object({ method: z.literal('elicitation/create') })
|
|
||||||
.passthrough() as any
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const elicitResult = result as any;
|
const elicitResult = result as any;
|
||||||
|
|
@ -544,9 +541,7 @@ function createMcpServer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
z
|
ElicitResultSchema
|
||||||
.object({ method: z.literal('elicitation/create') })
|
|
||||||
.passthrough() as any
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const elicitResult = result as any;
|
const elicitResult = result as any;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue