Mocking Mcp Client Functions for Testing #718
ethan-christensen-cag
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Discussion Topic
I am just making the post to see if there are any suggestions on mocking for Mcp Clients with the .NET SDK. I am using MOQ for my testing and am having trouble simply mocking the
ListToolsAsync()
method on the client, with the main issue being that I cannot create instances onMcpClientTool
to use as a return type for the MOQ setup on theListToolsAsync
function call.I am not the most versed in testing so I could very well be missing something. What I ended up doing to get it working was the following, targeting all the way down the the
IMcpEndpoint
class.I should note I am not trying to spin up a test mcp server, but rather mock the returns from this McpClient Class. I could very well be missing something or making it more complicated than it needs to be.
Beta Was this translation helpful? Give feedback.
All reactions