Method GetPromptAsync
GetPromptAsync(string, IDictionary<string, object>, CancellationToken)
Retrieves a fully rendered prompt by name via prompts/get.
public Task<McpPromptResult> GetPromptAsync(string name, IDictionary<string, object> arguments = null, CancellationToken cancellationToken = default)
Parameters
namestringThe prompt name to render.
argumentsIDictionary<string, object>Optional argument map to pass to the prompt.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<McpPromptResult>
An McpPromptResult containing chat messages and optional description.
Exceptions
- ArgumentException
Thrown when
nameis null or whitespace.- ObjectDisposedException
Thrown if the client has been disposed.
- HttpRequestException
Thrown on HTTP/JSON-RPC errors or malformed payloads.