fix(everything-server): send sampling/elicitation requests via extra.sendRequest (#414)
Tool handlers issued sampling/createMessage and elicitation/create via mcpServer.server.request(), which carries no relatedRequestId. The SDK's Streamable HTTP transport routes such requests to the standalone GET SSE stream; if the client hasn't opened it yet, the request is silently parked in the event store and the scenario times out after 60s. Switch test_sampling, test_elicitation, test_elicitation_sep1034_defaults, and test_elicitation_sep1330_enums to the handler's extra.sendRequest(), which sets relatedRequestId so the request rides the originating tools/call POST SSE stream. Fixes #407 Claude-Session: https://claude.ai/code/session_01Qz5WunPTnDHVot4C2J6sFz Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
19a97f0465
commit
31119a05f0
1 changed files with 10 additions and 10 deletions
|
|
@ -539,10 +539,10 @@ function createMcpServer() {
|
|||
prompt: z.string().describe('The prompt to send to the LLM')
|
||||
}
|
||||
},
|
||||
async (args: { prompt: string }) => {
|
||||
async (args: { prompt: string }, { sendRequest }) => {
|
||||
try {
|
||||
// Request sampling from client
|
||||
const result = await mcpServer.server.request(
|
||||
// Request sampling from client on the tool call's stream
|
||||
const result = await sendRequest(
|
||||
{
|
||||
method: 'sampling/createMessage',
|
||||
params: {
|
||||
|
|
@ -599,10 +599,10 @@ function createMcpServer() {
|
|||
message: z.string().describe('The message to show the user')
|
||||
}
|
||||
},
|
||||
async (args: { message: string }) => {
|
||||
async (args: { message: string }, { sendRequest }) => {
|
||||
try {
|
||||
// Request user input from client
|
||||
const result = await mcpServer.server.request(
|
||||
// Request user input from client on the tool call's stream
|
||||
const result = await sendRequest(
|
||||
{
|
||||
method: 'elicitation/create',
|
||||
params: {
|
||||
|
|
@ -651,10 +651,10 @@ function createMcpServer() {
|
|||
description: 'Tests elicitation with default values per SEP-1034',
|
||||
inputSchema: {}
|
||||
},
|
||||
async () => {
|
||||
async (_args, { sendRequest }) => {
|
||||
try {
|
||||
// Request user input with default values for all primitive types
|
||||
const result = await mcpServer.server.request(
|
||||
const result = await sendRequest(
|
||||
{
|
||||
method: 'elicitation/create',
|
||||
params: {
|
||||
|
|
@ -726,10 +726,10 @@ function createMcpServer() {
|
|||
'Tests elicitation with enum schema improvements per SEP-1330',
|
||||
inputSchema: {}
|
||||
},
|
||||
async () => {
|
||||
async (_args, { sendRequest }) => {
|
||||
try {
|
||||
// Request user input with all 5 enum schema variants
|
||||
const result = await mcpServer.server.request(
|
||||
const result = await sendRequest(
|
||||
{
|
||||
method: 'elicitation/create',
|
||||
params: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue