MCP Server Code Accessing URL Context Set by MCP Client? #692
Replies: 1 comment 3 replies
-
How do you want the client (host) to do this in practice. Resources aren't quite what you describe. They are a capability where the client can list/retrieve/subscribe to resources on the server. Tools are normally passed to the LLM. If you don't want url in your example to be part of the tool schema, as given to the model (because it is set in other ways), then you shouldn't take it as an argument but your tool class should access through some other means (ie DI). Your example confuses me a little, because if url was set from elsewhere the method is parameterless and you give the LLM an IsValid() tool, which will be called based on the description and the additional instructions provided (if the client utilizes that field in the capability exchange). That seems like an odd use case without knowing more. Can you explain more about the context of what you're trying to do? When you say clients should be able to set the URL, do you mean the LLM, the application, or the user? |
Beta Was this translation helpful? Give feedback.
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
This may be in the documentation somewhere, but I thought that I would ask.
I would like MCP clients to be able to set a URL as context to the queries to my server (I think that these may also be known as "resources"). How do I access that contextual URL from my
[McpServer]
code? Is there anything that I need to do server-side to enable that URL-based contextual functionality? Right now, I have something like this:Ideally, I would like the clients to be able to set the URL as query context, rather than in the query itself.
Beta Was this translation helpful? Give feedback.
All reactions