Clean up (use of) McpException and McpTransportException (#321)
* Clean up (use of) McpException * Replace McpTransportException with InvalidOperationException * Add cancellation test
This commit is contained in:
parent
d65ddce268
commit
7d77be68cf
1 changed files with 231 additions and 219 deletions
|
|
@ -88,7 +88,7 @@ public partial class McpServerBuilderExtensionsToolsTests : ClientServerTestBase
|
|||
};
|
||||
|
||||
default:
|
||||
throw new Exception("Unexpected cursor");
|
||||
throw new McpException($"Unexpected cursor: '{cursor}'", McpErrorCode.InvalidParams);
|
||||
}
|
||||
})
|
||||
.WithCallToolHandler(async (request, cancellationToken) =>
|
||||
|
|
@ -104,7 +104,7 @@ public partial class McpServerBuilderExtensionsToolsTests : ClientServerTestBase
|
|||
};
|
||||
|
||||
default:
|
||||
throw new Exception($"Unknown tool '{request.Params?.Name}'");
|
||||
throw new McpException($"Unknown tool: '{request.Params?.Name}'", McpErrorCode.InvalidParams);
|
||||
}
|
||||
})
|
||||
.WithTools<EchoTool>(serializerOptions: BuilderToolsJsonContext.Default.Options);
|
||||
|
|
|
|||
Loading…
Reference in a new issue