getPrompt method

Future<McpJsonMap> getPrompt(
  1. String name, {
  2. Object? id,
  3. Map<String, String> arguments = const <String, String>{},
  4. bool streamable = true,
  5. bool directJson = false,
  6. String? protocolVersion,
  7. Map<String, String> headers = const <String, String>{},
})

Resolves a prompt through the active MCP session.

Implementation

Future<McpJsonMap> getPrompt(
  String name, {
  Object? id,
  Map<String, String> arguments = const <String, String>{},
  bool streamable = true,
  bool directJson = false,
  String? protocolVersion,
  Map<String, String> headers = const <String, String>{},
}) async {
  final promptName = _validatedMcpPromptName(name, 'name');
  final response = await request(
    'prompts/get',
    id: id,
    params: <String, Object?>{'name': promptName, 'arguments': arguments},
    streamable: directJson ? false : streamable,
    includeSession: !directJson,
    protocolVersion: protocolVersion,
    headers: headers,
  );
  return _validatedPromptGetResult(
    _jsonRpcResultFrom(response, method: 'prompts/get'),
    label: 'prompts/get result',
  );
}