{-# HLINT ignore "Use newtype instead of data" #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

{- |
Module      : MCP.Protocol
Description : MCP protocol types built on JSON-RPC 2.0
Copyright   : (C) 2025 DPella AB
License     : MPL-2.0
Maintainer  : matti@dpella.io, lobo@dpella.io
Stability   : experimental
Portability : GHC

This module defines the Model Context Protocol (MCP) request, response,
and notification types.  The underlying JSON-RPC 2.0 transport types are
re-exported from the @jsonrpc@ package.
-}
module MCP.Protocol (
    -- * JSON-RPC types (re-exported from "JSONRPC")
    module JSONRPC,

    -- * Client Request Types
    InitializeRequest (..),
    InitializeParams (..),
    PingRequest (..),
    PingParams (..),
    ListResourcesRequest (..),
    ListResourcesParams (..),
    ListResourceTemplatesRequest (..),
    ListResourceTemplatesParams (..),
    ReadResourceRequest (..),
    ReadResourceParams (..),
    SubscribeRequest (..),
    SubscribeParams (..),
    UnsubscribeRequest (..),
    UnsubscribeParams (..),
    ListPromptsRequest (..),
    ListPromptsParams (..),
    GetPromptRequest (..),
    GetPromptParams (..),
    ListToolsRequest (..),
    ListToolsParams (..),
    CallToolRequest (..),
    CallToolParams (..),
    SetLevelRequest (..),
    SetLevelParams (..),
    CompleteRequest (..),
    CompleteParams (..),
    CompletionContext (..),
    CompletionArgument (..),
    Reference (..),

    -- * Server Request Types
    CreateMessageRequest (..),
    CreateMessageParams (..),
    ListRootsRequest (..),
    ListRootsParams (..),
    ElicitRequest (..),
    ElicitParams (..),
    PrimitiveSchemaDefinition (..),

    -- * Response Types
    InitializeResult (..),
    ListResourcesResult (..),
    ListResourceTemplatesResult (..),
    ReadResourceResult (..),
    ListPromptsResult (..),
    GetPromptResult (..),
    ListToolsResult (..),
    CallToolResult (..),
    CompleteResult (..),
    CompletionResult (..),
    CreateMessageResult (..),
    ListRootsResult (..),
    ElicitResult (..),

    -- * Notification Types
    CancelledNotification (..),
    CancelledParams (..),
    InitializedNotification (..),
    InitializedParams (..),
    ProgressNotification (..),
    ProgressParams (..),
    ResourceListChangedNotification (..),
    ResourceUpdatedNotification (..),
    ResourceUpdatedParams (..),
    PromptListChangedNotification (..),
    ToolListChangedNotification (..),
    LoggingMessageNotification (..),
    LoggingMessageParams (..),
    RootsListChangedNotification (..),

    -- * Union Types
    ClientRequest (..),
    ServerRequest (..),
    ClientNotification (..),
    ServerNotification (..),

    -- * MCP Constants
    pROTOCOL_VERSION,
) where

import Control.Applicative ((<|>))
import Data.Aeson
import Data.Aeson.TH
import Data.Map (Map)
import Data.Text (Text)
import GHC.Generics
import JSONRPC
import MCP.Aeson
import MCP.Types

-- * Client Request Types

{- | Initialize request parameters.

Parameters sent by the client during initialization.
-}
data InitializeParams = InitializeParams
    { InitializeParams -> Text
protocolVersion :: Text
    {- ^ The latest version of the Model Context Protocol that the client supports.
    The client MAY decide to support older versions as well.
    -}
    , InitializeParams -> ClientCapabilities
capabilities :: ClientCapabilities
    , InitializeParams -> Implementation
clientInfo :: Implementation
    }
    deriving stock (Int -> InitializeParams -> ShowS
[InitializeParams] -> ShowS
InitializeParams -> String
(Int -> InitializeParams -> ShowS)
-> (InitializeParams -> String)
-> ([InitializeParams] -> ShowS)
-> Show InitializeParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InitializeParams -> ShowS
showsPrec :: Int -> InitializeParams -> ShowS
$cshow :: InitializeParams -> String
show :: InitializeParams -> String
$cshowList :: [InitializeParams] -> ShowS
showList :: [InitializeParams] -> ShowS
Show, InitializeParams -> InitializeParams -> Bool
(InitializeParams -> InitializeParams -> Bool)
-> (InitializeParams -> InitializeParams -> Bool)
-> Eq InitializeParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InitializeParams -> InitializeParams -> Bool
== :: InitializeParams -> InitializeParams -> Bool
$c/= :: InitializeParams -> InitializeParams -> Bool
/= :: InitializeParams -> InitializeParams -> Bool
Eq, (forall x. InitializeParams -> Rep InitializeParams x)
-> (forall x. Rep InitializeParams x -> InitializeParams)
-> Generic InitializeParams
forall x. Rep InitializeParams x -> InitializeParams
forall x. InitializeParams -> Rep InitializeParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InitializeParams -> Rep InitializeParams x
from :: forall x. InitializeParams -> Rep InitializeParams x
$cto :: forall x. Rep InitializeParams x -> InitializeParams
to :: forall x. Rep InitializeParams x -> InitializeParams
Generic)

$(deriveJSON mcpParseOpts ''InitializeParams)

{- | This request is sent from the client to the server when it first connects,
asking it to begin initialization.
-}
data InitializeRequest = InitializeRequest
    { InitializeRequest -> RequestId
id :: RequestId
    , InitializeRequest -> InitializeParams
params :: InitializeParams
    }
    deriving stock (Int -> InitializeRequest -> ShowS
[InitializeRequest] -> ShowS
InitializeRequest -> String
(Int -> InitializeRequest -> ShowS)
-> (InitializeRequest -> String)
-> ([InitializeRequest] -> ShowS)
-> Show InitializeRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InitializeRequest -> ShowS
showsPrec :: Int -> InitializeRequest -> ShowS
$cshow :: InitializeRequest -> String
show :: InitializeRequest -> String
$cshowList :: [InitializeRequest] -> ShowS
showList :: [InitializeRequest] -> ShowS
Show, InitializeRequest -> InitializeRequest -> Bool
(InitializeRequest -> InitializeRequest -> Bool)
-> (InitializeRequest -> InitializeRequest -> Bool)
-> Eq InitializeRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InitializeRequest -> InitializeRequest -> Bool
== :: InitializeRequest -> InitializeRequest -> Bool
$c/= :: InitializeRequest -> InitializeRequest -> Bool
/= :: InitializeRequest -> InitializeRequest -> Bool
Eq, (forall x. InitializeRequest -> Rep InitializeRequest x)
-> (forall x. Rep InitializeRequest x -> InitializeRequest)
-> Generic InitializeRequest
forall x. Rep InitializeRequest x -> InitializeRequest
forall x. InitializeRequest -> Rep InitializeRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InitializeRequest -> Rep InitializeRequest x
from :: forall x. InitializeRequest -> Rep InitializeRequest x
$cto :: forall x. Rep InitializeRequest x -> InitializeRequest
to :: forall x. Rep InitializeRequest x -> InitializeRequest
Generic)
    deriving ([InitializeRequest] -> Value
[InitializeRequest] -> Encoding
InitializeRequest -> Bool
InitializeRequest -> Value
InitializeRequest -> Encoding
(InitializeRequest -> Value)
-> (InitializeRequest -> Encoding)
-> ([InitializeRequest] -> Value)
-> ([InitializeRequest] -> Encoding)
-> (InitializeRequest -> Bool)
-> ToJSON InitializeRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: InitializeRequest -> Value
toJSON :: InitializeRequest -> Value
$ctoEncoding :: InitializeRequest -> Encoding
toEncoding :: InitializeRequest -> Encoding
$ctoJSONList :: [InitializeRequest] -> Value
toJSONList :: [InitializeRequest] -> Value
$ctoEncodingList :: [InitializeRequest] -> Encoding
toEncodingList :: [InitializeRequest] -> Encoding
$comitField :: InitializeRequest -> Bool
omitField :: InitializeRequest -> Bool
ToJSON, Maybe InitializeRequest
Value -> Parser [InitializeRequest]
Value -> Parser InitializeRequest
(Value -> Parser InitializeRequest)
-> (Value -> Parser [InitializeRequest])
-> Maybe InitializeRequest
-> FromJSON InitializeRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser InitializeRequest
parseJSON :: Value -> Parser InitializeRequest
$cparseJSONList :: Value -> Parser [InitializeRequest]
parseJSONList :: Value -> Parser [InitializeRequest]
$comittedField :: Maybe InitializeRequest
omittedField :: Maybe InitializeRequest
FromJSON) via ViaJSONRPCRequest InitializeRequest

instance IsJSONRPCRequest InitializeRequest where
    requestMethod :: Proxy InitializeRequest -> Text
requestMethod Proxy InitializeRequest
_ = Text
"initialize"

{- | Ping request parameters.

Parameters for a ping request (typically just metadata).
-}
data PingParams where
    PingParams :: {PingParams -> Maybe Metadata
_meta :: Maybe Metadata} -> PingParams
    deriving stock (Int -> PingParams -> ShowS
[PingParams] -> ShowS
PingParams -> String
(Int -> PingParams -> ShowS)
-> (PingParams -> String)
-> ([PingParams] -> ShowS)
-> Show PingParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PingParams -> ShowS
showsPrec :: Int -> PingParams -> ShowS
$cshow :: PingParams -> String
show :: PingParams -> String
$cshowList :: [PingParams] -> ShowS
showList :: [PingParams] -> ShowS
Show, PingParams -> PingParams -> Bool
(PingParams -> PingParams -> Bool)
-> (PingParams -> PingParams -> Bool) -> Eq PingParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PingParams -> PingParams -> Bool
== :: PingParams -> PingParams -> Bool
$c/= :: PingParams -> PingParams -> Bool
/= :: PingParams -> PingParams -> Bool
Eq, (forall x. PingParams -> Rep PingParams x)
-> (forall x. Rep PingParams x -> PingParams) -> Generic PingParams
forall x. Rep PingParams x -> PingParams
forall x. PingParams -> Rep PingParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PingParams -> Rep PingParams x
from :: forall x. PingParams -> Rep PingParams x
$cto :: forall x. Rep PingParams x -> PingParams
to :: forall x. Rep PingParams x -> PingParams
Generic)

$(deriveJSON mcpParseOpts ''PingParams)

{- | A ping, issued by either the server or the client, to check that the other
party is still alive.

The receiver must promptly respond, or else may be disconnected.
-}
data PingRequest = PingRequest
    { PingRequest -> RequestId
id :: RequestId
    , PingRequest -> Maybe PingParams
params :: Maybe PingParams
    }
    deriving stock (Int -> PingRequest -> ShowS
[PingRequest] -> ShowS
PingRequest -> String
(Int -> PingRequest -> ShowS)
-> (PingRequest -> String)
-> ([PingRequest] -> ShowS)
-> Show PingRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PingRequest -> ShowS
showsPrec :: Int -> PingRequest -> ShowS
$cshow :: PingRequest -> String
show :: PingRequest -> String
$cshowList :: [PingRequest] -> ShowS
showList :: [PingRequest] -> ShowS
Show, PingRequest -> PingRequest -> Bool
(PingRequest -> PingRequest -> Bool)
-> (PingRequest -> PingRequest -> Bool) -> Eq PingRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PingRequest -> PingRequest -> Bool
== :: PingRequest -> PingRequest -> Bool
$c/= :: PingRequest -> PingRequest -> Bool
/= :: PingRequest -> PingRequest -> Bool
Eq, (forall x. PingRequest -> Rep PingRequest x)
-> (forall x. Rep PingRequest x -> PingRequest)
-> Generic PingRequest
forall x. Rep PingRequest x -> PingRequest
forall x. PingRequest -> Rep PingRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PingRequest -> Rep PingRequest x
from :: forall x. PingRequest -> Rep PingRequest x
$cto :: forall x. Rep PingRequest x -> PingRequest
to :: forall x. Rep PingRequest x -> PingRequest
Generic)
    deriving ([PingRequest] -> Value
[PingRequest] -> Encoding
PingRequest -> Bool
PingRequest -> Value
PingRequest -> Encoding
(PingRequest -> Value)
-> (PingRequest -> Encoding)
-> ([PingRequest] -> Value)
-> ([PingRequest] -> Encoding)
-> (PingRequest -> Bool)
-> ToJSON PingRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PingRequest -> Value
toJSON :: PingRequest -> Value
$ctoEncoding :: PingRequest -> Encoding
toEncoding :: PingRequest -> Encoding
$ctoJSONList :: [PingRequest] -> Value
toJSONList :: [PingRequest] -> Value
$ctoEncodingList :: [PingRequest] -> Encoding
toEncodingList :: [PingRequest] -> Encoding
$comitField :: PingRequest -> Bool
omitField :: PingRequest -> Bool
ToJSON, Maybe PingRequest
Value -> Parser [PingRequest]
Value -> Parser PingRequest
(Value -> Parser PingRequest)
-> (Value -> Parser [PingRequest])
-> Maybe PingRequest
-> FromJSON PingRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PingRequest
parseJSON :: Value -> Parser PingRequest
$cparseJSONList :: Value -> Parser [PingRequest]
parseJSONList :: Value -> Parser [PingRequest]
$comittedField :: Maybe PingRequest
omittedField :: Maybe PingRequest
FromJSON) via ViaJSONRPCRequest PingRequest

instance IsJSONRPCRequest PingRequest where
    requestMethod :: Proxy PingRequest -> Text
requestMethod Proxy PingRequest
_ = Text
"ping"

{- | List resources request parameters.

Parameters for requesting a paginated list of resources.
-}
data ListResourcesParams where
    ListResourcesParams ::
        { ListResourcesParams -> Maybe Cursor
cursor :: Maybe Cursor
        {- ^ An opaque token representing the current pagination position.
        If provided, the server should return results starting after this cursor.
        -}
        } ->
        ListResourcesParams
    deriving stock (Int -> ListResourcesParams -> ShowS
[ListResourcesParams] -> ShowS
ListResourcesParams -> String
(Int -> ListResourcesParams -> ShowS)
-> (ListResourcesParams -> String)
-> ([ListResourcesParams] -> ShowS)
-> Show ListResourcesParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourcesParams -> ShowS
showsPrec :: Int -> ListResourcesParams -> ShowS
$cshow :: ListResourcesParams -> String
show :: ListResourcesParams -> String
$cshowList :: [ListResourcesParams] -> ShowS
showList :: [ListResourcesParams] -> ShowS
Show, ListResourcesParams -> ListResourcesParams -> Bool
(ListResourcesParams -> ListResourcesParams -> Bool)
-> (ListResourcesParams -> ListResourcesParams -> Bool)
-> Eq ListResourcesParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourcesParams -> ListResourcesParams -> Bool
== :: ListResourcesParams -> ListResourcesParams -> Bool
$c/= :: ListResourcesParams -> ListResourcesParams -> Bool
/= :: ListResourcesParams -> ListResourcesParams -> Bool
Eq, (forall x. ListResourcesParams -> Rep ListResourcesParams x)
-> (forall x. Rep ListResourcesParams x -> ListResourcesParams)
-> Generic ListResourcesParams
forall x. Rep ListResourcesParams x -> ListResourcesParams
forall x. ListResourcesParams -> Rep ListResourcesParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListResourcesParams -> Rep ListResourcesParams x
from :: forall x. ListResourcesParams -> Rep ListResourcesParams x
$cto :: forall x. Rep ListResourcesParams x -> ListResourcesParams
to :: forall x. Rep ListResourcesParams x -> ListResourcesParams
Generic)

$(deriveJSON mcpParseOpts ''ListResourcesParams)

-- | Sent from the client to request a list of resources the server has.
data ListResourcesRequest = ListResourcesRequest
    { ListResourcesRequest -> RequestId
id :: RequestId
    , ListResourcesRequest -> Maybe ListResourcesParams
params :: Maybe ListResourcesParams
    }
    deriving stock (Int -> ListResourcesRequest -> ShowS
[ListResourcesRequest] -> ShowS
ListResourcesRequest -> String
(Int -> ListResourcesRequest -> ShowS)
-> (ListResourcesRequest -> String)
-> ([ListResourcesRequest] -> ShowS)
-> Show ListResourcesRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourcesRequest -> ShowS
showsPrec :: Int -> ListResourcesRequest -> ShowS
$cshow :: ListResourcesRequest -> String
show :: ListResourcesRequest -> String
$cshowList :: [ListResourcesRequest] -> ShowS
showList :: [ListResourcesRequest] -> ShowS
Show, ListResourcesRequest -> ListResourcesRequest -> Bool
(ListResourcesRequest -> ListResourcesRequest -> Bool)
-> (ListResourcesRequest -> ListResourcesRequest -> Bool)
-> Eq ListResourcesRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourcesRequest -> ListResourcesRequest -> Bool
== :: ListResourcesRequest -> ListResourcesRequest -> Bool
$c/= :: ListResourcesRequest -> ListResourcesRequest -> Bool
/= :: ListResourcesRequest -> ListResourcesRequest -> Bool
Eq, (forall x. ListResourcesRequest -> Rep ListResourcesRequest x)
-> (forall x. Rep ListResourcesRequest x -> ListResourcesRequest)
-> Generic ListResourcesRequest
forall x. Rep ListResourcesRequest x -> ListResourcesRequest
forall x. ListResourcesRequest -> Rep ListResourcesRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListResourcesRequest -> Rep ListResourcesRequest x
from :: forall x. ListResourcesRequest -> Rep ListResourcesRequest x
$cto :: forall x. Rep ListResourcesRequest x -> ListResourcesRequest
to :: forall x. Rep ListResourcesRequest x -> ListResourcesRequest
Generic)
    deriving ([ListResourcesRequest] -> Value
[ListResourcesRequest] -> Encoding
ListResourcesRequest -> Bool
ListResourcesRequest -> Value
ListResourcesRequest -> Encoding
(ListResourcesRequest -> Value)
-> (ListResourcesRequest -> Encoding)
-> ([ListResourcesRequest] -> Value)
-> ([ListResourcesRequest] -> Encoding)
-> (ListResourcesRequest -> Bool)
-> ToJSON ListResourcesRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ListResourcesRequest -> Value
toJSON :: ListResourcesRequest -> Value
$ctoEncoding :: ListResourcesRequest -> Encoding
toEncoding :: ListResourcesRequest -> Encoding
$ctoJSONList :: [ListResourcesRequest] -> Value
toJSONList :: [ListResourcesRequest] -> Value
$ctoEncodingList :: [ListResourcesRequest] -> Encoding
toEncodingList :: [ListResourcesRequest] -> Encoding
$comitField :: ListResourcesRequest -> Bool
omitField :: ListResourcesRequest -> Bool
ToJSON, Maybe ListResourcesRequest
Value -> Parser [ListResourcesRequest]
Value -> Parser ListResourcesRequest
(Value -> Parser ListResourcesRequest)
-> (Value -> Parser [ListResourcesRequest])
-> Maybe ListResourcesRequest
-> FromJSON ListResourcesRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ListResourcesRequest
parseJSON :: Value -> Parser ListResourcesRequest
$cparseJSONList :: Value -> Parser [ListResourcesRequest]
parseJSONList :: Value -> Parser [ListResourcesRequest]
$comittedField :: Maybe ListResourcesRequest
omittedField :: Maybe ListResourcesRequest
FromJSON) via ViaJSONRPCRequest ListResourcesRequest

instance IsJSONRPCRequest ListResourcesRequest where
    requestMethod :: Proxy ListResourcesRequest -> Text
requestMethod Proxy ListResourcesRequest
_ = Text
"resources/list"

{- | List resource templates request parameters.

Parameters for requesting a paginated list of resource templates.
-}
data ListResourceTemplatesParams where
    ListResourceTemplatesParams ::
        { ListResourceTemplatesParams -> Maybe Cursor
cursor :: Maybe Cursor
        {- ^ An opaque token representing the current pagination position.
        If provided, the server should return results starting after this cursor.
        -}
        } ->
        ListResourceTemplatesParams
    deriving stock (Int -> ListResourceTemplatesParams -> ShowS
[ListResourceTemplatesParams] -> ShowS
ListResourceTemplatesParams -> String
(Int -> ListResourceTemplatesParams -> ShowS)
-> (ListResourceTemplatesParams -> String)
-> ([ListResourceTemplatesParams] -> ShowS)
-> Show ListResourceTemplatesParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourceTemplatesParams -> ShowS
showsPrec :: Int -> ListResourceTemplatesParams -> ShowS
$cshow :: ListResourceTemplatesParams -> String
show :: ListResourceTemplatesParams -> String
$cshowList :: [ListResourceTemplatesParams] -> ShowS
showList :: [ListResourceTemplatesParams] -> ShowS
Show, ListResourceTemplatesParams -> ListResourceTemplatesParams -> Bool
(ListResourceTemplatesParams
 -> ListResourceTemplatesParams -> Bool)
-> (ListResourceTemplatesParams
    -> ListResourceTemplatesParams -> Bool)
-> Eq ListResourceTemplatesParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourceTemplatesParams -> ListResourceTemplatesParams -> Bool
== :: ListResourceTemplatesParams -> ListResourceTemplatesParams -> Bool
$c/= :: ListResourceTemplatesParams -> ListResourceTemplatesParams -> Bool
/= :: ListResourceTemplatesParams -> ListResourceTemplatesParams -> Bool
Eq, (forall x.
 ListResourceTemplatesParams -> Rep ListResourceTemplatesParams x)
-> (forall x.
    Rep ListResourceTemplatesParams x -> ListResourceTemplatesParams)
-> Generic ListResourceTemplatesParams
forall x.
Rep ListResourceTemplatesParams x -> ListResourceTemplatesParams
forall x.
ListResourceTemplatesParams -> Rep ListResourceTemplatesParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ListResourceTemplatesParams -> Rep ListResourceTemplatesParams x
from :: forall x.
ListResourceTemplatesParams -> Rep ListResourceTemplatesParams x
$cto :: forall x.
Rep ListResourceTemplatesParams x -> ListResourceTemplatesParams
to :: forall x.
Rep ListResourceTemplatesParams x -> ListResourceTemplatesParams
Generic)

$(deriveJSON mcpParseOpts ''ListResourceTemplatesParams)

-- | Sent from the client to request a list of resource templates the server has.
data ListResourceTemplatesRequest = ListResourceTemplatesRequest
    { ListResourceTemplatesRequest -> RequestId
id :: RequestId
    , ListResourceTemplatesRequest -> Maybe ListResourceTemplatesParams
params :: Maybe ListResourceTemplatesParams
    }
    deriving stock (Int -> ListResourceTemplatesRequest -> ShowS
[ListResourceTemplatesRequest] -> ShowS
ListResourceTemplatesRequest -> String
(Int -> ListResourceTemplatesRequest -> ShowS)
-> (ListResourceTemplatesRequest -> String)
-> ([ListResourceTemplatesRequest] -> ShowS)
-> Show ListResourceTemplatesRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourceTemplatesRequest -> ShowS
showsPrec :: Int -> ListResourceTemplatesRequest -> ShowS
$cshow :: ListResourceTemplatesRequest -> String
show :: ListResourceTemplatesRequest -> String
$cshowList :: [ListResourceTemplatesRequest] -> ShowS
showList :: [ListResourceTemplatesRequest] -> ShowS
Show, ListResourceTemplatesRequest
-> ListResourceTemplatesRequest -> Bool
(ListResourceTemplatesRequest
 -> ListResourceTemplatesRequest -> Bool)
-> (ListResourceTemplatesRequest
    -> ListResourceTemplatesRequest -> Bool)
-> Eq ListResourceTemplatesRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourceTemplatesRequest
-> ListResourceTemplatesRequest -> Bool
== :: ListResourceTemplatesRequest
-> ListResourceTemplatesRequest -> Bool
$c/= :: ListResourceTemplatesRequest
-> ListResourceTemplatesRequest -> Bool
/= :: ListResourceTemplatesRequest
-> ListResourceTemplatesRequest -> Bool
Eq, (forall x.
 ListResourceTemplatesRequest -> Rep ListResourceTemplatesRequest x)
-> (forall x.
    Rep ListResourceTemplatesRequest x -> ListResourceTemplatesRequest)
-> Generic ListResourceTemplatesRequest
forall x.
Rep ListResourceTemplatesRequest x -> ListResourceTemplatesRequest
forall x.
ListResourceTemplatesRequest -> Rep ListResourceTemplatesRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ListResourceTemplatesRequest -> Rep ListResourceTemplatesRequest x
from :: forall x.
ListResourceTemplatesRequest -> Rep ListResourceTemplatesRequest x
$cto :: forall x.
Rep ListResourceTemplatesRequest x -> ListResourceTemplatesRequest
to :: forall x.
Rep ListResourceTemplatesRequest x -> ListResourceTemplatesRequest
Generic)
    deriving ([ListResourceTemplatesRequest] -> Value
[ListResourceTemplatesRequest] -> Encoding
ListResourceTemplatesRequest -> Bool
ListResourceTemplatesRequest -> Value
ListResourceTemplatesRequest -> Encoding
(ListResourceTemplatesRequest -> Value)
-> (ListResourceTemplatesRequest -> Encoding)
-> ([ListResourceTemplatesRequest] -> Value)
-> ([ListResourceTemplatesRequest] -> Encoding)
-> (ListResourceTemplatesRequest -> Bool)
-> ToJSON ListResourceTemplatesRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ListResourceTemplatesRequest -> Value
toJSON :: ListResourceTemplatesRequest -> Value
$ctoEncoding :: ListResourceTemplatesRequest -> Encoding
toEncoding :: ListResourceTemplatesRequest -> Encoding
$ctoJSONList :: [ListResourceTemplatesRequest] -> Value
toJSONList :: [ListResourceTemplatesRequest] -> Value
$ctoEncodingList :: [ListResourceTemplatesRequest] -> Encoding
toEncodingList :: [ListResourceTemplatesRequest] -> Encoding
$comitField :: ListResourceTemplatesRequest -> Bool
omitField :: ListResourceTemplatesRequest -> Bool
ToJSON, Maybe ListResourceTemplatesRequest
Value -> Parser [ListResourceTemplatesRequest]
Value -> Parser ListResourceTemplatesRequest
(Value -> Parser ListResourceTemplatesRequest)
-> (Value -> Parser [ListResourceTemplatesRequest])
-> Maybe ListResourceTemplatesRequest
-> FromJSON ListResourceTemplatesRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ListResourceTemplatesRequest
parseJSON :: Value -> Parser ListResourceTemplatesRequest
$cparseJSONList :: Value -> Parser [ListResourceTemplatesRequest]
parseJSONList :: Value -> Parser [ListResourceTemplatesRequest]
$comittedField :: Maybe ListResourceTemplatesRequest
omittedField :: Maybe ListResourceTemplatesRequest
FromJSON) via ViaJSONRPCRequest ListResourceTemplatesRequest

instance IsJSONRPCRequest ListResourceTemplatesRequest where
    requestMethod :: Proxy ListResourceTemplatesRequest -> Text
requestMethod Proxy ListResourceTemplatesRequest
_ = Text
"resources/templates/list"

{- | Read resource request parameters.

Parameters for reading a specific resource.
-}
data ReadResourceParams where
    ReadResourceParams ::
        { ReadResourceParams -> Text
uri :: Text
        {- ^ The URI of the resource to read. The URI can use any protocol;
        it is up to the server how to interpret it.
        -}
        } ->
        ReadResourceParams
    deriving stock (Int -> ReadResourceParams -> ShowS
[ReadResourceParams] -> ShowS
ReadResourceParams -> String
(Int -> ReadResourceParams -> ShowS)
-> (ReadResourceParams -> String)
-> ([ReadResourceParams] -> ShowS)
-> Show ReadResourceParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadResourceParams -> ShowS
showsPrec :: Int -> ReadResourceParams -> ShowS
$cshow :: ReadResourceParams -> String
show :: ReadResourceParams -> String
$cshowList :: [ReadResourceParams] -> ShowS
showList :: [ReadResourceParams] -> ShowS
Show, ReadResourceParams -> ReadResourceParams -> Bool
(ReadResourceParams -> ReadResourceParams -> Bool)
-> (ReadResourceParams -> ReadResourceParams -> Bool)
-> Eq ReadResourceParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadResourceParams -> ReadResourceParams -> Bool
== :: ReadResourceParams -> ReadResourceParams -> Bool
$c/= :: ReadResourceParams -> ReadResourceParams -> Bool
/= :: ReadResourceParams -> ReadResourceParams -> Bool
Eq, (forall x. ReadResourceParams -> Rep ReadResourceParams x)
-> (forall x. Rep ReadResourceParams x -> ReadResourceParams)
-> Generic ReadResourceParams
forall x. Rep ReadResourceParams x -> ReadResourceParams
forall x. ReadResourceParams -> Rep ReadResourceParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReadResourceParams -> Rep ReadResourceParams x
from :: forall x. ReadResourceParams -> Rep ReadResourceParams x
$cto :: forall x. Rep ReadResourceParams x -> ReadResourceParams
to :: forall x. Rep ReadResourceParams x -> ReadResourceParams
Generic)

$(deriveJSON mcpParseOpts ''ReadResourceParams)

-- | Sent from the client to the server, to read a specific resource URI.
data ReadResourceRequest = ReadResourceRequest
    { ReadResourceRequest -> RequestId
id :: RequestId
    , ReadResourceRequest -> ReadResourceParams
params :: ReadResourceParams
    }
    deriving stock (Int -> ReadResourceRequest -> ShowS
[ReadResourceRequest] -> ShowS
ReadResourceRequest -> String
(Int -> ReadResourceRequest -> ShowS)
-> (ReadResourceRequest -> String)
-> ([ReadResourceRequest] -> ShowS)
-> Show ReadResourceRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadResourceRequest -> ShowS
showsPrec :: Int -> ReadResourceRequest -> ShowS
$cshow :: ReadResourceRequest -> String
show :: ReadResourceRequest -> String
$cshowList :: [ReadResourceRequest] -> ShowS
showList :: [ReadResourceRequest] -> ShowS
Show, ReadResourceRequest -> ReadResourceRequest -> Bool
(ReadResourceRequest -> ReadResourceRequest -> Bool)
-> (ReadResourceRequest -> ReadResourceRequest -> Bool)
-> Eq ReadResourceRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadResourceRequest -> ReadResourceRequest -> Bool
== :: ReadResourceRequest -> ReadResourceRequest -> Bool
$c/= :: ReadResourceRequest -> ReadResourceRequest -> Bool
/= :: ReadResourceRequest -> ReadResourceRequest -> Bool
Eq, (forall x. ReadResourceRequest -> Rep ReadResourceRequest x)
-> (forall x. Rep ReadResourceRequest x -> ReadResourceRequest)
-> Generic ReadResourceRequest
forall x. Rep ReadResourceRequest x -> ReadResourceRequest
forall x. ReadResourceRequest -> Rep ReadResourceRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReadResourceRequest -> Rep ReadResourceRequest x
from :: forall x. ReadResourceRequest -> Rep ReadResourceRequest x
$cto :: forall x. Rep ReadResourceRequest x -> ReadResourceRequest
to :: forall x. Rep ReadResourceRequest x -> ReadResourceRequest
Generic)
    deriving ([ReadResourceRequest] -> Value
[ReadResourceRequest] -> Encoding
ReadResourceRequest -> Bool
ReadResourceRequest -> Value
ReadResourceRequest -> Encoding
(ReadResourceRequest -> Value)
-> (ReadResourceRequest -> Encoding)
-> ([ReadResourceRequest] -> Value)
-> ([ReadResourceRequest] -> Encoding)
-> (ReadResourceRequest -> Bool)
-> ToJSON ReadResourceRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ReadResourceRequest -> Value
toJSON :: ReadResourceRequest -> Value
$ctoEncoding :: ReadResourceRequest -> Encoding
toEncoding :: ReadResourceRequest -> Encoding
$ctoJSONList :: [ReadResourceRequest] -> Value
toJSONList :: [ReadResourceRequest] -> Value
$ctoEncodingList :: [ReadResourceRequest] -> Encoding
toEncodingList :: [ReadResourceRequest] -> Encoding
$comitField :: ReadResourceRequest -> Bool
omitField :: ReadResourceRequest -> Bool
ToJSON, Maybe ReadResourceRequest
Value -> Parser [ReadResourceRequest]
Value -> Parser ReadResourceRequest
(Value -> Parser ReadResourceRequest)
-> (Value -> Parser [ReadResourceRequest])
-> Maybe ReadResourceRequest
-> FromJSON ReadResourceRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ReadResourceRequest
parseJSON :: Value -> Parser ReadResourceRequest
$cparseJSONList :: Value -> Parser [ReadResourceRequest]
parseJSONList :: Value -> Parser [ReadResourceRequest]
$comittedField :: Maybe ReadResourceRequest
omittedField :: Maybe ReadResourceRequest
FromJSON) via ViaJSONRPCRequest ReadResourceRequest

instance IsJSONRPCRequest ReadResourceRequest where
    requestMethod :: Proxy ReadResourceRequest -> Text
requestMethod Proxy ReadResourceRequest
_ = Text
"resources/read"

{- | Subscribe request parameters.

Parameters for subscribing to resource updates.
-}
data SubscribeParams where
    SubscribeParams ::
        { SubscribeParams -> Text
uri :: Text
        {- ^ The URI of the resource to subscribe to. The URI can use any protocol;
        it is up to the server how to interpret it.
        -}
        } ->
        SubscribeParams
    deriving stock (Int -> SubscribeParams -> ShowS
[SubscribeParams] -> ShowS
SubscribeParams -> String
(Int -> SubscribeParams -> ShowS)
-> (SubscribeParams -> String)
-> ([SubscribeParams] -> ShowS)
-> Show SubscribeParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscribeParams -> ShowS
showsPrec :: Int -> SubscribeParams -> ShowS
$cshow :: SubscribeParams -> String
show :: SubscribeParams -> String
$cshowList :: [SubscribeParams] -> ShowS
showList :: [SubscribeParams] -> ShowS
Show, SubscribeParams -> SubscribeParams -> Bool
(SubscribeParams -> SubscribeParams -> Bool)
-> (SubscribeParams -> SubscribeParams -> Bool)
-> Eq SubscribeParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscribeParams -> SubscribeParams -> Bool
== :: SubscribeParams -> SubscribeParams -> Bool
$c/= :: SubscribeParams -> SubscribeParams -> Bool
/= :: SubscribeParams -> SubscribeParams -> Bool
Eq, (forall x. SubscribeParams -> Rep SubscribeParams x)
-> (forall x. Rep SubscribeParams x -> SubscribeParams)
-> Generic SubscribeParams
forall x. Rep SubscribeParams x -> SubscribeParams
forall x. SubscribeParams -> Rep SubscribeParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SubscribeParams -> Rep SubscribeParams x
from :: forall x. SubscribeParams -> Rep SubscribeParams x
$cto :: forall x. Rep SubscribeParams x -> SubscribeParams
to :: forall x. Rep SubscribeParams x -> SubscribeParams
Generic)

$(deriveJSON mcpParseOpts ''SubscribeParams)

{- | Sent from the client to request resources/updated notifications from the server
whenever a particular resource changes.
-}
data SubscribeRequest = SubscribeRequest
    { SubscribeRequest -> RequestId
id :: RequestId
    , SubscribeRequest -> SubscribeParams
params :: SubscribeParams
    }
    deriving stock (Int -> SubscribeRequest -> ShowS
[SubscribeRequest] -> ShowS
SubscribeRequest -> String
(Int -> SubscribeRequest -> ShowS)
-> (SubscribeRequest -> String)
-> ([SubscribeRequest] -> ShowS)
-> Show SubscribeRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubscribeRequest -> ShowS
showsPrec :: Int -> SubscribeRequest -> ShowS
$cshow :: SubscribeRequest -> String
show :: SubscribeRequest -> String
$cshowList :: [SubscribeRequest] -> ShowS
showList :: [SubscribeRequest] -> ShowS
Show, SubscribeRequest -> SubscribeRequest -> Bool
(SubscribeRequest -> SubscribeRequest -> Bool)
-> (SubscribeRequest -> SubscribeRequest -> Bool)
-> Eq SubscribeRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubscribeRequest -> SubscribeRequest -> Bool
== :: SubscribeRequest -> SubscribeRequest -> Bool
$c/= :: SubscribeRequest -> SubscribeRequest -> Bool
/= :: SubscribeRequest -> SubscribeRequest -> Bool
Eq, (forall x. SubscribeRequest -> Rep SubscribeRequest x)
-> (forall x. Rep SubscribeRequest x -> SubscribeRequest)
-> Generic SubscribeRequest
forall x. Rep SubscribeRequest x -> SubscribeRequest
forall x. SubscribeRequest -> Rep SubscribeRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SubscribeRequest -> Rep SubscribeRequest x
from :: forall x. SubscribeRequest -> Rep SubscribeRequest x
$cto :: forall x. Rep SubscribeRequest x -> SubscribeRequest
to :: forall x. Rep SubscribeRequest x -> SubscribeRequest
Generic)
    deriving ([SubscribeRequest] -> Value
[SubscribeRequest] -> Encoding
SubscribeRequest -> Bool
SubscribeRequest -> Value
SubscribeRequest -> Encoding
(SubscribeRequest -> Value)
-> (SubscribeRequest -> Encoding)
-> ([SubscribeRequest] -> Value)
-> ([SubscribeRequest] -> Encoding)
-> (SubscribeRequest -> Bool)
-> ToJSON SubscribeRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: SubscribeRequest -> Value
toJSON :: SubscribeRequest -> Value
$ctoEncoding :: SubscribeRequest -> Encoding
toEncoding :: SubscribeRequest -> Encoding
$ctoJSONList :: [SubscribeRequest] -> Value
toJSONList :: [SubscribeRequest] -> Value
$ctoEncodingList :: [SubscribeRequest] -> Encoding
toEncodingList :: [SubscribeRequest] -> Encoding
$comitField :: SubscribeRequest -> Bool
omitField :: SubscribeRequest -> Bool
ToJSON, Maybe SubscribeRequest
Value -> Parser [SubscribeRequest]
Value -> Parser SubscribeRequest
(Value -> Parser SubscribeRequest)
-> (Value -> Parser [SubscribeRequest])
-> Maybe SubscribeRequest
-> FromJSON SubscribeRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser SubscribeRequest
parseJSON :: Value -> Parser SubscribeRequest
$cparseJSONList :: Value -> Parser [SubscribeRequest]
parseJSONList :: Value -> Parser [SubscribeRequest]
$comittedField :: Maybe SubscribeRequest
omittedField :: Maybe SubscribeRequest
FromJSON) via ViaJSONRPCRequest SubscribeRequest

instance IsJSONRPCRequest SubscribeRequest where
    requestMethod :: Proxy SubscribeRequest -> Text
requestMethod Proxy SubscribeRequest
_ = Text
"resources/subscribe"

{- | Unsubscribe request parameters.

Parameters for unsubscribing from resource updates.
-}
data UnsubscribeParams where
    UnsubscribeParams ::
        { UnsubscribeParams -> Text
uri :: Text
        -- ^ The URI of the resource to unsubscribe from.
        } ->
        UnsubscribeParams
    deriving stock (Int -> UnsubscribeParams -> ShowS
[UnsubscribeParams] -> ShowS
UnsubscribeParams -> String
(Int -> UnsubscribeParams -> ShowS)
-> (UnsubscribeParams -> String)
-> ([UnsubscribeParams] -> ShowS)
-> Show UnsubscribeParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnsubscribeParams -> ShowS
showsPrec :: Int -> UnsubscribeParams -> ShowS
$cshow :: UnsubscribeParams -> String
show :: UnsubscribeParams -> String
$cshowList :: [UnsubscribeParams] -> ShowS
showList :: [UnsubscribeParams] -> ShowS
Show, UnsubscribeParams -> UnsubscribeParams -> Bool
(UnsubscribeParams -> UnsubscribeParams -> Bool)
-> (UnsubscribeParams -> UnsubscribeParams -> Bool)
-> Eq UnsubscribeParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnsubscribeParams -> UnsubscribeParams -> Bool
== :: UnsubscribeParams -> UnsubscribeParams -> Bool
$c/= :: UnsubscribeParams -> UnsubscribeParams -> Bool
/= :: UnsubscribeParams -> UnsubscribeParams -> Bool
Eq, (forall x. UnsubscribeParams -> Rep UnsubscribeParams x)
-> (forall x. Rep UnsubscribeParams x -> UnsubscribeParams)
-> Generic UnsubscribeParams
forall x. Rep UnsubscribeParams x -> UnsubscribeParams
forall x. UnsubscribeParams -> Rep UnsubscribeParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UnsubscribeParams -> Rep UnsubscribeParams x
from :: forall x. UnsubscribeParams -> Rep UnsubscribeParams x
$cto :: forall x. Rep UnsubscribeParams x -> UnsubscribeParams
to :: forall x. Rep UnsubscribeParams x -> UnsubscribeParams
Generic)

$(deriveJSON mcpParseOpts ''UnsubscribeParams)

{- | Sent from the client to request cancellation of resources/updated
notifications from the server. This should follow a previous resources/subscribe request.
-}
data UnsubscribeRequest = UnsubscribeRequest
    { UnsubscribeRequest -> RequestId
id :: RequestId
    , UnsubscribeRequest -> UnsubscribeParams
params :: UnsubscribeParams
    }
    deriving stock (Int -> UnsubscribeRequest -> ShowS
[UnsubscribeRequest] -> ShowS
UnsubscribeRequest -> String
(Int -> UnsubscribeRequest -> ShowS)
-> (UnsubscribeRequest -> String)
-> ([UnsubscribeRequest] -> ShowS)
-> Show UnsubscribeRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnsubscribeRequest -> ShowS
showsPrec :: Int -> UnsubscribeRequest -> ShowS
$cshow :: UnsubscribeRequest -> String
show :: UnsubscribeRequest -> String
$cshowList :: [UnsubscribeRequest] -> ShowS
showList :: [UnsubscribeRequest] -> ShowS
Show, UnsubscribeRequest -> UnsubscribeRequest -> Bool
(UnsubscribeRequest -> UnsubscribeRequest -> Bool)
-> (UnsubscribeRequest -> UnsubscribeRequest -> Bool)
-> Eq UnsubscribeRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnsubscribeRequest -> UnsubscribeRequest -> Bool
== :: UnsubscribeRequest -> UnsubscribeRequest -> Bool
$c/= :: UnsubscribeRequest -> UnsubscribeRequest -> Bool
/= :: UnsubscribeRequest -> UnsubscribeRequest -> Bool
Eq, (forall x. UnsubscribeRequest -> Rep UnsubscribeRequest x)
-> (forall x. Rep UnsubscribeRequest x -> UnsubscribeRequest)
-> Generic UnsubscribeRequest
forall x. Rep UnsubscribeRequest x -> UnsubscribeRequest
forall x. UnsubscribeRequest -> Rep UnsubscribeRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UnsubscribeRequest -> Rep UnsubscribeRequest x
from :: forall x. UnsubscribeRequest -> Rep UnsubscribeRequest x
$cto :: forall x. Rep UnsubscribeRequest x -> UnsubscribeRequest
to :: forall x. Rep UnsubscribeRequest x -> UnsubscribeRequest
Generic)
    deriving ([UnsubscribeRequest] -> Value
[UnsubscribeRequest] -> Encoding
UnsubscribeRequest -> Bool
UnsubscribeRequest -> Value
UnsubscribeRequest -> Encoding
(UnsubscribeRequest -> Value)
-> (UnsubscribeRequest -> Encoding)
-> ([UnsubscribeRequest] -> Value)
-> ([UnsubscribeRequest] -> Encoding)
-> (UnsubscribeRequest -> Bool)
-> ToJSON UnsubscribeRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: UnsubscribeRequest -> Value
toJSON :: UnsubscribeRequest -> Value
$ctoEncoding :: UnsubscribeRequest -> Encoding
toEncoding :: UnsubscribeRequest -> Encoding
$ctoJSONList :: [UnsubscribeRequest] -> Value
toJSONList :: [UnsubscribeRequest] -> Value
$ctoEncodingList :: [UnsubscribeRequest] -> Encoding
toEncodingList :: [UnsubscribeRequest] -> Encoding
$comitField :: UnsubscribeRequest -> Bool
omitField :: UnsubscribeRequest -> Bool
ToJSON, Maybe UnsubscribeRequest
Value -> Parser [UnsubscribeRequest]
Value -> Parser UnsubscribeRequest
(Value -> Parser UnsubscribeRequest)
-> (Value -> Parser [UnsubscribeRequest])
-> Maybe UnsubscribeRequest
-> FromJSON UnsubscribeRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser UnsubscribeRequest
parseJSON :: Value -> Parser UnsubscribeRequest
$cparseJSONList :: Value -> Parser [UnsubscribeRequest]
parseJSONList :: Value -> Parser [UnsubscribeRequest]
$comittedField :: Maybe UnsubscribeRequest
omittedField :: Maybe UnsubscribeRequest
FromJSON) via ViaJSONRPCRequest UnsubscribeRequest

instance IsJSONRPCRequest UnsubscribeRequest where
    requestMethod :: Proxy UnsubscribeRequest -> Text
requestMethod Proxy UnsubscribeRequest
_ = Text
"resources/unsubscribe"

{- | List prompts request parameters.

Parameters for requesting a paginated list of prompts.
-}
data ListPromptsParams where
    ListPromptsParams ::
        { ListPromptsParams -> Maybe Cursor
cursor :: Maybe Cursor
        {- ^ An opaque token representing the current pagination position.
        If provided, the server should return results starting after this cursor.
        -}
        } ->
        ListPromptsParams
    deriving stock (Int -> ListPromptsParams -> ShowS
[ListPromptsParams] -> ShowS
ListPromptsParams -> String
(Int -> ListPromptsParams -> ShowS)
-> (ListPromptsParams -> String)
-> ([ListPromptsParams] -> ShowS)
-> Show ListPromptsParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListPromptsParams -> ShowS
showsPrec :: Int -> ListPromptsParams -> ShowS
$cshow :: ListPromptsParams -> String
show :: ListPromptsParams -> String
$cshowList :: [ListPromptsParams] -> ShowS
showList :: [ListPromptsParams] -> ShowS
Show, ListPromptsParams -> ListPromptsParams -> Bool
(ListPromptsParams -> ListPromptsParams -> Bool)
-> (ListPromptsParams -> ListPromptsParams -> Bool)
-> Eq ListPromptsParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListPromptsParams -> ListPromptsParams -> Bool
== :: ListPromptsParams -> ListPromptsParams -> Bool
$c/= :: ListPromptsParams -> ListPromptsParams -> Bool
/= :: ListPromptsParams -> ListPromptsParams -> Bool
Eq, (forall x. ListPromptsParams -> Rep ListPromptsParams x)
-> (forall x. Rep ListPromptsParams x -> ListPromptsParams)
-> Generic ListPromptsParams
forall x. Rep ListPromptsParams x -> ListPromptsParams
forall x. ListPromptsParams -> Rep ListPromptsParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListPromptsParams -> Rep ListPromptsParams x
from :: forall x. ListPromptsParams -> Rep ListPromptsParams x
$cto :: forall x. Rep ListPromptsParams x -> ListPromptsParams
to :: forall x. Rep ListPromptsParams x -> ListPromptsParams
Generic)

$(deriveJSON mcpParseOpts ''ListPromptsParams)

-- | Sent from the client to request a list of prompts and prompt templates the server has.
data ListPromptsRequest = ListPromptsRequest
    { ListPromptsRequest -> RequestId
id :: RequestId
    , ListPromptsRequest -> Maybe ListPromptsParams
params :: Maybe ListPromptsParams
    }
    deriving stock (Int -> ListPromptsRequest -> ShowS
[ListPromptsRequest] -> ShowS
ListPromptsRequest -> String
(Int -> ListPromptsRequest -> ShowS)
-> (ListPromptsRequest -> String)
-> ([ListPromptsRequest] -> ShowS)
-> Show ListPromptsRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListPromptsRequest -> ShowS
showsPrec :: Int -> ListPromptsRequest -> ShowS
$cshow :: ListPromptsRequest -> String
show :: ListPromptsRequest -> String
$cshowList :: [ListPromptsRequest] -> ShowS
showList :: [ListPromptsRequest] -> ShowS
Show, ListPromptsRequest -> ListPromptsRequest -> Bool
(ListPromptsRequest -> ListPromptsRequest -> Bool)
-> (ListPromptsRequest -> ListPromptsRequest -> Bool)
-> Eq ListPromptsRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListPromptsRequest -> ListPromptsRequest -> Bool
== :: ListPromptsRequest -> ListPromptsRequest -> Bool
$c/= :: ListPromptsRequest -> ListPromptsRequest -> Bool
/= :: ListPromptsRequest -> ListPromptsRequest -> Bool
Eq, (forall x. ListPromptsRequest -> Rep ListPromptsRequest x)
-> (forall x. Rep ListPromptsRequest x -> ListPromptsRequest)
-> Generic ListPromptsRequest
forall x. Rep ListPromptsRequest x -> ListPromptsRequest
forall x. ListPromptsRequest -> Rep ListPromptsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListPromptsRequest -> Rep ListPromptsRequest x
from :: forall x. ListPromptsRequest -> Rep ListPromptsRequest x
$cto :: forall x. Rep ListPromptsRequest x -> ListPromptsRequest
to :: forall x. Rep ListPromptsRequest x -> ListPromptsRequest
Generic)
    deriving ([ListPromptsRequest] -> Value
[ListPromptsRequest] -> Encoding
ListPromptsRequest -> Bool
ListPromptsRequest -> Value
ListPromptsRequest -> Encoding
(ListPromptsRequest -> Value)
-> (ListPromptsRequest -> Encoding)
-> ([ListPromptsRequest] -> Value)
-> ([ListPromptsRequest] -> Encoding)
-> (ListPromptsRequest -> Bool)
-> ToJSON ListPromptsRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ListPromptsRequest -> Value
toJSON :: ListPromptsRequest -> Value
$ctoEncoding :: ListPromptsRequest -> Encoding
toEncoding :: ListPromptsRequest -> Encoding
$ctoJSONList :: [ListPromptsRequest] -> Value
toJSONList :: [ListPromptsRequest] -> Value
$ctoEncodingList :: [ListPromptsRequest] -> Encoding
toEncodingList :: [ListPromptsRequest] -> Encoding
$comitField :: ListPromptsRequest -> Bool
omitField :: ListPromptsRequest -> Bool
ToJSON, Maybe ListPromptsRequest
Value -> Parser [ListPromptsRequest]
Value -> Parser ListPromptsRequest
(Value -> Parser ListPromptsRequest)
-> (Value -> Parser [ListPromptsRequest])
-> Maybe ListPromptsRequest
-> FromJSON ListPromptsRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ListPromptsRequest
parseJSON :: Value -> Parser ListPromptsRequest
$cparseJSONList :: Value -> Parser [ListPromptsRequest]
parseJSONList :: Value -> Parser [ListPromptsRequest]
$comittedField :: Maybe ListPromptsRequest
omittedField :: Maybe ListPromptsRequest
FromJSON) via ViaJSONRPCRequest ListPromptsRequest

instance IsJSONRPCRequest ListPromptsRequest where
    requestMethod :: Proxy ListPromptsRequest -> Text
requestMethod Proxy ListPromptsRequest
_ = Text
"prompts/list"

{- | Get prompt request parameters.

Parameters for retrieving a specific prompt with optional arguments.
-}
data GetPromptParams = GetPromptParams
    { GetPromptParams -> Text
name :: Text
    -- ^ The name of the prompt or prompt template.
    , GetPromptParams -> Maybe (Map Text Text)
arguments :: Maybe (Map Text Text)
    -- ^ Arguments to use for templating the prompt.
    }
    deriving stock (Int -> GetPromptParams -> ShowS
[GetPromptParams] -> ShowS
GetPromptParams -> String
(Int -> GetPromptParams -> ShowS)
-> (GetPromptParams -> String)
-> ([GetPromptParams] -> ShowS)
-> Show GetPromptParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPromptParams -> ShowS
showsPrec :: Int -> GetPromptParams -> ShowS
$cshow :: GetPromptParams -> String
show :: GetPromptParams -> String
$cshowList :: [GetPromptParams] -> ShowS
showList :: [GetPromptParams] -> ShowS
Show, GetPromptParams -> GetPromptParams -> Bool
(GetPromptParams -> GetPromptParams -> Bool)
-> (GetPromptParams -> GetPromptParams -> Bool)
-> Eq GetPromptParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPromptParams -> GetPromptParams -> Bool
== :: GetPromptParams -> GetPromptParams -> Bool
$c/= :: GetPromptParams -> GetPromptParams -> Bool
/= :: GetPromptParams -> GetPromptParams -> Bool
Eq, (forall x. GetPromptParams -> Rep GetPromptParams x)
-> (forall x. Rep GetPromptParams x -> GetPromptParams)
-> Generic GetPromptParams
forall x. Rep GetPromptParams x -> GetPromptParams
forall x. GetPromptParams -> Rep GetPromptParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GetPromptParams -> Rep GetPromptParams x
from :: forall x. GetPromptParams -> Rep GetPromptParams x
$cto :: forall x. Rep GetPromptParams x -> GetPromptParams
to :: forall x. Rep GetPromptParams x -> GetPromptParams
Generic)

$(deriveJSON mcpParseOpts ''GetPromptParams)

-- | Used by the client to get a prompt provided by the server.
data GetPromptRequest = GetPromptRequest
    { GetPromptRequest -> RequestId
id :: RequestId
    , GetPromptRequest -> GetPromptParams
params :: GetPromptParams
    }
    deriving stock (Int -> GetPromptRequest -> ShowS
[GetPromptRequest] -> ShowS
GetPromptRequest -> String
(Int -> GetPromptRequest -> ShowS)
-> (GetPromptRequest -> String)
-> ([GetPromptRequest] -> ShowS)
-> Show GetPromptRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPromptRequest -> ShowS
showsPrec :: Int -> GetPromptRequest -> ShowS
$cshow :: GetPromptRequest -> String
show :: GetPromptRequest -> String
$cshowList :: [GetPromptRequest] -> ShowS
showList :: [GetPromptRequest] -> ShowS
Show, GetPromptRequest -> GetPromptRequest -> Bool
(GetPromptRequest -> GetPromptRequest -> Bool)
-> (GetPromptRequest -> GetPromptRequest -> Bool)
-> Eq GetPromptRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPromptRequest -> GetPromptRequest -> Bool
== :: GetPromptRequest -> GetPromptRequest -> Bool
$c/= :: GetPromptRequest -> GetPromptRequest -> Bool
/= :: GetPromptRequest -> GetPromptRequest -> Bool
Eq, (forall x. GetPromptRequest -> Rep GetPromptRequest x)
-> (forall x. Rep GetPromptRequest x -> GetPromptRequest)
-> Generic GetPromptRequest
forall x. Rep GetPromptRequest x -> GetPromptRequest
forall x. GetPromptRequest -> Rep GetPromptRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GetPromptRequest -> Rep GetPromptRequest x
from :: forall x. GetPromptRequest -> Rep GetPromptRequest x
$cto :: forall x. Rep GetPromptRequest x -> GetPromptRequest
to :: forall x. Rep GetPromptRequest x -> GetPromptRequest
Generic)
    deriving ([GetPromptRequest] -> Value
[GetPromptRequest] -> Encoding
GetPromptRequest -> Bool
GetPromptRequest -> Value
GetPromptRequest -> Encoding
(GetPromptRequest -> Value)
-> (GetPromptRequest -> Encoding)
-> ([GetPromptRequest] -> Value)
-> ([GetPromptRequest] -> Encoding)
-> (GetPromptRequest -> Bool)
-> ToJSON GetPromptRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: GetPromptRequest -> Value
toJSON :: GetPromptRequest -> Value
$ctoEncoding :: GetPromptRequest -> Encoding
toEncoding :: GetPromptRequest -> Encoding
$ctoJSONList :: [GetPromptRequest] -> Value
toJSONList :: [GetPromptRequest] -> Value
$ctoEncodingList :: [GetPromptRequest] -> Encoding
toEncodingList :: [GetPromptRequest] -> Encoding
$comitField :: GetPromptRequest -> Bool
omitField :: GetPromptRequest -> Bool
ToJSON, Maybe GetPromptRequest
Value -> Parser [GetPromptRequest]
Value -> Parser GetPromptRequest
(Value -> Parser GetPromptRequest)
-> (Value -> Parser [GetPromptRequest])
-> Maybe GetPromptRequest
-> FromJSON GetPromptRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser GetPromptRequest
parseJSON :: Value -> Parser GetPromptRequest
$cparseJSONList :: Value -> Parser [GetPromptRequest]
parseJSONList :: Value -> Parser [GetPromptRequest]
$comittedField :: Maybe GetPromptRequest
omittedField :: Maybe GetPromptRequest
FromJSON) via ViaJSONRPCRequest GetPromptRequest

instance IsJSONRPCRequest GetPromptRequest where
    requestMethod :: Proxy GetPromptRequest -> Text
requestMethod Proxy GetPromptRequest
_ = Text
"prompts/get"

{- | List tools request parameters.

Parameters for requesting a paginated list of tools.
-}
data ListToolsParams where
    ListToolsParams ::
        { ListToolsParams -> Maybe Cursor
cursor :: Maybe Cursor
        {- ^ An opaque token representing the current pagination position.
        If provided, the server should return results starting after this cursor.
        -}
        } ->
        ListToolsParams
    deriving stock (Int -> ListToolsParams -> ShowS
[ListToolsParams] -> ShowS
ListToolsParams -> String
(Int -> ListToolsParams -> ShowS)
-> (ListToolsParams -> String)
-> ([ListToolsParams] -> ShowS)
-> Show ListToolsParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListToolsParams -> ShowS
showsPrec :: Int -> ListToolsParams -> ShowS
$cshow :: ListToolsParams -> String
show :: ListToolsParams -> String
$cshowList :: [ListToolsParams] -> ShowS
showList :: [ListToolsParams] -> ShowS
Show, ListToolsParams -> ListToolsParams -> Bool
(ListToolsParams -> ListToolsParams -> Bool)
-> (ListToolsParams -> ListToolsParams -> Bool)
-> Eq ListToolsParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListToolsParams -> ListToolsParams -> Bool
== :: ListToolsParams -> ListToolsParams -> Bool
$c/= :: ListToolsParams -> ListToolsParams -> Bool
/= :: ListToolsParams -> ListToolsParams -> Bool
Eq, (forall x. ListToolsParams -> Rep ListToolsParams x)
-> (forall x. Rep ListToolsParams x -> ListToolsParams)
-> Generic ListToolsParams
forall x. Rep ListToolsParams x -> ListToolsParams
forall x. ListToolsParams -> Rep ListToolsParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListToolsParams -> Rep ListToolsParams x
from :: forall x. ListToolsParams -> Rep ListToolsParams x
$cto :: forall x. Rep ListToolsParams x -> ListToolsParams
to :: forall x. Rep ListToolsParams x -> ListToolsParams
Generic)

$(deriveJSON mcpParseOpts ''ListToolsParams)

-- | Sent from the client to request a list of tools the server has.
data ListToolsRequest = ListToolsRequest
    { ListToolsRequest -> RequestId
id :: RequestId
    , ListToolsRequest -> Maybe ListToolsParams
params :: Maybe ListToolsParams
    }
    deriving stock (Int -> ListToolsRequest -> ShowS
[ListToolsRequest] -> ShowS
ListToolsRequest -> String
(Int -> ListToolsRequest -> ShowS)
-> (ListToolsRequest -> String)
-> ([ListToolsRequest] -> ShowS)
-> Show ListToolsRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListToolsRequest -> ShowS
showsPrec :: Int -> ListToolsRequest -> ShowS
$cshow :: ListToolsRequest -> String
show :: ListToolsRequest -> String
$cshowList :: [ListToolsRequest] -> ShowS
showList :: [ListToolsRequest] -> ShowS
Show, ListToolsRequest -> ListToolsRequest -> Bool
(ListToolsRequest -> ListToolsRequest -> Bool)
-> (ListToolsRequest -> ListToolsRequest -> Bool)
-> Eq ListToolsRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListToolsRequest -> ListToolsRequest -> Bool
== :: ListToolsRequest -> ListToolsRequest -> Bool
$c/= :: ListToolsRequest -> ListToolsRequest -> Bool
/= :: ListToolsRequest -> ListToolsRequest -> Bool
Eq, (forall x. ListToolsRequest -> Rep ListToolsRequest x)
-> (forall x. Rep ListToolsRequest x -> ListToolsRequest)
-> Generic ListToolsRequest
forall x. Rep ListToolsRequest x -> ListToolsRequest
forall x. ListToolsRequest -> Rep ListToolsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListToolsRequest -> Rep ListToolsRequest x
from :: forall x. ListToolsRequest -> Rep ListToolsRequest x
$cto :: forall x. Rep ListToolsRequest x -> ListToolsRequest
to :: forall x. Rep ListToolsRequest x -> ListToolsRequest
Generic)
    deriving ([ListToolsRequest] -> Value
[ListToolsRequest] -> Encoding
ListToolsRequest -> Bool
ListToolsRequest -> Value
ListToolsRequest -> Encoding
(ListToolsRequest -> Value)
-> (ListToolsRequest -> Encoding)
-> ([ListToolsRequest] -> Value)
-> ([ListToolsRequest] -> Encoding)
-> (ListToolsRequest -> Bool)
-> ToJSON ListToolsRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ListToolsRequest -> Value
toJSON :: ListToolsRequest -> Value
$ctoEncoding :: ListToolsRequest -> Encoding
toEncoding :: ListToolsRequest -> Encoding
$ctoJSONList :: [ListToolsRequest] -> Value
toJSONList :: [ListToolsRequest] -> Value
$ctoEncodingList :: [ListToolsRequest] -> Encoding
toEncodingList :: [ListToolsRequest] -> Encoding
$comitField :: ListToolsRequest -> Bool
omitField :: ListToolsRequest -> Bool
ToJSON, Maybe ListToolsRequest
Value -> Parser [ListToolsRequest]
Value -> Parser ListToolsRequest
(Value -> Parser ListToolsRequest)
-> (Value -> Parser [ListToolsRequest])
-> Maybe ListToolsRequest
-> FromJSON ListToolsRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ListToolsRequest
parseJSON :: Value -> Parser ListToolsRequest
$cparseJSONList :: Value -> Parser [ListToolsRequest]
parseJSONList :: Value -> Parser [ListToolsRequest]
$comittedField :: Maybe ListToolsRequest
omittedField :: Maybe ListToolsRequest
FromJSON) via ViaJSONRPCRequest ListToolsRequest

instance IsJSONRPCRequest ListToolsRequest where
    requestMethod :: Proxy ListToolsRequest -> Text
requestMethod Proxy ListToolsRequest
_ = Text
"tools/list"

{- | Call tool request parameters.

Parameters for invoking a specific tool with arguments.
-}
data CallToolParams = CallToolParams
    { CallToolParams -> Text
name :: Text
    , CallToolParams -> Maybe (Map Text Value)
arguments :: Maybe (Map Text Value)
    }
    deriving stock (Int -> CallToolParams -> ShowS
[CallToolParams] -> ShowS
CallToolParams -> String
(Int -> CallToolParams -> ShowS)
-> (CallToolParams -> String)
-> ([CallToolParams] -> ShowS)
-> Show CallToolParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CallToolParams -> ShowS
showsPrec :: Int -> CallToolParams -> ShowS
$cshow :: CallToolParams -> String
show :: CallToolParams -> String
$cshowList :: [CallToolParams] -> ShowS
showList :: [CallToolParams] -> ShowS
Show, CallToolParams -> CallToolParams -> Bool
(CallToolParams -> CallToolParams -> Bool)
-> (CallToolParams -> CallToolParams -> Bool) -> Eq CallToolParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CallToolParams -> CallToolParams -> Bool
== :: CallToolParams -> CallToolParams -> Bool
$c/= :: CallToolParams -> CallToolParams -> Bool
/= :: CallToolParams -> CallToolParams -> Bool
Eq, (forall x. CallToolParams -> Rep CallToolParams x)
-> (forall x. Rep CallToolParams x -> CallToolParams)
-> Generic CallToolParams
forall x. Rep CallToolParams x -> CallToolParams
forall x. CallToolParams -> Rep CallToolParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CallToolParams -> Rep CallToolParams x
from :: forall x. CallToolParams -> Rep CallToolParams x
$cto :: forall x. Rep CallToolParams x -> CallToolParams
to :: forall x. Rep CallToolParams x -> CallToolParams
Generic, Eq CallToolParams
Eq CallToolParams =>
(CallToolParams -> CallToolParams -> Ordering)
-> (CallToolParams -> CallToolParams -> Bool)
-> (CallToolParams -> CallToolParams -> Bool)
-> (CallToolParams -> CallToolParams -> Bool)
-> (CallToolParams -> CallToolParams -> Bool)
-> (CallToolParams -> CallToolParams -> CallToolParams)
-> (CallToolParams -> CallToolParams -> CallToolParams)
-> Ord CallToolParams
CallToolParams -> CallToolParams -> Bool
CallToolParams -> CallToolParams -> Ordering
CallToolParams -> CallToolParams -> CallToolParams
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CallToolParams -> CallToolParams -> Ordering
compare :: CallToolParams -> CallToolParams -> Ordering
$c< :: CallToolParams -> CallToolParams -> Bool
< :: CallToolParams -> CallToolParams -> Bool
$c<= :: CallToolParams -> CallToolParams -> Bool
<= :: CallToolParams -> CallToolParams -> Bool
$c> :: CallToolParams -> CallToolParams -> Bool
> :: CallToolParams -> CallToolParams -> Bool
$c>= :: CallToolParams -> CallToolParams -> Bool
>= :: CallToolParams -> CallToolParams -> Bool
$cmax :: CallToolParams -> CallToolParams -> CallToolParams
max :: CallToolParams -> CallToolParams -> CallToolParams
$cmin :: CallToolParams -> CallToolParams -> CallToolParams
min :: CallToolParams -> CallToolParams -> CallToolParams
Ord)

$(deriveJSON mcpParseOpts ''CallToolParams)

-- | Used by the client to invoke a tool provided by the server.
data CallToolRequest = CallToolRequest
    { CallToolRequest -> RequestId
id :: RequestId
    , CallToolRequest -> CallToolParams
params :: CallToolParams
    }
    deriving stock (Int -> CallToolRequest -> ShowS
[CallToolRequest] -> ShowS
CallToolRequest -> String
(Int -> CallToolRequest -> ShowS)
-> (CallToolRequest -> String)
-> ([CallToolRequest] -> ShowS)
-> Show CallToolRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CallToolRequest -> ShowS
showsPrec :: Int -> CallToolRequest -> ShowS
$cshow :: CallToolRequest -> String
show :: CallToolRequest -> String
$cshowList :: [CallToolRequest] -> ShowS
showList :: [CallToolRequest] -> ShowS
Show, CallToolRequest -> CallToolRequest -> Bool
(CallToolRequest -> CallToolRequest -> Bool)
-> (CallToolRequest -> CallToolRequest -> Bool)
-> Eq CallToolRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CallToolRequest -> CallToolRequest -> Bool
== :: CallToolRequest -> CallToolRequest -> Bool
$c/= :: CallToolRequest -> CallToolRequest -> Bool
/= :: CallToolRequest -> CallToolRequest -> Bool
Eq, (forall x. CallToolRequest -> Rep CallToolRequest x)
-> (forall x. Rep CallToolRequest x -> CallToolRequest)
-> Generic CallToolRequest
forall x. Rep CallToolRequest x -> CallToolRequest
forall x. CallToolRequest -> Rep CallToolRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CallToolRequest -> Rep CallToolRequest x
from :: forall x. CallToolRequest -> Rep CallToolRequest x
$cto :: forall x. Rep CallToolRequest x -> CallToolRequest
to :: forall x. Rep CallToolRequest x -> CallToolRequest
Generic)
    deriving ([CallToolRequest] -> Value
[CallToolRequest] -> Encoding
CallToolRequest -> Bool
CallToolRequest -> Value
CallToolRequest -> Encoding
(CallToolRequest -> Value)
-> (CallToolRequest -> Encoding)
-> ([CallToolRequest] -> Value)
-> ([CallToolRequest] -> Encoding)
-> (CallToolRequest -> Bool)
-> ToJSON CallToolRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CallToolRequest -> Value
toJSON :: CallToolRequest -> Value
$ctoEncoding :: CallToolRequest -> Encoding
toEncoding :: CallToolRequest -> Encoding
$ctoJSONList :: [CallToolRequest] -> Value
toJSONList :: [CallToolRequest] -> Value
$ctoEncodingList :: [CallToolRequest] -> Encoding
toEncodingList :: [CallToolRequest] -> Encoding
$comitField :: CallToolRequest -> Bool
omitField :: CallToolRequest -> Bool
ToJSON, Maybe CallToolRequest
Value -> Parser [CallToolRequest]
Value -> Parser CallToolRequest
(Value -> Parser CallToolRequest)
-> (Value -> Parser [CallToolRequest])
-> Maybe CallToolRequest
-> FromJSON CallToolRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CallToolRequest
parseJSON :: Value -> Parser CallToolRequest
$cparseJSONList :: Value -> Parser [CallToolRequest]
parseJSONList :: Value -> Parser [CallToolRequest]
$comittedField :: Maybe CallToolRequest
omittedField :: Maybe CallToolRequest
FromJSON) via ViaJSONRPCRequest CallToolRequest

instance IsJSONRPCRequest CallToolRequest where
    requestMethod :: Proxy CallToolRequest -> Text
requestMethod Proxy CallToolRequest
_ = Text
"tools/call"

{- | Set level request parameters.

Parameters for setting the logging level.
-}
data SetLevelParams where
    SetLevelParams ::
        { SetLevelParams -> LoggingLevel
level :: LoggingLevel
        {- ^ The level of logging that the client wants to receive from the server.
        The server should send all logs at this level and higher (i.e., more severe)
        to the client as notifications/message.
        -}
        } ->
        SetLevelParams
    deriving stock (Int -> SetLevelParams -> ShowS
[SetLevelParams] -> ShowS
SetLevelParams -> String
(Int -> SetLevelParams -> ShowS)
-> (SetLevelParams -> String)
-> ([SetLevelParams] -> ShowS)
-> Show SetLevelParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetLevelParams -> ShowS
showsPrec :: Int -> SetLevelParams -> ShowS
$cshow :: SetLevelParams -> String
show :: SetLevelParams -> String
$cshowList :: [SetLevelParams] -> ShowS
showList :: [SetLevelParams] -> ShowS
Show, SetLevelParams -> SetLevelParams -> Bool
(SetLevelParams -> SetLevelParams -> Bool)
-> (SetLevelParams -> SetLevelParams -> Bool) -> Eq SetLevelParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetLevelParams -> SetLevelParams -> Bool
== :: SetLevelParams -> SetLevelParams -> Bool
$c/= :: SetLevelParams -> SetLevelParams -> Bool
/= :: SetLevelParams -> SetLevelParams -> Bool
Eq, (forall x. SetLevelParams -> Rep SetLevelParams x)
-> (forall x. Rep SetLevelParams x -> SetLevelParams)
-> Generic SetLevelParams
forall x. Rep SetLevelParams x -> SetLevelParams
forall x. SetLevelParams -> Rep SetLevelParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SetLevelParams -> Rep SetLevelParams x
from :: forall x. SetLevelParams -> Rep SetLevelParams x
$cto :: forall x. Rep SetLevelParams x -> SetLevelParams
to :: forall x. Rep SetLevelParams x -> SetLevelParams
Generic)

$(deriveJSON mcpParseOpts ''SetLevelParams)

-- | A request from the client to the server, to enable or adjust logging.
data SetLevelRequest = SetLevelRequest
    { SetLevelRequest -> RequestId
id :: RequestId
    , SetLevelRequest -> SetLevelParams
params :: SetLevelParams
    }
    deriving stock (Int -> SetLevelRequest -> ShowS
[SetLevelRequest] -> ShowS
SetLevelRequest -> String
(Int -> SetLevelRequest -> ShowS)
-> (SetLevelRequest -> String)
-> ([SetLevelRequest] -> ShowS)
-> Show SetLevelRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetLevelRequest -> ShowS
showsPrec :: Int -> SetLevelRequest -> ShowS
$cshow :: SetLevelRequest -> String
show :: SetLevelRequest -> String
$cshowList :: [SetLevelRequest] -> ShowS
showList :: [SetLevelRequest] -> ShowS
Show, SetLevelRequest -> SetLevelRequest -> Bool
(SetLevelRequest -> SetLevelRequest -> Bool)
-> (SetLevelRequest -> SetLevelRequest -> Bool)
-> Eq SetLevelRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetLevelRequest -> SetLevelRequest -> Bool
== :: SetLevelRequest -> SetLevelRequest -> Bool
$c/= :: SetLevelRequest -> SetLevelRequest -> Bool
/= :: SetLevelRequest -> SetLevelRequest -> Bool
Eq, (forall x. SetLevelRequest -> Rep SetLevelRequest x)
-> (forall x. Rep SetLevelRequest x -> SetLevelRequest)
-> Generic SetLevelRequest
forall x. Rep SetLevelRequest x -> SetLevelRequest
forall x. SetLevelRequest -> Rep SetLevelRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SetLevelRequest -> Rep SetLevelRequest x
from :: forall x. SetLevelRequest -> Rep SetLevelRequest x
$cto :: forall x. Rep SetLevelRequest x -> SetLevelRequest
to :: forall x. Rep SetLevelRequest x -> SetLevelRequest
Generic)
    deriving ([SetLevelRequest] -> Value
[SetLevelRequest] -> Encoding
SetLevelRequest -> Bool
SetLevelRequest -> Value
SetLevelRequest -> Encoding
(SetLevelRequest -> Value)
-> (SetLevelRequest -> Encoding)
-> ([SetLevelRequest] -> Value)
-> ([SetLevelRequest] -> Encoding)
-> (SetLevelRequest -> Bool)
-> ToJSON SetLevelRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: SetLevelRequest -> Value
toJSON :: SetLevelRequest -> Value
$ctoEncoding :: SetLevelRequest -> Encoding
toEncoding :: SetLevelRequest -> Encoding
$ctoJSONList :: [SetLevelRequest] -> Value
toJSONList :: [SetLevelRequest] -> Value
$ctoEncodingList :: [SetLevelRequest] -> Encoding
toEncodingList :: [SetLevelRequest] -> Encoding
$comitField :: SetLevelRequest -> Bool
omitField :: SetLevelRequest -> Bool
ToJSON, Maybe SetLevelRequest
Value -> Parser [SetLevelRequest]
Value -> Parser SetLevelRequest
(Value -> Parser SetLevelRequest)
-> (Value -> Parser [SetLevelRequest])
-> Maybe SetLevelRequest
-> FromJSON SetLevelRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser SetLevelRequest
parseJSON :: Value -> Parser SetLevelRequest
$cparseJSONList :: Value -> Parser [SetLevelRequest]
parseJSONList :: Value -> Parser [SetLevelRequest]
$comittedField :: Maybe SetLevelRequest
omittedField :: Maybe SetLevelRequest
FromJSON) via ViaJSONRPCRequest SetLevelRequest

instance IsJSONRPCRequest SetLevelRequest where
    requestMethod :: Proxy SetLevelRequest -> Text
requestMethod Proxy SetLevelRequest
_ = Text
"logging/setLevel"

{- | Completion argument.

Represents an argument for completion requests.
-}
data CompletionArgument = CompletionArgument
    { CompletionArgument -> Text
name :: Text
    -- ^ The name of the argument.
    , CompletionArgument -> Text
value :: Text
    -- ^ The value of the argument to use for completion matching.
    }
    deriving stock (Int -> CompletionArgument -> ShowS
[CompletionArgument] -> ShowS
CompletionArgument -> String
(Int -> CompletionArgument -> ShowS)
-> (CompletionArgument -> String)
-> ([CompletionArgument] -> ShowS)
-> Show CompletionArgument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompletionArgument -> ShowS
showsPrec :: Int -> CompletionArgument -> ShowS
$cshow :: CompletionArgument -> String
show :: CompletionArgument -> String
$cshowList :: [CompletionArgument] -> ShowS
showList :: [CompletionArgument] -> ShowS
Show, CompletionArgument -> CompletionArgument -> Bool
(CompletionArgument -> CompletionArgument -> Bool)
-> (CompletionArgument -> CompletionArgument -> Bool)
-> Eq CompletionArgument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompletionArgument -> CompletionArgument -> Bool
== :: CompletionArgument -> CompletionArgument -> Bool
$c/= :: CompletionArgument -> CompletionArgument -> Bool
/= :: CompletionArgument -> CompletionArgument -> Bool
Eq, (forall x. CompletionArgument -> Rep CompletionArgument x)
-> (forall x. Rep CompletionArgument x -> CompletionArgument)
-> Generic CompletionArgument
forall x. Rep CompletionArgument x -> CompletionArgument
forall x. CompletionArgument -> Rep CompletionArgument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompletionArgument -> Rep CompletionArgument x
from :: forall x. CompletionArgument -> Rep CompletionArgument x
$cto :: forall x. Rep CompletionArgument x -> CompletionArgument
to :: forall x. Rep CompletionArgument x -> CompletionArgument
Generic)

$(deriveJSON mcpParseOpts ''CompletionArgument)

{- | Reference to either a prompt or resource template.

Used in completion requests to specify what is being completed.
-}
data Reference
    = PromptRef PromptReference
    | ResourceTemplateRef ResourceTemplateReference
    deriving stock (Int -> Reference -> ShowS
[Reference] -> ShowS
Reference -> String
(Int -> Reference -> ShowS)
-> (Reference -> String)
-> ([Reference] -> ShowS)
-> Show Reference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Reference -> ShowS
showsPrec :: Int -> Reference -> ShowS
$cshow :: Reference -> String
show :: Reference -> String
$cshowList :: [Reference] -> ShowS
showList :: [Reference] -> ShowS
Show, Reference -> Reference -> Bool
(Reference -> Reference -> Bool)
-> (Reference -> Reference -> Bool) -> Eq Reference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Reference -> Reference -> Bool
== :: Reference -> Reference -> Bool
$c/= :: Reference -> Reference -> Bool
/= :: Reference -> Reference -> Bool
Eq, (forall x. Reference -> Rep Reference x)
-> (forall x. Rep Reference x -> Reference) -> Generic Reference
forall x. Rep Reference x -> Reference
forall x. Reference -> Rep Reference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Reference -> Rep Reference x
from :: forall x. Reference -> Rep Reference x
$cto :: forall x. Rep Reference x -> Reference
to :: forall x. Rep Reference x -> Reference
Generic)

instance ToJSON Reference where
    toJSON :: Reference -> Value
toJSON (PromptRef PromptReference
p) = PromptReference -> Value
forall a. ToJSON a => a -> Value
toJSON PromptReference
p
    toJSON (ResourceTemplateRef ResourceTemplateReference
r) = ResourceTemplateReference -> Value
forall a. ToJSON a => a -> Value
toJSON ResourceTemplateReference
r

instance FromJSON Reference where
    parseJSON :: Value -> Parser Reference
parseJSON Value
v =
        (PromptReference -> Reference
PromptRef (PromptReference -> Reference)
-> Parser PromptReference -> Parser Reference
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser PromptReference
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser Reference -> Parser Reference -> Parser Reference
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ResourceTemplateReference -> Reference
ResourceTemplateRef (ResourceTemplateReference -> Reference)
-> Parser ResourceTemplateReference -> Parser Reference
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ResourceTemplateReference
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)

-- | Context for completion requests
data CompletionContext = CompletionContext
    { CompletionContext -> Maybe (Map Text Text)
arguments :: Maybe (Map Text Text)
    }
    deriving stock (Int -> CompletionContext -> ShowS
[CompletionContext] -> ShowS
CompletionContext -> String
(Int -> CompletionContext -> ShowS)
-> (CompletionContext -> String)
-> ([CompletionContext] -> ShowS)
-> Show CompletionContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompletionContext -> ShowS
showsPrec :: Int -> CompletionContext -> ShowS
$cshow :: CompletionContext -> String
show :: CompletionContext -> String
$cshowList :: [CompletionContext] -> ShowS
showList :: [CompletionContext] -> ShowS
Show, CompletionContext -> CompletionContext -> Bool
(CompletionContext -> CompletionContext -> Bool)
-> (CompletionContext -> CompletionContext -> Bool)
-> Eq CompletionContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompletionContext -> CompletionContext -> Bool
== :: CompletionContext -> CompletionContext -> Bool
$c/= :: CompletionContext -> CompletionContext -> Bool
/= :: CompletionContext -> CompletionContext -> Bool
Eq, (forall x. CompletionContext -> Rep CompletionContext x)
-> (forall x. Rep CompletionContext x -> CompletionContext)
-> Generic CompletionContext
forall x. Rep CompletionContext x -> CompletionContext
forall x. CompletionContext -> Rep CompletionContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompletionContext -> Rep CompletionContext x
from :: forall x. CompletionContext -> Rep CompletionContext x
$cto :: forall x. Rep CompletionContext x -> CompletionContext
to :: forall x. Rep CompletionContext x -> CompletionContext
Generic)

$(deriveJSON mcpParseOpts ''CompletionContext)

{- | Complete request parameters.

Parameters for requesting completion options.
-}
data CompleteParams = CompleteParams
    { CompleteParams -> Reference
ref :: Reference
    , CompleteParams -> CompletionArgument
argument :: CompletionArgument
    -- ^ The argument's information.
    , CompleteParams -> Maybe CompletionContext
context :: Maybe CompletionContext
    {- ^ Additional, optional context for completions.
    Previously-resolved variables in a URI template or prompt.
    -}
    }
    deriving stock (Int -> CompleteParams -> ShowS
[CompleteParams] -> ShowS
CompleteParams -> String
(Int -> CompleteParams -> ShowS)
-> (CompleteParams -> String)
-> ([CompleteParams] -> ShowS)
-> Show CompleteParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompleteParams -> ShowS
showsPrec :: Int -> CompleteParams -> ShowS
$cshow :: CompleteParams -> String
show :: CompleteParams -> String
$cshowList :: [CompleteParams] -> ShowS
showList :: [CompleteParams] -> ShowS
Show, CompleteParams -> CompleteParams -> Bool
(CompleteParams -> CompleteParams -> Bool)
-> (CompleteParams -> CompleteParams -> Bool) -> Eq CompleteParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompleteParams -> CompleteParams -> Bool
== :: CompleteParams -> CompleteParams -> Bool
$c/= :: CompleteParams -> CompleteParams -> Bool
/= :: CompleteParams -> CompleteParams -> Bool
Eq, (forall x. CompleteParams -> Rep CompleteParams x)
-> (forall x. Rep CompleteParams x -> CompleteParams)
-> Generic CompleteParams
forall x. Rep CompleteParams x -> CompleteParams
forall x. CompleteParams -> Rep CompleteParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompleteParams -> Rep CompleteParams x
from :: forall x. CompleteParams -> Rep CompleteParams x
$cto :: forall x. Rep CompleteParams x -> CompleteParams
to :: forall x. Rep CompleteParams x -> CompleteParams
Generic)

$(deriveJSON mcpParseOpts ''CompleteParams)

-- | A request from the client to the server, to ask for completion options.
data CompleteRequest = CompleteRequest
    { CompleteRequest -> RequestId
id :: RequestId
    , CompleteRequest -> CompleteParams
params :: CompleteParams
    }
    deriving stock (Int -> CompleteRequest -> ShowS
[CompleteRequest] -> ShowS
CompleteRequest -> String
(Int -> CompleteRequest -> ShowS)
-> (CompleteRequest -> String)
-> ([CompleteRequest] -> ShowS)
-> Show CompleteRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompleteRequest -> ShowS
showsPrec :: Int -> CompleteRequest -> ShowS
$cshow :: CompleteRequest -> String
show :: CompleteRequest -> String
$cshowList :: [CompleteRequest] -> ShowS
showList :: [CompleteRequest] -> ShowS
Show, CompleteRequest -> CompleteRequest -> Bool
(CompleteRequest -> CompleteRequest -> Bool)
-> (CompleteRequest -> CompleteRequest -> Bool)
-> Eq CompleteRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompleteRequest -> CompleteRequest -> Bool
== :: CompleteRequest -> CompleteRequest -> Bool
$c/= :: CompleteRequest -> CompleteRequest -> Bool
/= :: CompleteRequest -> CompleteRequest -> Bool
Eq, (forall x. CompleteRequest -> Rep CompleteRequest x)
-> (forall x. Rep CompleteRequest x -> CompleteRequest)
-> Generic CompleteRequest
forall x. Rep CompleteRequest x -> CompleteRequest
forall x. CompleteRequest -> Rep CompleteRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompleteRequest -> Rep CompleteRequest x
from :: forall x. CompleteRequest -> Rep CompleteRequest x
$cto :: forall x. Rep CompleteRequest x -> CompleteRequest
to :: forall x. Rep CompleteRequest x -> CompleteRequest
Generic)
    deriving ([CompleteRequest] -> Value
[CompleteRequest] -> Encoding
CompleteRequest -> Bool
CompleteRequest -> Value
CompleteRequest -> Encoding
(CompleteRequest -> Value)
-> (CompleteRequest -> Encoding)
-> ([CompleteRequest] -> Value)
-> ([CompleteRequest] -> Encoding)
-> (CompleteRequest -> Bool)
-> ToJSON CompleteRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CompleteRequest -> Value
toJSON :: CompleteRequest -> Value
$ctoEncoding :: CompleteRequest -> Encoding
toEncoding :: CompleteRequest -> Encoding
$ctoJSONList :: [CompleteRequest] -> Value
toJSONList :: [CompleteRequest] -> Value
$ctoEncodingList :: [CompleteRequest] -> Encoding
toEncodingList :: [CompleteRequest] -> Encoding
$comitField :: CompleteRequest -> Bool
omitField :: CompleteRequest -> Bool
ToJSON, Maybe CompleteRequest
Value -> Parser [CompleteRequest]
Value -> Parser CompleteRequest
(Value -> Parser CompleteRequest)
-> (Value -> Parser [CompleteRequest])
-> Maybe CompleteRequest
-> FromJSON CompleteRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CompleteRequest
parseJSON :: Value -> Parser CompleteRequest
$cparseJSONList :: Value -> Parser [CompleteRequest]
parseJSONList :: Value -> Parser [CompleteRequest]
$comittedField :: Maybe CompleteRequest
omittedField :: Maybe CompleteRequest
FromJSON) via ViaJSONRPCRequest CompleteRequest

instance IsJSONRPCRequest CompleteRequest where
    requestMethod :: Proxy CompleteRequest -> Text
requestMethod Proxy CompleteRequest
_ = Text
"completion/complete"

-- * Server Request Types

{- | Create message request parameters.

Parameters for requesting LLM sampling from the client.
-}
data CreateMessageParams = CreateMessageParams
    { CreateMessageParams -> Int
maxTokens :: Int
    {- ^ The maximum number of tokens to sample, as requested by the server.
    The client MAY choose to sample fewer tokens than requested.
    -}
    , CreateMessageParams -> [SamplingMessage]
messages :: [SamplingMessage]
    , CreateMessageParams -> Maybe ModelPreferences
modelPreferences :: Maybe ModelPreferences
    -- ^ The server's preferences for which model to select. The client MAY ignore these preferences.
    , CreateMessageParams -> Maybe Text
systemPrompt :: Maybe Text
    {- ^ An optional system prompt the server wants to use for sampling.
    The client MAY modify or omit this prompt.
    -}
    , CreateMessageParams -> Maybe IncludeContext
includeContext :: Maybe IncludeContext
    {- ^ A request to include context from one or more MCP servers (including the caller),
    to be attached to the prompt. The client MAY ignore this request.
    -}
    , CreateMessageParams -> Maybe Double
temperature :: Maybe Double
    , CreateMessageParams -> Maybe [Text]
stopSequences :: Maybe [Text]
    , CreateMessageParams -> Maybe (Map Text Value)
metadata :: Maybe (Map Text Value)
    {- ^ Optional metadata to pass through to the LLM provider.
    The format of this metadata is provider-specific.
    -}
    }
    deriving stock (Int -> CreateMessageParams -> ShowS
[CreateMessageParams] -> ShowS
CreateMessageParams -> String
(Int -> CreateMessageParams -> ShowS)
-> (CreateMessageParams -> String)
-> ([CreateMessageParams] -> ShowS)
-> Show CreateMessageParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateMessageParams -> ShowS
showsPrec :: Int -> CreateMessageParams -> ShowS
$cshow :: CreateMessageParams -> String
show :: CreateMessageParams -> String
$cshowList :: [CreateMessageParams] -> ShowS
showList :: [CreateMessageParams] -> ShowS
Show, CreateMessageParams -> CreateMessageParams -> Bool
(CreateMessageParams -> CreateMessageParams -> Bool)
-> (CreateMessageParams -> CreateMessageParams -> Bool)
-> Eq CreateMessageParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateMessageParams -> CreateMessageParams -> Bool
== :: CreateMessageParams -> CreateMessageParams -> Bool
$c/= :: CreateMessageParams -> CreateMessageParams -> Bool
/= :: CreateMessageParams -> CreateMessageParams -> Bool
Eq, (forall x. CreateMessageParams -> Rep CreateMessageParams x)
-> (forall x. Rep CreateMessageParams x -> CreateMessageParams)
-> Generic CreateMessageParams
forall x. Rep CreateMessageParams x -> CreateMessageParams
forall x. CreateMessageParams -> Rep CreateMessageParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateMessageParams -> Rep CreateMessageParams x
from :: forall x. CreateMessageParams -> Rep CreateMessageParams x
$cto :: forall x. Rep CreateMessageParams x -> CreateMessageParams
to :: forall x. Rep CreateMessageParams x -> CreateMessageParams
Generic)

$(deriveJSON mcpParseOpts ''CreateMessageParams)

{- | A request from the server to sample an LLM via the client.

The client has full discretion over which model to select. The client should also
inform the user before beginning sampling, to allow them to inspect the request
(human in the loop) and decide whether to approve it.
-}
data CreateMessageRequest = CreateMessageRequest
    { CreateMessageRequest -> RequestId
id :: RequestId
    , CreateMessageRequest -> CreateMessageParams
params :: CreateMessageParams
    }
    deriving stock (Int -> CreateMessageRequest -> ShowS
[CreateMessageRequest] -> ShowS
CreateMessageRequest -> String
(Int -> CreateMessageRequest -> ShowS)
-> (CreateMessageRequest -> String)
-> ([CreateMessageRequest] -> ShowS)
-> Show CreateMessageRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateMessageRequest -> ShowS
showsPrec :: Int -> CreateMessageRequest -> ShowS
$cshow :: CreateMessageRequest -> String
show :: CreateMessageRequest -> String
$cshowList :: [CreateMessageRequest] -> ShowS
showList :: [CreateMessageRequest] -> ShowS
Show, CreateMessageRequest -> CreateMessageRequest -> Bool
(CreateMessageRequest -> CreateMessageRequest -> Bool)
-> (CreateMessageRequest -> CreateMessageRequest -> Bool)
-> Eq CreateMessageRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateMessageRequest -> CreateMessageRequest -> Bool
== :: CreateMessageRequest -> CreateMessageRequest -> Bool
$c/= :: CreateMessageRequest -> CreateMessageRequest -> Bool
/= :: CreateMessageRequest -> CreateMessageRequest -> Bool
Eq, (forall x. CreateMessageRequest -> Rep CreateMessageRequest x)
-> (forall x. Rep CreateMessageRequest x -> CreateMessageRequest)
-> Generic CreateMessageRequest
forall x. Rep CreateMessageRequest x -> CreateMessageRequest
forall x. CreateMessageRequest -> Rep CreateMessageRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateMessageRequest -> Rep CreateMessageRequest x
from :: forall x. CreateMessageRequest -> Rep CreateMessageRequest x
$cto :: forall x. Rep CreateMessageRequest x -> CreateMessageRequest
to :: forall x. Rep CreateMessageRequest x -> CreateMessageRequest
Generic)
    deriving ([CreateMessageRequest] -> Value
[CreateMessageRequest] -> Encoding
CreateMessageRequest -> Bool
CreateMessageRequest -> Value
CreateMessageRequest -> Encoding
(CreateMessageRequest -> Value)
-> (CreateMessageRequest -> Encoding)
-> ([CreateMessageRequest] -> Value)
-> ([CreateMessageRequest] -> Encoding)
-> (CreateMessageRequest -> Bool)
-> ToJSON CreateMessageRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CreateMessageRequest -> Value
toJSON :: CreateMessageRequest -> Value
$ctoEncoding :: CreateMessageRequest -> Encoding
toEncoding :: CreateMessageRequest -> Encoding
$ctoJSONList :: [CreateMessageRequest] -> Value
toJSONList :: [CreateMessageRequest] -> Value
$ctoEncodingList :: [CreateMessageRequest] -> Encoding
toEncodingList :: [CreateMessageRequest] -> Encoding
$comitField :: CreateMessageRequest -> Bool
omitField :: CreateMessageRequest -> Bool
ToJSON, Maybe CreateMessageRequest
Value -> Parser [CreateMessageRequest]
Value -> Parser CreateMessageRequest
(Value -> Parser CreateMessageRequest)
-> (Value -> Parser [CreateMessageRequest])
-> Maybe CreateMessageRequest
-> FromJSON CreateMessageRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CreateMessageRequest
parseJSON :: Value -> Parser CreateMessageRequest
$cparseJSONList :: Value -> Parser [CreateMessageRequest]
parseJSONList :: Value -> Parser [CreateMessageRequest]
$comittedField :: Maybe CreateMessageRequest
omittedField :: Maybe CreateMessageRequest
FromJSON) via ViaJSONRPCRequest CreateMessageRequest

instance IsJSONRPCRequest CreateMessageRequest where
    requestMethod :: Proxy CreateMessageRequest -> Text
requestMethod Proxy CreateMessageRequest
_ = Text
"sampling/createMessage"

{- | List roots request parameters.

Parameters for requesting the list of root directories or files.
-}
data ListRootsParams where
    ListRootsParams :: {ListRootsParams -> Maybe Metadata
_meta :: Maybe Metadata} -> ListRootsParams
    deriving stock (Int -> ListRootsParams -> ShowS
[ListRootsParams] -> ShowS
ListRootsParams -> String
(Int -> ListRootsParams -> ShowS)
-> (ListRootsParams -> String)
-> ([ListRootsParams] -> ShowS)
-> Show ListRootsParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListRootsParams -> ShowS
showsPrec :: Int -> ListRootsParams -> ShowS
$cshow :: ListRootsParams -> String
show :: ListRootsParams -> String
$cshowList :: [ListRootsParams] -> ShowS
showList :: [ListRootsParams] -> ShowS
Show, ListRootsParams -> ListRootsParams -> Bool
(ListRootsParams -> ListRootsParams -> Bool)
-> (ListRootsParams -> ListRootsParams -> Bool)
-> Eq ListRootsParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListRootsParams -> ListRootsParams -> Bool
== :: ListRootsParams -> ListRootsParams -> Bool
$c/= :: ListRootsParams -> ListRootsParams -> Bool
/= :: ListRootsParams -> ListRootsParams -> Bool
Eq, (forall x. ListRootsParams -> Rep ListRootsParams x)
-> (forall x. Rep ListRootsParams x -> ListRootsParams)
-> Generic ListRootsParams
forall x. Rep ListRootsParams x -> ListRootsParams
forall x. ListRootsParams -> Rep ListRootsParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListRootsParams -> Rep ListRootsParams x
from :: forall x. ListRootsParams -> Rep ListRootsParams x
$cto :: forall x. Rep ListRootsParams x -> ListRootsParams
to :: forall x. Rep ListRootsParams x -> ListRootsParams
Generic)

$(deriveJSON mcpParseOpts ''ListRootsParams)

{- | Sent from the server to request a list of root URIs from the client.

Roots allow servers to ask for specific directories or files to operate on.
A common example for roots is providing a set of repositories or directories
a server should operate on.

This request is typically used when the server needs to understand the file system
structure or access specific locations that the client has permission to read from.
-}
data ListRootsRequest = ListRootsRequest
    { ListRootsRequest -> RequestId
id :: RequestId
    , ListRootsRequest -> Maybe ListRootsParams
params :: Maybe ListRootsParams
    }
    deriving stock (Int -> ListRootsRequest -> ShowS
[ListRootsRequest] -> ShowS
ListRootsRequest -> String
(Int -> ListRootsRequest -> ShowS)
-> (ListRootsRequest -> String)
-> ([ListRootsRequest] -> ShowS)
-> Show ListRootsRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListRootsRequest -> ShowS
showsPrec :: Int -> ListRootsRequest -> ShowS
$cshow :: ListRootsRequest -> String
show :: ListRootsRequest -> String
$cshowList :: [ListRootsRequest] -> ShowS
showList :: [ListRootsRequest] -> ShowS
Show, ListRootsRequest -> ListRootsRequest -> Bool
(ListRootsRequest -> ListRootsRequest -> Bool)
-> (ListRootsRequest -> ListRootsRequest -> Bool)
-> Eq ListRootsRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListRootsRequest -> ListRootsRequest -> Bool
== :: ListRootsRequest -> ListRootsRequest -> Bool
$c/= :: ListRootsRequest -> ListRootsRequest -> Bool
/= :: ListRootsRequest -> ListRootsRequest -> Bool
Eq, (forall x. ListRootsRequest -> Rep ListRootsRequest x)
-> (forall x. Rep ListRootsRequest x -> ListRootsRequest)
-> Generic ListRootsRequest
forall x. Rep ListRootsRequest x -> ListRootsRequest
forall x. ListRootsRequest -> Rep ListRootsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListRootsRequest -> Rep ListRootsRequest x
from :: forall x. ListRootsRequest -> Rep ListRootsRequest x
$cto :: forall x. Rep ListRootsRequest x -> ListRootsRequest
to :: forall x. Rep ListRootsRequest x -> ListRootsRequest
Generic)
    deriving ([ListRootsRequest] -> Value
[ListRootsRequest] -> Encoding
ListRootsRequest -> Bool
ListRootsRequest -> Value
ListRootsRequest -> Encoding
(ListRootsRequest -> Value)
-> (ListRootsRequest -> Encoding)
-> ([ListRootsRequest] -> Value)
-> ([ListRootsRequest] -> Encoding)
-> (ListRootsRequest -> Bool)
-> ToJSON ListRootsRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ListRootsRequest -> Value
toJSON :: ListRootsRequest -> Value
$ctoEncoding :: ListRootsRequest -> Encoding
toEncoding :: ListRootsRequest -> Encoding
$ctoJSONList :: [ListRootsRequest] -> Value
toJSONList :: [ListRootsRequest] -> Value
$ctoEncodingList :: [ListRootsRequest] -> Encoding
toEncodingList :: [ListRootsRequest] -> Encoding
$comitField :: ListRootsRequest -> Bool
omitField :: ListRootsRequest -> Bool
ToJSON, Maybe ListRootsRequest
Value -> Parser [ListRootsRequest]
Value -> Parser ListRootsRequest
(Value -> Parser ListRootsRequest)
-> (Value -> Parser [ListRootsRequest])
-> Maybe ListRootsRequest
-> FromJSON ListRootsRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ListRootsRequest
parseJSON :: Value -> Parser ListRootsRequest
$cparseJSONList :: Value -> Parser [ListRootsRequest]
parseJSONList :: Value -> Parser [ListRootsRequest]
$comittedField :: Maybe ListRootsRequest
omittedField :: Maybe ListRootsRequest
FromJSON) via ViaJSONRPCRequest ListRootsRequest

instance IsJSONRPCRequest ListRootsRequest where
    requestMethod :: Proxy ListRootsRequest -> Text
requestMethod Proxy ListRootsRequest
_ = Text
"roots/list"

-- * Response Types

-- | After receiving an initialize request from the client, the server sends this response.
data InitializeResult = InitializeResult
    { InitializeResult -> Text
protocolVersion :: Text
    {- ^ The version of the Model Context Protocol that the server wants to use.
    This may not match the version that the client requested. If the client
    cannot support this version, it MUST disconnect.
    -}
    , InitializeResult -> ServerCapabilities
capabilities :: ServerCapabilities
    , InitializeResult -> Implementation
serverInfo :: Implementation
    , InitializeResult -> Maybe Text
instructions :: Maybe Text
    {- ^ Instructions describing how to use the server and its features.
    This can be used by clients to improve the LLM's understanding of available
    tools, resources, etc. It can be thought of like a "hint" to the model.
    For example, this information MAY be added to the system prompt.
    -}
    , InitializeResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> InitializeResult -> ShowS
[InitializeResult] -> ShowS
InitializeResult -> String
(Int -> InitializeResult -> ShowS)
-> (InitializeResult -> String)
-> ([InitializeResult] -> ShowS)
-> Show InitializeResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InitializeResult -> ShowS
showsPrec :: Int -> InitializeResult -> ShowS
$cshow :: InitializeResult -> String
show :: InitializeResult -> String
$cshowList :: [InitializeResult] -> ShowS
showList :: [InitializeResult] -> ShowS
Show, InitializeResult -> InitializeResult -> Bool
(InitializeResult -> InitializeResult -> Bool)
-> (InitializeResult -> InitializeResult -> Bool)
-> Eq InitializeResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InitializeResult -> InitializeResult -> Bool
== :: InitializeResult -> InitializeResult -> Bool
$c/= :: InitializeResult -> InitializeResult -> Bool
/= :: InitializeResult -> InitializeResult -> Bool
Eq, (forall x. InitializeResult -> Rep InitializeResult x)
-> (forall x. Rep InitializeResult x -> InitializeResult)
-> Generic InitializeResult
forall x. Rep InitializeResult x -> InitializeResult
forall x. InitializeResult -> Rep InitializeResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InitializeResult -> Rep InitializeResult x
from :: forall x. InitializeResult -> Rep InitializeResult x
$cto :: forall x. Rep InitializeResult x -> InitializeResult
to :: forall x. Rep InitializeResult x -> InitializeResult
Generic)

$(deriveJSON mcpParseOpts ''InitializeResult)

-- | The server's response to a resources/list request from the client.
data ListResourcesResult = ListResourcesResult
    { ListResourcesResult -> [Resource]
resources :: [Resource]
    , ListResourcesResult -> Maybe Cursor
nextCursor :: Maybe Cursor
    {- ^ An opaque token representing the pagination position after the last returned result.
    If present, there may be more results available.
    -}
    , ListResourcesResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ListResourcesResult -> ShowS
[ListResourcesResult] -> ShowS
ListResourcesResult -> String
(Int -> ListResourcesResult -> ShowS)
-> (ListResourcesResult -> String)
-> ([ListResourcesResult] -> ShowS)
-> Show ListResourcesResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourcesResult -> ShowS
showsPrec :: Int -> ListResourcesResult -> ShowS
$cshow :: ListResourcesResult -> String
show :: ListResourcesResult -> String
$cshowList :: [ListResourcesResult] -> ShowS
showList :: [ListResourcesResult] -> ShowS
Show, ListResourcesResult -> ListResourcesResult -> Bool
(ListResourcesResult -> ListResourcesResult -> Bool)
-> (ListResourcesResult -> ListResourcesResult -> Bool)
-> Eq ListResourcesResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourcesResult -> ListResourcesResult -> Bool
== :: ListResourcesResult -> ListResourcesResult -> Bool
$c/= :: ListResourcesResult -> ListResourcesResult -> Bool
/= :: ListResourcesResult -> ListResourcesResult -> Bool
Eq, (forall x. ListResourcesResult -> Rep ListResourcesResult x)
-> (forall x. Rep ListResourcesResult x -> ListResourcesResult)
-> Generic ListResourcesResult
forall x. Rep ListResourcesResult x -> ListResourcesResult
forall x. ListResourcesResult -> Rep ListResourcesResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListResourcesResult -> Rep ListResourcesResult x
from :: forall x. ListResourcesResult -> Rep ListResourcesResult x
$cto :: forall x. Rep ListResourcesResult x -> ListResourcesResult
to :: forall x. Rep ListResourcesResult x -> ListResourcesResult
Generic)

$(deriveJSON mcpParseOpts ''ListResourcesResult)

-- | The server's response to a resources/templates/list request from the client.
data ListResourceTemplatesResult = ListResourceTemplatesResult
    { ListResourceTemplatesResult -> [ResourceTemplate]
resourceTemplates :: [ResourceTemplate]
    , ListResourceTemplatesResult -> Maybe Cursor
nextCursor :: Maybe Cursor
    {- ^ An opaque token representing the pagination position after the last returned result.
    If present, there may be more results available.
    -}
    , ListResourceTemplatesResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ListResourceTemplatesResult -> ShowS
[ListResourceTemplatesResult] -> ShowS
ListResourceTemplatesResult -> String
(Int -> ListResourceTemplatesResult -> ShowS)
-> (ListResourceTemplatesResult -> String)
-> ([ListResourceTemplatesResult] -> ShowS)
-> Show ListResourceTemplatesResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListResourceTemplatesResult -> ShowS
showsPrec :: Int -> ListResourceTemplatesResult -> ShowS
$cshow :: ListResourceTemplatesResult -> String
show :: ListResourceTemplatesResult -> String
$cshowList :: [ListResourceTemplatesResult] -> ShowS
showList :: [ListResourceTemplatesResult] -> ShowS
Show, ListResourceTemplatesResult -> ListResourceTemplatesResult -> Bool
(ListResourceTemplatesResult
 -> ListResourceTemplatesResult -> Bool)
-> (ListResourceTemplatesResult
    -> ListResourceTemplatesResult -> Bool)
-> Eq ListResourceTemplatesResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListResourceTemplatesResult -> ListResourceTemplatesResult -> Bool
== :: ListResourceTemplatesResult -> ListResourceTemplatesResult -> Bool
$c/= :: ListResourceTemplatesResult -> ListResourceTemplatesResult -> Bool
/= :: ListResourceTemplatesResult -> ListResourceTemplatesResult -> Bool
Eq, (forall x.
 ListResourceTemplatesResult -> Rep ListResourceTemplatesResult x)
-> (forall x.
    Rep ListResourceTemplatesResult x -> ListResourceTemplatesResult)
-> Generic ListResourceTemplatesResult
forall x.
Rep ListResourceTemplatesResult x -> ListResourceTemplatesResult
forall x.
ListResourceTemplatesResult -> Rep ListResourceTemplatesResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ListResourceTemplatesResult -> Rep ListResourceTemplatesResult x
from :: forall x.
ListResourceTemplatesResult -> Rep ListResourceTemplatesResult x
$cto :: forall x.
Rep ListResourceTemplatesResult x -> ListResourceTemplatesResult
to :: forall x.
Rep ListResourceTemplatesResult x -> ListResourceTemplatesResult
Generic)

$(deriveJSON mcpParseOpts ''ListResourceTemplatesResult)

-- | The server's response to a resources/read request from the client.
data ReadResourceResult = ReadResourceResult
    { ReadResourceResult -> [ResourceContents]
contents :: [ResourceContents]
    , ReadResourceResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ReadResourceResult -> ShowS
[ReadResourceResult] -> ShowS
ReadResourceResult -> String
(Int -> ReadResourceResult -> ShowS)
-> (ReadResourceResult -> String)
-> ([ReadResourceResult] -> ShowS)
-> Show ReadResourceResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadResourceResult -> ShowS
showsPrec :: Int -> ReadResourceResult -> ShowS
$cshow :: ReadResourceResult -> String
show :: ReadResourceResult -> String
$cshowList :: [ReadResourceResult] -> ShowS
showList :: [ReadResourceResult] -> ShowS
Show, ReadResourceResult -> ReadResourceResult -> Bool
(ReadResourceResult -> ReadResourceResult -> Bool)
-> (ReadResourceResult -> ReadResourceResult -> Bool)
-> Eq ReadResourceResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadResourceResult -> ReadResourceResult -> Bool
== :: ReadResourceResult -> ReadResourceResult -> Bool
$c/= :: ReadResourceResult -> ReadResourceResult -> Bool
/= :: ReadResourceResult -> ReadResourceResult -> Bool
Eq, (forall x. ReadResourceResult -> Rep ReadResourceResult x)
-> (forall x. Rep ReadResourceResult x -> ReadResourceResult)
-> Generic ReadResourceResult
forall x. Rep ReadResourceResult x -> ReadResourceResult
forall x. ReadResourceResult -> Rep ReadResourceResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReadResourceResult -> Rep ReadResourceResult x
from :: forall x. ReadResourceResult -> Rep ReadResourceResult x
$cto :: forall x. Rep ReadResourceResult x -> ReadResourceResult
to :: forall x. Rep ReadResourceResult x -> ReadResourceResult
Generic)

$(deriveJSON mcpParseOpts ''ReadResourceResult)

-- | The server's response to a prompts/list request from the client.
data ListPromptsResult = ListPromptsResult
    { ListPromptsResult -> [Prompt]
prompts :: [Prompt]
    , ListPromptsResult -> Maybe Cursor
nextCursor :: Maybe Cursor
    {- ^ An opaque token representing the pagination position after the last returned result.
    If present, there may be more results available.
    -}
    , ListPromptsResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ListPromptsResult -> ShowS
[ListPromptsResult] -> ShowS
ListPromptsResult -> String
(Int -> ListPromptsResult -> ShowS)
-> (ListPromptsResult -> String)
-> ([ListPromptsResult] -> ShowS)
-> Show ListPromptsResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListPromptsResult -> ShowS
showsPrec :: Int -> ListPromptsResult -> ShowS
$cshow :: ListPromptsResult -> String
show :: ListPromptsResult -> String
$cshowList :: [ListPromptsResult] -> ShowS
showList :: [ListPromptsResult] -> ShowS
Show, ListPromptsResult -> ListPromptsResult -> Bool
(ListPromptsResult -> ListPromptsResult -> Bool)
-> (ListPromptsResult -> ListPromptsResult -> Bool)
-> Eq ListPromptsResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListPromptsResult -> ListPromptsResult -> Bool
== :: ListPromptsResult -> ListPromptsResult -> Bool
$c/= :: ListPromptsResult -> ListPromptsResult -> Bool
/= :: ListPromptsResult -> ListPromptsResult -> Bool
Eq, (forall x. ListPromptsResult -> Rep ListPromptsResult x)
-> (forall x. Rep ListPromptsResult x -> ListPromptsResult)
-> Generic ListPromptsResult
forall x. Rep ListPromptsResult x -> ListPromptsResult
forall x. ListPromptsResult -> Rep ListPromptsResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListPromptsResult -> Rep ListPromptsResult x
from :: forall x. ListPromptsResult -> Rep ListPromptsResult x
$cto :: forall x. Rep ListPromptsResult x -> ListPromptsResult
to :: forall x. Rep ListPromptsResult x -> ListPromptsResult
Generic)

$(deriveJSON mcpParseOpts ''ListPromptsResult)

-- | The server's response to a prompts/get request from the client.
data GetPromptResult = GetPromptResult
    { GetPromptResult -> Maybe Text
description :: Maybe Text
    -- ^ An optional description for the prompt.
    , GetPromptResult -> [PromptMessage]
messages :: [PromptMessage]
    , GetPromptResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> GetPromptResult -> ShowS
[GetPromptResult] -> ShowS
GetPromptResult -> String
(Int -> GetPromptResult -> ShowS)
-> (GetPromptResult -> String)
-> ([GetPromptResult] -> ShowS)
-> Show GetPromptResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPromptResult -> ShowS
showsPrec :: Int -> GetPromptResult -> ShowS
$cshow :: GetPromptResult -> String
show :: GetPromptResult -> String
$cshowList :: [GetPromptResult] -> ShowS
showList :: [GetPromptResult] -> ShowS
Show, GetPromptResult -> GetPromptResult -> Bool
(GetPromptResult -> GetPromptResult -> Bool)
-> (GetPromptResult -> GetPromptResult -> Bool)
-> Eq GetPromptResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPromptResult -> GetPromptResult -> Bool
== :: GetPromptResult -> GetPromptResult -> Bool
$c/= :: GetPromptResult -> GetPromptResult -> Bool
/= :: GetPromptResult -> GetPromptResult -> Bool
Eq, (forall x. GetPromptResult -> Rep GetPromptResult x)
-> (forall x. Rep GetPromptResult x -> GetPromptResult)
-> Generic GetPromptResult
forall x. Rep GetPromptResult x -> GetPromptResult
forall x. GetPromptResult -> Rep GetPromptResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GetPromptResult -> Rep GetPromptResult x
from :: forall x. GetPromptResult -> Rep GetPromptResult x
$cto :: forall x. Rep GetPromptResult x -> GetPromptResult
to :: forall x. Rep GetPromptResult x -> GetPromptResult
Generic)

$(deriveJSON mcpParseOpts ''GetPromptResult)

-- | The server's response to a tools/list request from the client.
data ListToolsResult = ListToolsResult
    { ListToolsResult -> [Tool]
tools :: [Tool]
    , ListToolsResult -> Maybe Cursor
nextCursor :: Maybe Cursor
    {- ^ An opaque token representing the pagination position after the last returned result.
    If present, there may be more results available.
    -}
    , ListToolsResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ListToolsResult -> ShowS
[ListToolsResult] -> ShowS
ListToolsResult -> String
(Int -> ListToolsResult -> ShowS)
-> (ListToolsResult -> String)
-> ([ListToolsResult] -> ShowS)
-> Show ListToolsResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListToolsResult -> ShowS
showsPrec :: Int -> ListToolsResult -> ShowS
$cshow :: ListToolsResult -> String
show :: ListToolsResult -> String
$cshowList :: [ListToolsResult] -> ShowS
showList :: [ListToolsResult] -> ShowS
Show, ListToolsResult -> ListToolsResult -> Bool
(ListToolsResult -> ListToolsResult -> Bool)
-> (ListToolsResult -> ListToolsResult -> Bool)
-> Eq ListToolsResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListToolsResult -> ListToolsResult -> Bool
== :: ListToolsResult -> ListToolsResult -> Bool
$c/= :: ListToolsResult -> ListToolsResult -> Bool
/= :: ListToolsResult -> ListToolsResult -> Bool
Eq, (forall x. ListToolsResult -> Rep ListToolsResult x)
-> (forall x. Rep ListToolsResult x -> ListToolsResult)
-> Generic ListToolsResult
forall x. Rep ListToolsResult x -> ListToolsResult
forall x. ListToolsResult -> Rep ListToolsResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListToolsResult -> Rep ListToolsResult x
from :: forall x. ListToolsResult -> Rep ListToolsResult x
$cto :: forall x. Rep ListToolsResult x -> ListToolsResult
to :: forall x. Rep ListToolsResult x -> ListToolsResult
Generic)

$(deriveJSON mcpParseOpts ''ListToolsResult)

{- | The server's response to a tool call.

Any errors that originate from the tool SHOULD be reported inside the result
object, with `isError` set to true, _not_ as an MCP protocol-level error
response. Otherwise, the LLM would not be able to see that an error occurred
and self-correct.

However, any errors in _finding_ the tool, an error indicating that the
server does not support tool calls, or any other exceptional conditions,
should be reported as an MCP error response.
-}
data CallToolResult = CallToolResult
    { CallToolResult -> [ContentBlock]
content :: [ContentBlock]
    -- ^ A list of content objects that represent the unstructured result of the tool call.
    , CallToolResult -> Maybe (Map Text Value)
structuredContent :: Maybe (Map Text Value)
    -- ^ An optional JSON object that represents the structured result of the tool call.
    , CallToolResult -> Maybe Bool
isError :: Maybe Bool
    {- ^ Whether the tool call ended in an error.
    If not set, this is assumed to be false (the call was successful).
    -}
    , CallToolResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> CallToolResult -> ShowS
[CallToolResult] -> ShowS
CallToolResult -> String
(Int -> CallToolResult -> ShowS)
-> (CallToolResult -> String)
-> ([CallToolResult] -> ShowS)
-> Show CallToolResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CallToolResult -> ShowS
showsPrec :: Int -> CallToolResult -> ShowS
$cshow :: CallToolResult -> String
show :: CallToolResult -> String
$cshowList :: [CallToolResult] -> ShowS
showList :: [CallToolResult] -> ShowS
Show, CallToolResult -> CallToolResult -> Bool
(CallToolResult -> CallToolResult -> Bool)
-> (CallToolResult -> CallToolResult -> Bool) -> Eq CallToolResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CallToolResult -> CallToolResult -> Bool
== :: CallToolResult -> CallToolResult -> Bool
$c/= :: CallToolResult -> CallToolResult -> Bool
/= :: CallToolResult -> CallToolResult -> Bool
Eq, (forall x. CallToolResult -> Rep CallToolResult x)
-> (forall x. Rep CallToolResult x -> CallToolResult)
-> Generic CallToolResult
forall x. Rep CallToolResult x -> CallToolResult
forall x. CallToolResult -> Rep CallToolResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CallToolResult -> Rep CallToolResult x
from :: forall x. CallToolResult -> Rep CallToolResult x
$cto :: forall x. Rep CallToolResult x -> CallToolResult
to :: forall x. Rep CallToolResult x -> CallToolResult
Generic)

$(deriveJSON mcpParseOpts ''CallToolResult)

{- | Completion result inner type.

Contains the actual completion data.
-}
data CompletionResult = CompletionResult
    { CompletionResult -> [Text]
values :: [Text]
    -- ^ An array of completion values. Must not exceed 100 items.
    , CompletionResult -> Maybe Int
total :: Maybe Int
    {- ^ The total number of completion options available.
    This can exceed the number of values actually sent in the response.
    -}
    , CompletionResult -> Maybe Bool
hasMore :: Maybe Bool
    {- ^ Indicates whether there are additional completion options beyond those
    provided in the current response, even if the exact total is unknown.
    -}
    }
    deriving stock (Int -> CompletionResult -> ShowS
[CompletionResult] -> ShowS
CompletionResult -> String
(Int -> CompletionResult -> ShowS)
-> (CompletionResult -> String)
-> ([CompletionResult] -> ShowS)
-> Show CompletionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompletionResult -> ShowS
showsPrec :: Int -> CompletionResult -> ShowS
$cshow :: CompletionResult -> String
show :: CompletionResult -> String
$cshowList :: [CompletionResult] -> ShowS
showList :: [CompletionResult] -> ShowS
Show, CompletionResult -> CompletionResult -> Bool
(CompletionResult -> CompletionResult -> Bool)
-> (CompletionResult -> CompletionResult -> Bool)
-> Eq CompletionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompletionResult -> CompletionResult -> Bool
== :: CompletionResult -> CompletionResult -> Bool
$c/= :: CompletionResult -> CompletionResult -> Bool
/= :: CompletionResult -> CompletionResult -> Bool
Eq, (forall x. CompletionResult -> Rep CompletionResult x)
-> (forall x. Rep CompletionResult x -> CompletionResult)
-> Generic CompletionResult
forall x. Rep CompletionResult x -> CompletionResult
forall x. CompletionResult -> Rep CompletionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompletionResult -> Rep CompletionResult x
from :: forall x. CompletionResult -> Rep CompletionResult x
$cto :: forall x. Rep CompletionResult x -> CompletionResult
to :: forall x. Rep CompletionResult x -> CompletionResult
Generic)

$(deriveJSON mcpParseOpts ''CompletionResult)

-- | The server's response to a completion/complete request.
data CompleteResult = CompleteResult
    { CompleteResult -> CompletionResult
completion :: CompletionResult
    , CompleteResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> CompleteResult -> ShowS
[CompleteResult] -> ShowS
CompleteResult -> String
(Int -> CompleteResult -> ShowS)
-> (CompleteResult -> String)
-> ([CompleteResult] -> ShowS)
-> Show CompleteResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CompleteResult -> ShowS
showsPrec :: Int -> CompleteResult -> ShowS
$cshow :: CompleteResult -> String
show :: CompleteResult -> String
$cshowList :: [CompleteResult] -> ShowS
showList :: [CompleteResult] -> ShowS
Show, CompleteResult -> CompleteResult -> Bool
(CompleteResult -> CompleteResult -> Bool)
-> (CompleteResult -> CompleteResult -> Bool) -> Eq CompleteResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CompleteResult -> CompleteResult -> Bool
== :: CompleteResult -> CompleteResult -> Bool
$c/= :: CompleteResult -> CompleteResult -> Bool
/= :: CompleteResult -> CompleteResult -> Bool
Eq, (forall x. CompleteResult -> Rep CompleteResult x)
-> (forall x. Rep CompleteResult x -> CompleteResult)
-> Generic CompleteResult
forall x. Rep CompleteResult x -> CompleteResult
forall x. CompleteResult -> Rep CompleteResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CompleteResult -> Rep CompleteResult x
from :: forall x. CompleteResult -> Rep CompleteResult x
$cto :: forall x. Rep CompleteResult x -> CompleteResult
to :: forall x. Rep CompleteResult x -> CompleteResult
Generic)

$(deriveJSON mcpParseOpts ''CompleteResult)

{- | The client's response to a sampling/createMessage request from the server.

The client should inform the user before returning the sampled message, to allow them
to inspect the response (human in the loop) and decide whether to allow the server to see it.
-}
data CreateMessageResult = CreateMessageResult
    { CreateMessageResult -> Role
role :: Role
    , CreateMessageResult -> Content
content :: Content -- This stays as Content for sampling, not ContentBlock
    , CreateMessageResult -> Text
model :: Text
    -- ^ The name of the model that generated the message.
    , CreateMessageResult -> Maybe Text
stopReason :: Maybe Text
    -- ^ The reason why sampling stopped, if known.
    , CreateMessageResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> CreateMessageResult -> ShowS
[CreateMessageResult] -> ShowS
CreateMessageResult -> String
(Int -> CreateMessageResult -> ShowS)
-> (CreateMessageResult -> String)
-> ([CreateMessageResult] -> ShowS)
-> Show CreateMessageResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateMessageResult -> ShowS
showsPrec :: Int -> CreateMessageResult -> ShowS
$cshow :: CreateMessageResult -> String
show :: CreateMessageResult -> String
$cshowList :: [CreateMessageResult] -> ShowS
showList :: [CreateMessageResult] -> ShowS
Show, CreateMessageResult -> CreateMessageResult -> Bool
(CreateMessageResult -> CreateMessageResult -> Bool)
-> (CreateMessageResult -> CreateMessageResult -> Bool)
-> Eq CreateMessageResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateMessageResult -> CreateMessageResult -> Bool
== :: CreateMessageResult -> CreateMessageResult -> Bool
$c/= :: CreateMessageResult -> CreateMessageResult -> Bool
/= :: CreateMessageResult -> CreateMessageResult -> Bool
Eq, (forall x. CreateMessageResult -> Rep CreateMessageResult x)
-> (forall x. Rep CreateMessageResult x -> CreateMessageResult)
-> Generic CreateMessageResult
forall x. Rep CreateMessageResult x -> CreateMessageResult
forall x. CreateMessageResult -> Rep CreateMessageResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateMessageResult -> Rep CreateMessageResult x
from :: forall x. CreateMessageResult -> Rep CreateMessageResult x
$cto :: forall x. Rep CreateMessageResult x -> CreateMessageResult
to :: forall x. Rep CreateMessageResult x -> CreateMessageResult
Generic)

$(deriveJSON mcpParseOpts ''CreateMessageResult)

{- | The client's response to a roots/list request from the server.

This result contains an array of Root objects, each representing a root directory
or file that the server can operate on.
-}
data ListRootsResult = ListRootsResult
    { ListRootsResult -> [Root]
roots :: [Root]
    , ListRootsResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ListRootsResult -> ShowS
[ListRootsResult] -> ShowS
ListRootsResult -> String
(Int -> ListRootsResult -> ShowS)
-> (ListRootsResult -> String)
-> ([ListRootsResult] -> ShowS)
-> Show ListRootsResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListRootsResult -> ShowS
showsPrec :: Int -> ListRootsResult -> ShowS
$cshow :: ListRootsResult -> String
show :: ListRootsResult -> String
$cshowList :: [ListRootsResult] -> ShowS
showList :: [ListRootsResult] -> ShowS
Show, ListRootsResult -> ListRootsResult -> Bool
(ListRootsResult -> ListRootsResult -> Bool)
-> (ListRootsResult -> ListRootsResult -> Bool)
-> Eq ListRootsResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListRootsResult -> ListRootsResult -> Bool
== :: ListRootsResult -> ListRootsResult -> Bool
$c/= :: ListRootsResult -> ListRootsResult -> Bool
/= :: ListRootsResult -> ListRootsResult -> Bool
Eq, (forall x. ListRootsResult -> Rep ListRootsResult x)
-> (forall x. Rep ListRootsResult x -> ListRootsResult)
-> Generic ListRootsResult
forall x. Rep ListRootsResult x -> ListRootsResult
forall x. ListRootsResult -> Rep ListRootsResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListRootsResult -> Rep ListRootsResult x
from :: forall x. ListRootsResult -> Rep ListRootsResult x
$cto :: forall x. Rep ListRootsResult x -> ListRootsResult
to :: forall x. Rep ListRootsResult x -> ListRootsResult
Generic)

$(deriveJSON mcpParseOpts ''ListRootsResult)

-- * Notification Types

{- | Cancelled notification parameters.

Parameters for a cancellation notification.
-}
data CancelledParams = CancelledParams
    { CancelledParams -> RequestId
requestId :: RequestId
    {- ^ The ID of the request to cancel.
    This MUST correspond to the ID of a request previously issued in the same direction.
    -}
    , CancelledParams -> Maybe Text
reason :: Maybe Text
    {- ^ An optional string describing the reason for the cancellation.
    This MAY be logged or presented to the user.
    -}
    }
    deriving stock (Int -> CancelledParams -> ShowS
[CancelledParams] -> ShowS
CancelledParams -> String
(Int -> CancelledParams -> ShowS)
-> (CancelledParams -> String)
-> ([CancelledParams] -> ShowS)
-> Show CancelledParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CancelledParams -> ShowS
showsPrec :: Int -> CancelledParams -> ShowS
$cshow :: CancelledParams -> String
show :: CancelledParams -> String
$cshowList :: [CancelledParams] -> ShowS
showList :: [CancelledParams] -> ShowS
Show, CancelledParams -> CancelledParams -> Bool
(CancelledParams -> CancelledParams -> Bool)
-> (CancelledParams -> CancelledParams -> Bool)
-> Eq CancelledParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CancelledParams -> CancelledParams -> Bool
== :: CancelledParams -> CancelledParams -> Bool
$c/= :: CancelledParams -> CancelledParams -> Bool
/= :: CancelledParams -> CancelledParams -> Bool
Eq, (forall x. CancelledParams -> Rep CancelledParams x)
-> (forall x. Rep CancelledParams x -> CancelledParams)
-> Generic CancelledParams
forall x. Rep CancelledParams x -> CancelledParams
forall x. CancelledParams -> Rep CancelledParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CancelledParams -> Rep CancelledParams x
from :: forall x. CancelledParams -> Rep CancelledParams x
$cto :: forall x. Rep CancelledParams x -> CancelledParams
to :: forall x. Rep CancelledParams x -> CancelledParams
Generic)

$(deriveJSON mcpParseOpts ''CancelledParams)

{- | This notification can be sent by either side to indicate that it is cancelling
a previously-issued request.

The request SHOULD still be in-flight, but due to communication latency, it is always
possible that this notification MAY arrive after the request has already finished.

This notification indicates that the result will be unused, so any associated
processing SHOULD cease.

A client MUST NOT attempt to cancel its `initialize` request.
-}
data CancelledNotification = CancelledNotification
    { CancelledNotification -> CancelledParams
params :: CancelledParams
    }
    deriving stock (Int -> CancelledNotification -> ShowS
[CancelledNotification] -> ShowS
CancelledNotification -> String
(Int -> CancelledNotification -> ShowS)
-> (CancelledNotification -> String)
-> ([CancelledNotification] -> ShowS)
-> Show CancelledNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CancelledNotification -> ShowS
showsPrec :: Int -> CancelledNotification -> ShowS
$cshow :: CancelledNotification -> String
show :: CancelledNotification -> String
$cshowList :: [CancelledNotification] -> ShowS
showList :: [CancelledNotification] -> ShowS
Show, CancelledNotification -> CancelledNotification -> Bool
(CancelledNotification -> CancelledNotification -> Bool)
-> (CancelledNotification -> CancelledNotification -> Bool)
-> Eq CancelledNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CancelledNotification -> CancelledNotification -> Bool
== :: CancelledNotification -> CancelledNotification -> Bool
$c/= :: CancelledNotification -> CancelledNotification -> Bool
/= :: CancelledNotification -> CancelledNotification -> Bool
Eq, (forall x. CancelledNotification -> Rep CancelledNotification x)
-> (forall x. Rep CancelledNotification x -> CancelledNotification)
-> Generic CancelledNotification
forall x. Rep CancelledNotification x -> CancelledNotification
forall x. CancelledNotification -> Rep CancelledNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CancelledNotification -> Rep CancelledNotification x
from :: forall x. CancelledNotification -> Rep CancelledNotification x
$cto :: forall x. Rep CancelledNotification x -> CancelledNotification
to :: forall x. Rep CancelledNotification x -> CancelledNotification
Generic)
    deriving ([CancelledNotification] -> Value
[CancelledNotification] -> Encoding
CancelledNotification -> Bool
CancelledNotification -> Value
CancelledNotification -> Encoding
(CancelledNotification -> Value)
-> (CancelledNotification -> Encoding)
-> ([CancelledNotification] -> Value)
-> ([CancelledNotification] -> Encoding)
-> (CancelledNotification -> Bool)
-> ToJSON CancelledNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: CancelledNotification -> Value
toJSON :: CancelledNotification -> Value
$ctoEncoding :: CancelledNotification -> Encoding
toEncoding :: CancelledNotification -> Encoding
$ctoJSONList :: [CancelledNotification] -> Value
toJSONList :: [CancelledNotification] -> Value
$ctoEncodingList :: [CancelledNotification] -> Encoding
toEncodingList :: [CancelledNotification] -> Encoding
$comitField :: CancelledNotification -> Bool
omitField :: CancelledNotification -> Bool
ToJSON, Maybe CancelledNotification
Value -> Parser [CancelledNotification]
Value -> Parser CancelledNotification
(Value -> Parser CancelledNotification)
-> (Value -> Parser [CancelledNotification])
-> Maybe CancelledNotification
-> FromJSON CancelledNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser CancelledNotification
parseJSON :: Value -> Parser CancelledNotification
$cparseJSONList :: Value -> Parser [CancelledNotification]
parseJSONList :: Value -> Parser [CancelledNotification]
$comittedField :: Maybe CancelledNotification
omittedField :: Maybe CancelledNotification
FromJSON) via ViaJSONRPCNotification CancelledNotification

instance IsJSONRPCNotification CancelledNotification where
    notificationsMethod :: Proxy CancelledNotification -> Text
notificationsMethod Proxy CancelledNotification
_ = Text
"notifications/cancelled"

{- | Initialized notification parameters.

Parameters for the initialized notification (typically just metadata).
-}
data InitializedParams where
    InitializedParams :: {InitializedParams -> Maybe Metadata
_meta :: Maybe Metadata} -> InitializedParams
    deriving stock (Int -> InitializedParams -> ShowS
[InitializedParams] -> ShowS
InitializedParams -> String
(Int -> InitializedParams -> ShowS)
-> (InitializedParams -> String)
-> ([InitializedParams] -> ShowS)
-> Show InitializedParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InitializedParams -> ShowS
showsPrec :: Int -> InitializedParams -> ShowS
$cshow :: InitializedParams -> String
show :: InitializedParams -> String
$cshowList :: [InitializedParams] -> ShowS
showList :: [InitializedParams] -> ShowS
Show, InitializedParams -> InitializedParams -> Bool
(InitializedParams -> InitializedParams -> Bool)
-> (InitializedParams -> InitializedParams -> Bool)
-> Eq InitializedParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InitializedParams -> InitializedParams -> Bool
== :: InitializedParams -> InitializedParams -> Bool
$c/= :: InitializedParams -> InitializedParams -> Bool
/= :: InitializedParams -> InitializedParams -> Bool
Eq, (forall x. InitializedParams -> Rep InitializedParams x)
-> (forall x. Rep InitializedParams x -> InitializedParams)
-> Generic InitializedParams
forall x. Rep InitializedParams x -> InitializedParams
forall x. InitializedParams -> Rep InitializedParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InitializedParams -> Rep InitializedParams x
from :: forall x. InitializedParams -> Rep InitializedParams x
$cto :: forall x. Rep InitializedParams x -> InitializedParams
to :: forall x. Rep InitializedParams x -> InitializedParams
Generic)

$(deriveJSON mcpParseOpts ''InitializedParams)

-- | This notification is sent from the client to the server after initialization has finished.
data InitializedNotification = InitializedNotification
    { InitializedNotification -> Maybe EmptyParams
params :: Maybe EmptyParams
    }
    deriving stock (Int -> InitializedNotification -> ShowS
[InitializedNotification] -> ShowS
InitializedNotification -> String
(Int -> InitializedNotification -> ShowS)
-> (InitializedNotification -> String)
-> ([InitializedNotification] -> ShowS)
-> Show InitializedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InitializedNotification -> ShowS
showsPrec :: Int -> InitializedNotification -> ShowS
$cshow :: InitializedNotification -> String
show :: InitializedNotification -> String
$cshowList :: [InitializedNotification] -> ShowS
showList :: [InitializedNotification] -> ShowS
Show, InitializedNotification -> InitializedNotification -> Bool
(InitializedNotification -> InitializedNotification -> Bool)
-> (InitializedNotification -> InitializedNotification -> Bool)
-> Eq InitializedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InitializedNotification -> InitializedNotification -> Bool
== :: InitializedNotification -> InitializedNotification -> Bool
$c/= :: InitializedNotification -> InitializedNotification -> Bool
/= :: InitializedNotification -> InitializedNotification -> Bool
Eq, (forall x.
 InitializedNotification -> Rep InitializedNotification x)
-> (forall x.
    Rep InitializedNotification x -> InitializedNotification)
-> Generic InitializedNotification
forall x. Rep InitializedNotification x -> InitializedNotification
forall x. InitializedNotification -> Rep InitializedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InitializedNotification -> Rep InitializedNotification x
from :: forall x. InitializedNotification -> Rep InitializedNotification x
$cto :: forall x. Rep InitializedNotification x -> InitializedNotification
to :: forall x. Rep InitializedNotification x -> InitializedNotification
Generic)
    deriving ([InitializedNotification] -> Value
[InitializedNotification] -> Encoding
InitializedNotification -> Bool
InitializedNotification -> Value
InitializedNotification -> Encoding
(InitializedNotification -> Value)
-> (InitializedNotification -> Encoding)
-> ([InitializedNotification] -> Value)
-> ([InitializedNotification] -> Encoding)
-> (InitializedNotification -> Bool)
-> ToJSON InitializedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: InitializedNotification -> Value
toJSON :: InitializedNotification -> Value
$ctoEncoding :: InitializedNotification -> Encoding
toEncoding :: InitializedNotification -> Encoding
$ctoJSONList :: [InitializedNotification] -> Value
toJSONList :: [InitializedNotification] -> Value
$ctoEncodingList :: [InitializedNotification] -> Encoding
toEncodingList :: [InitializedNotification] -> Encoding
$comitField :: InitializedNotification -> Bool
omitField :: InitializedNotification -> Bool
ToJSON, Maybe InitializedNotification
Value -> Parser [InitializedNotification]
Value -> Parser InitializedNotification
(Value -> Parser InitializedNotification)
-> (Value -> Parser [InitializedNotification])
-> Maybe InitializedNotification
-> FromJSON InitializedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser InitializedNotification
parseJSON :: Value -> Parser InitializedNotification
$cparseJSONList :: Value -> Parser [InitializedNotification]
parseJSONList :: Value -> Parser [InitializedNotification]
$comittedField :: Maybe InitializedNotification
omittedField :: Maybe InitializedNotification
FromJSON) via ViaJSONRPCNotification InitializedNotification

instance IsJSONRPCNotification InitializedNotification where
    notificationsMethod :: Proxy InitializedNotification -> Text
notificationsMethod Proxy InitializedNotification
_ = Text
"notifications/initialized"

{- | Progress notification parameters.

Parameters for progress update notifications.
-}
data ProgressParams = ProgressParams
    { ProgressParams -> ProgressToken
progressToken :: ProgressToken
    {- ^ The progress token which was given in the initial request, used to associate
    this notification with the request that is proceeding.
    -}
    , ProgressParams -> Double
progress :: Double
    {- ^ The progress thus far. This should increase every time progress is made,
    even if the total is unknown.
    -}
    , ProgressParams -> Maybe Double
total :: Maybe Double
    -- ^ Total number of items to process (or total progress required), if known.
    , ProgressParams -> Maybe Text
message :: Maybe Text
    -- ^ An optional message describing the current progress.
    }
    deriving stock (Int -> ProgressParams -> ShowS
[ProgressParams] -> ShowS
ProgressParams -> String
(Int -> ProgressParams -> ShowS)
-> (ProgressParams -> String)
-> ([ProgressParams] -> ShowS)
-> Show ProgressParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProgressParams -> ShowS
showsPrec :: Int -> ProgressParams -> ShowS
$cshow :: ProgressParams -> String
show :: ProgressParams -> String
$cshowList :: [ProgressParams] -> ShowS
showList :: [ProgressParams] -> ShowS
Show, ProgressParams -> ProgressParams -> Bool
(ProgressParams -> ProgressParams -> Bool)
-> (ProgressParams -> ProgressParams -> Bool) -> Eq ProgressParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProgressParams -> ProgressParams -> Bool
== :: ProgressParams -> ProgressParams -> Bool
$c/= :: ProgressParams -> ProgressParams -> Bool
/= :: ProgressParams -> ProgressParams -> Bool
Eq, (forall x. ProgressParams -> Rep ProgressParams x)
-> (forall x. Rep ProgressParams x -> ProgressParams)
-> Generic ProgressParams
forall x. Rep ProgressParams x -> ProgressParams
forall x. ProgressParams -> Rep ProgressParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ProgressParams -> Rep ProgressParams x
from :: forall x. ProgressParams -> Rep ProgressParams x
$cto :: forall x. Rep ProgressParams x -> ProgressParams
to :: forall x. Rep ProgressParams x -> ProgressParams
Generic)

$(deriveJSON mcpParseOpts ''ProgressParams)

{- | An out-of-band notification used to inform the receiver of a progress update
for a long-running request.
-}
data ProgressNotification = ProgressNotification
    { ProgressNotification -> ProgressParams
params :: ProgressParams
    }
    deriving stock (Int -> ProgressNotification -> ShowS
[ProgressNotification] -> ShowS
ProgressNotification -> String
(Int -> ProgressNotification -> ShowS)
-> (ProgressNotification -> String)
-> ([ProgressNotification] -> ShowS)
-> Show ProgressNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProgressNotification -> ShowS
showsPrec :: Int -> ProgressNotification -> ShowS
$cshow :: ProgressNotification -> String
show :: ProgressNotification -> String
$cshowList :: [ProgressNotification] -> ShowS
showList :: [ProgressNotification] -> ShowS
Show, ProgressNotification -> ProgressNotification -> Bool
(ProgressNotification -> ProgressNotification -> Bool)
-> (ProgressNotification -> ProgressNotification -> Bool)
-> Eq ProgressNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProgressNotification -> ProgressNotification -> Bool
== :: ProgressNotification -> ProgressNotification -> Bool
$c/= :: ProgressNotification -> ProgressNotification -> Bool
/= :: ProgressNotification -> ProgressNotification -> Bool
Eq, (forall x. ProgressNotification -> Rep ProgressNotification x)
-> (forall x. Rep ProgressNotification x -> ProgressNotification)
-> Generic ProgressNotification
forall x. Rep ProgressNotification x -> ProgressNotification
forall x. ProgressNotification -> Rep ProgressNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ProgressNotification -> Rep ProgressNotification x
from :: forall x. ProgressNotification -> Rep ProgressNotification x
$cto :: forall x. Rep ProgressNotification x -> ProgressNotification
to :: forall x. Rep ProgressNotification x -> ProgressNotification
Generic)
    deriving ([ProgressNotification] -> Value
[ProgressNotification] -> Encoding
ProgressNotification -> Bool
ProgressNotification -> Value
ProgressNotification -> Encoding
(ProgressNotification -> Value)
-> (ProgressNotification -> Encoding)
-> ([ProgressNotification] -> Value)
-> ([ProgressNotification] -> Encoding)
-> (ProgressNotification -> Bool)
-> ToJSON ProgressNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ProgressNotification -> Value
toJSON :: ProgressNotification -> Value
$ctoEncoding :: ProgressNotification -> Encoding
toEncoding :: ProgressNotification -> Encoding
$ctoJSONList :: [ProgressNotification] -> Value
toJSONList :: [ProgressNotification] -> Value
$ctoEncodingList :: [ProgressNotification] -> Encoding
toEncodingList :: [ProgressNotification] -> Encoding
$comitField :: ProgressNotification -> Bool
omitField :: ProgressNotification -> Bool
ToJSON, Maybe ProgressNotification
Value -> Parser [ProgressNotification]
Value -> Parser ProgressNotification
(Value -> Parser ProgressNotification)
-> (Value -> Parser [ProgressNotification])
-> Maybe ProgressNotification
-> FromJSON ProgressNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ProgressNotification
parseJSON :: Value -> Parser ProgressNotification
$cparseJSONList :: Value -> Parser [ProgressNotification]
parseJSONList :: Value -> Parser [ProgressNotification]
$comittedField :: Maybe ProgressNotification
omittedField :: Maybe ProgressNotification
FromJSON) via ViaJSONRPCNotification ProgressNotification

instance IsJSONRPCNotification ProgressNotification where
    notificationsMethod :: Proxy ProgressNotification -> Text
notificationsMethod Proxy ProgressNotification
_ = Text
"notifications/progress"

{- | An optional notification from the server to the client, informing it that the list
of resources it can read from has changed.

This may be issued by servers without any previous subscription from the client.
-}
data ResourceListChangedNotification = ResourceListChangedNotification
    { ResourceListChangedNotification -> Maybe EmptyParams
params :: Maybe EmptyParams
    }
    deriving stock (Int -> ResourceListChangedNotification -> ShowS
[ResourceListChangedNotification] -> ShowS
ResourceListChangedNotification -> String
(Int -> ResourceListChangedNotification -> ShowS)
-> (ResourceListChangedNotification -> String)
-> ([ResourceListChangedNotification] -> ShowS)
-> Show ResourceListChangedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResourceListChangedNotification -> ShowS
showsPrec :: Int -> ResourceListChangedNotification -> ShowS
$cshow :: ResourceListChangedNotification -> String
show :: ResourceListChangedNotification -> String
$cshowList :: [ResourceListChangedNotification] -> ShowS
showList :: [ResourceListChangedNotification] -> ShowS
Show, ResourceListChangedNotification
-> ResourceListChangedNotification -> Bool
(ResourceListChangedNotification
 -> ResourceListChangedNotification -> Bool)
-> (ResourceListChangedNotification
    -> ResourceListChangedNotification -> Bool)
-> Eq ResourceListChangedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResourceListChangedNotification
-> ResourceListChangedNotification -> Bool
== :: ResourceListChangedNotification
-> ResourceListChangedNotification -> Bool
$c/= :: ResourceListChangedNotification
-> ResourceListChangedNotification -> Bool
/= :: ResourceListChangedNotification
-> ResourceListChangedNotification -> Bool
Eq, (forall x.
 ResourceListChangedNotification
 -> Rep ResourceListChangedNotification x)
-> (forall x.
    Rep ResourceListChangedNotification x
    -> ResourceListChangedNotification)
-> Generic ResourceListChangedNotification
forall x.
Rep ResourceListChangedNotification x
-> ResourceListChangedNotification
forall x.
ResourceListChangedNotification
-> Rep ResourceListChangedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ResourceListChangedNotification
-> Rep ResourceListChangedNotification x
from :: forall x.
ResourceListChangedNotification
-> Rep ResourceListChangedNotification x
$cto :: forall x.
Rep ResourceListChangedNotification x
-> ResourceListChangedNotification
to :: forall x.
Rep ResourceListChangedNotification x
-> ResourceListChangedNotification
Generic)
    deriving ([ResourceListChangedNotification] -> Value
[ResourceListChangedNotification] -> Encoding
ResourceListChangedNotification -> Bool
ResourceListChangedNotification -> Value
ResourceListChangedNotification -> Encoding
(ResourceListChangedNotification -> Value)
-> (ResourceListChangedNotification -> Encoding)
-> ([ResourceListChangedNotification] -> Value)
-> ([ResourceListChangedNotification] -> Encoding)
-> (ResourceListChangedNotification -> Bool)
-> ToJSON ResourceListChangedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ResourceListChangedNotification -> Value
toJSON :: ResourceListChangedNotification -> Value
$ctoEncoding :: ResourceListChangedNotification -> Encoding
toEncoding :: ResourceListChangedNotification -> Encoding
$ctoJSONList :: [ResourceListChangedNotification] -> Value
toJSONList :: [ResourceListChangedNotification] -> Value
$ctoEncodingList :: [ResourceListChangedNotification] -> Encoding
toEncodingList :: [ResourceListChangedNotification] -> Encoding
$comitField :: ResourceListChangedNotification -> Bool
omitField :: ResourceListChangedNotification -> Bool
ToJSON, Maybe ResourceListChangedNotification
Value -> Parser [ResourceListChangedNotification]
Value -> Parser ResourceListChangedNotification
(Value -> Parser ResourceListChangedNotification)
-> (Value -> Parser [ResourceListChangedNotification])
-> Maybe ResourceListChangedNotification
-> FromJSON ResourceListChangedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ResourceListChangedNotification
parseJSON :: Value -> Parser ResourceListChangedNotification
$cparseJSONList :: Value -> Parser [ResourceListChangedNotification]
parseJSONList :: Value -> Parser [ResourceListChangedNotification]
$comittedField :: Maybe ResourceListChangedNotification
omittedField :: Maybe ResourceListChangedNotification
FromJSON) via ViaJSONRPCNotification ResourceListChangedNotification

instance IsJSONRPCNotification ResourceListChangedNotification where
    notificationsMethod :: Proxy ResourceListChangedNotification -> Text
notificationsMethod Proxy ResourceListChangedNotification
_ = Text
"notifications/resources/list_changed"

{- | Resource updated notification parameters.

Parameters for resource update notifications.
-}
data ResourceUpdatedParams = ResourceUpdatedParams
    { ResourceUpdatedParams -> Text
uri :: Text
    {- ^ The URI of the resource that has been updated. This might be a sub-resource
    of the one that the client actually subscribed to.
    -}
    }
    deriving stock (Int -> ResourceUpdatedParams -> ShowS
[ResourceUpdatedParams] -> ShowS
ResourceUpdatedParams -> String
(Int -> ResourceUpdatedParams -> ShowS)
-> (ResourceUpdatedParams -> String)
-> ([ResourceUpdatedParams] -> ShowS)
-> Show ResourceUpdatedParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResourceUpdatedParams -> ShowS
showsPrec :: Int -> ResourceUpdatedParams -> ShowS
$cshow :: ResourceUpdatedParams -> String
show :: ResourceUpdatedParams -> String
$cshowList :: [ResourceUpdatedParams] -> ShowS
showList :: [ResourceUpdatedParams] -> ShowS
Show, ResourceUpdatedParams -> ResourceUpdatedParams -> Bool
(ResourceUpdatedParams -> ResourceUpdatedParams -> Bool)
-> (ResourceUpdatedParams -> ResourceUpdatedParams -> Bool)
-> Eq ResourceUpdatedParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResourceUpdatedParams -> ResourceUpdatedParams -> Bool
== :: ResourceUpdatedParams -> ResourceUpdatedParams -> Bool
$c/= :: ResourceUpdatedParams -> ResourceUpdatedParams -> Bool
/= :: ResourceUpdatedParams -> ResourceUpdatedParams -> Bool
Eq, (forall x. ResourceUpdatedParams -> Rep ResourceUpdatedParams x)
-> (forall x. Rep ResourceUpdatedParams x -> ResourceUpdatedParams)
-> Generic ResourceUpdatedParams
forall x. Rep ResourceUpdatedParams x -> ResourceUpdatedParams
forall x. ResourceUpdatedParams -> Rep ResourceUpdatedParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ResourceUpdatedParams -> Rep ResourceUpdatedParams x
from :: forall x. ResourceUpdatedParams -> Rep ResourceUpdatedParams x
$cto :: forall x. Rep ResourceUpdatedParams x -> ResourceUpdatedParams
to :: forall x. Rep ResourceUpdatedParams x -> ResourceUpdatedParams
Generic)

$(deriveJSON mcpParseOpts ''ResourceUpdatedParams)

{- | A notification from the server to the client, informing it that a resource
has changed and may need to be read again.

This should only be sent if the client previously sent a resources/subscribe request.
-}
data ResourceUpdatedNotification = ResourceUpdatedNotification
    { ResourceUpdatedNotification -> ResourceUpdatedParams
params :: ResourceUpdatedParams
    }
    deriving stock (Int -> ResourceUpdatedNotification -> ShowS
[ResourceUpdatedNotification] -> ShowS
ResourceUpdatedNotification -> String
(Int -> ResourceUpdatedNotification -> ShowS)
-> (ResourceUpdatedNotification -> String)
-> ([ResourceUpdatedNotification] -> ShowS)
-> Show ResourceUpdatedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResourceUpdatedNotification -> ShowS
showsPrec :: Int -> ResourceUpdatedNotification -> ShowS
$cshow :: ResourceUpdatedNotification -> String
show :: ResourceUpdatedNotification -> String
$cshowList :: [ResourceUpdatedNotification] -> ShowS
showList :: [ResourceUpdatedNotification] -> ShowS
Show, ResourceUpdatedNotification -> ResourceUpdatedNotification -> Bool
(ResourceUpdatedNotification
 -> ResourceUpdatedNotification -> Bool)
-> (ResourceUpdatedNotification
    -> ResourceUpdatedNotification -> Bool)
-> Eq ResourceUpdatedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResourceUpdatedNotification -> ResourceUpdatedNotification -> Bool
== :: ResourceUpdatedNotification -> ResourceUpdatedNotification -> Bool
$c/= :: ResourceUpdatedNotification -> ResourceUpdatedNotification -> Bool
/= :: ResourceUpdatedNotification -> ResourceUpdatedNotification -> Bool
Eq, (forall x.
 ResourceUpdatedNotification -> Rep ResourceUpdatedNotification x)
-> (forall x.
    Rep ResourceUpdatedNotification x -> ResourceUpdatedNotification)
-> Generic ResourceUpdatedNotification
forall x.
Rep ResourceUpdatedNotification x -> ResourceUpdatedNotification
forall x.
ResourceUpdatedNotification -> Rep ResourceUpdatedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ResourceUpdatedNotification -> Rep ResourceUpdatedNotification x
from :: forall x.
ResourceUpdatedNotification -> Rep ResourceUpdatedNotification x
$cto :: forall x.
Rep ResourceUpdatedNotification x -> ResourceUpdatedNotification
to :: forall x.
Rep ResourceUpdatedNotification x -> ResourceUpdatedNotification
Generic)
    deriving ([ResourceUpdatedNotification] -> Value
[ResourceUpdatedNotification] -> Encoding
ResourceUpdatedNotification -> Bool
ResourceUpdatedNotification -> Value
ResourceUpdatedNotification -> Encoding
(ResourceUpdatedNotification -> Value)
-> (ResourceUpdatedNotification -> Encoding)
-> ([ResourceUpdatedNotification] -> Value)
-> ([ResourceUpdatedNotification] -> Encoding)
-> (ResourceUpdatedNotification -> Bool)
-> ToJSON ResourceUpdatedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ResourceUpdatedNotification -> Value
toJSON :: ResourceUpdatedNotification -> Value
$ctoEncoding :: ResourceUpdatedNotification -> Encoding
toEncoding :: ResourceUpdatedNotification -> Encoding
$ctoJSONList :: [ResourceUpdatedNotification] -> Value
toJSONList :: [ResourceUpdatedNotification] -> Value
$ctoEncodingList :: [ResourceUpdatedNotification] -> Encoding
toEncodingList :: [ResourceUpdatedNotification] -> Encoding
$comitField :: ResourceUpdatedNotification -> Bool
omitField :: ResourceUpdatedNotification -> Bool
ToJSON, Maybe ResourceUpdatedNotification
Value -> Parser [ResourceUpdatedNotification]
Value -> Parser ResourceUpdatedNotification
(Value -> Parser ResourceUpdatedNotification)
-> (Value -> Parser [ResourceUpdatedNotification])
-> Maybe ResourceUpdatedNotification
-> FromJSON ResourceUpdatedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ResourceUpdatedNotification
parseJSON :: Value -> Parser ResourceUpdatedNotification
$cparseJSONList :: Value -> Parser [ResourceUpdatedNotification]
parseJSONList :: Value -> Parser [ResourceUpdatedNotification]
$comittedField :: Maybe ResourceUpdatedNotification
omittedField :: Maybe ResourceUpdatedNotification
FromJSON) via ViaJSONRPCNotification ResourceUpdatedNotification

instance IsJSONRPCNotification ResourceUpdatedNotification where
    notificationsMethod :: Proxy ResourceUpdatedNotification -> Text
notificationsMethod Proxy ResourceUpdatedNotification
_ = Text
"notifications/resources/updated"

{- | An optional notification from the server to the client, informing it that the list
of prompts it offers has changed.

This may be issued by servers without any previous subscription from the client.
-}
data PromptListChangedNotification = PromptListChangedNotification
    { PromptListChangedNotification -> Maybe EmptyParams
params :: Maybe EmptyParams
    }
    deriving stock (Int -> PromptListChangedNotification -> ShowS
[PromptListChangedNotification] -> ShowS
PromptListChangedNotification -> String
(Int -> PromptListChangedNotification -> ShowS)
-> (PromptListChangedNotification -> String)
-> ([PromptListChangedNotification] -> ShowS)
-> Show PromptListChangedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PromptListChangedNotification -> ShowS
showsPrec :: Int -> PromptListChangedNotification -> ShowS
$cshow :: PromptListChangedNotification -> String
show :: PromptListChangedNotification -> String
$cshowList :: [PromptListChangedNotification] -> ShowS
showList :: [PromptListChangedNotification] -> ShowS
Show, PromptListChangedNotification
-> PromptListChangedNotification -> Bool
(PromptListChangedNotification
 -> PromptListChangedNotification -> Bool)
-> (PromptListChangedNotification
    -> PromptListChangedNotification -> Bool)
-> Eq PromptListChangedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PromptListChangedNotification
-> PromptListChangedNotification -> Bool
== :: PromptListChangedNotification
-> PromptListChangedNotification -> Bool
$c/= :: PromptListChangedNotification
-> PromptListChangedNotification -> Bool
/= :: PromptListChangedNotification
-> PromptListChangedNotification -> Bool
Eq, (forall x.
 PromptListChangedNotification
 -> Rep PromptListChangedNotification x)
-> (forall x.
    Rep PromptListChangedNotification x
    -> PromptListChangedNotification)
-> Generic PromptListChangedNotification
forall x.
Rep PromptListChangedNotification x
-> PromptListChangedNotification
forall x.
PromptListChangedNotification
-> Rep PromptListChangedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
PromptListChangedNotification
-> Rep PromptListChangedNotification x
from :: forall x.
PromptListChangedNotification
-> Rep PromptListChangedNotification x
$cto :: forall x.
Rep PromptListChangedNotification x
-> PromptListChangedNotification
to :: forall x.
Rep PromptListChangedNotification x
-> PromptListChangedNotification
Generic)
    deriving ([PromptListChangedNotification] -> Value
[PromptListChangedNotification] -> Encoding
PromptListChangedNotification -> Bool
PromptListChangedNotification -> Value
PromptListChangedNotification -> Encoding
(PromptListChangedNotification -> Value)
-> (PromptListChangedNotification -> Encoding)
-> ([PromptListChangedNotification] -> Value)
-> ([PromptListChangedNotification] -> Encoding)
-> (PromptListChangedNotification -> Bool)
-> ToJSON PromptListChangedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: PromptListChangedNotification -> Value
toJSON :: PromptListChangedNotification -> Value
$ctoEncoding :: PromptListChangedNotification -> Encoding
toEncoding :: PromptListChangedNotification -> Encoding
$ctoJSONList :: [PromptListChangedNotification] -> Value
toJSONList :: [PromptListChangedNotification] -> Value
$ctoEncodingList :: [PromptListChangedNotification] -> Encoding
toEncodingList :: [PromptListChangedNotification] -> Encoding
$comitField :: PromptListChangedNotification -> Bool
omitField :: PromptListChangedNotification -> Bool
ToJSON, Maybe PromptListChangedNotification
Value -> Parser [PromptListChangedNotification]
Value -> Parser PromptListChangedNotification
(Value -> Parser PromptListChangedNotification)
-> (Value -> Parser [PromptListChangedNotification])
-> Maybe PromptListChangedNotification
-> FromJSON PromptListChangedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser PromptListChangedNotification
parseJSON :: Value -> Parser PromptListChangedNotification
$cparseJSONList :: Value -> Parser [PromptListChangedNotification]
parseJSONList :: Value -> Parser [PromptListChangedNotification]
$comittedField :: Maybe PromptListChangedNotification
omittedField :: Maybe PromptListChangedNotification
FromJSON) via ViaJSONRPCNotification PromptListChangedNotification

instance IsJSONRPCNotification PromptListChangedNotification where
    notificationsMethod :: Proxy PromptListChangedNotification -> Text
notificationsMethod Proxy PromptListChangedNotification
_ = Text
"notifications/prompts/list_changed"

{- | An optional notification from the server to the client, informing it that the list
of tools it offers has changed.

This may be issued by servers without any previous subscription from the client.
-}
data ToolListChangedNotification = ToolListChangedNotification
    { ToolListChangedNotification -> Maybe EmptyParams
params :: Maybe EmptyParams
    }
    deriving stock (Int -> ToolListChangedNotification -> ShowS
[ToolListChangedNotification] -> ShowS
ToolListChangedNotification -> String
(Int -> ToolListChangedNotification -> ShowS)
-> (ToolListChangedNotification -> String)
-> ([ToolListChangedNotification] -> ShowS)
-> Show ToolListChangedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToolListChangedNotification -> ShowS
showsPrec :: Int -> ToolListChangedNotification -> ShowS
$cshow :: ToolListChangedNotification -> String
show :: ToolListChangedNotification -> String
$cshowList :: [ToolListChangedNotification] -> ShowS
showList :: [ToolListChangedNotification] -> ShowS
Show, ToolListChangedNotification -> ToolListChangedNotification -> Bool
(ToolListChangedNotification
 -> ToolListChangedNotification -> Bool)
-> (ToolListChangedNotification
    -> ToolListChangedNotification -> Bool)
-> Eq ToolListChangedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToolListChangedNotification -> ToolListChangedNotification -> Bool
== :: ToolListChangedNotification -> ToolListChangedNotification -> Bool
$c/= :: ToolListChangedNotification -> ToolListChangedNotification -> Bool
/= :: ToolListChangedNotification -> ToolListChangedNotification -> Bool
Eq, (forall x.
 ToolListChangedNotification -> Rep ToolListChangedNotification x)
-> (forall x.
    Rep ToolListChangedNotification x -> ToolListChangedNotification)
-> Generic ToolListChangedNotification
forall x.
Rep ToolListChangedNotification x -> ToolListChangedNotification
forall x.
ToolListChangedNotification -> Rep ToolListChangedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ToolListChangedNotification -> Rep ToolListChangedNotification x
from :: forall x.
ToolListChangedNotification -> Rep ToolListChangedNotification x
$cto :: forall x.
Rep ToolListChangedNotification x -> ToolListChangedNotification
to :: forall x.
Rep ToolListChangedNotification x -> ToolListChangedNotification
Generic)
    deriving ([ToolListChangedNotification] -> Value
[ToolListChangedNotification] -> Encoding
ToolListChangedNotification -> Bool
ToolListChangedNotification -> Value
ToolListChangedNotification -> Encoding
(ToolListChangedNotification -> Value)
-> (ToolListChangedNotification -> Encoding)
-> ([ToolListChangedNotification] -> Value)
-> ([ToolListChangedNotification] -> Encoding)
-> (ToolListChangedNotification -> Bool)
-> ToJSON ToolListChangedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ToolListChangedNotification -> Value
toJSON :: ToolListChangedNotification -> Value
$ctoEncoding :: ToolListChangedNotification -> Encoding
toEncoding :: ToolListChangedNotification -> Encoding
$ctoJSONList :: [ToolListChangedNotification] -> Value
toJSONList :: [ToolListChangedNotification] -> Value
$ctoEncodingList :: [ToolListChangedNotification] -> Encoding
toEncodingList :: [ToolListChangedNotification] -> Encoding
$comitField :: ToolListChangedNotification -> Bool
omitField :: ToolListChangedNotification -> Bool
ToJSON, Maybe ToolListChangedNotification
Value -> Parser [ToolListChangedNotification]
Value -> Parser ToolListChangedNotification
(Value -> Parser ToolListChangedNotification)
-> (Value -> Parser [ToolListChangedNotification])
-> Maybe ToolListChangedNotification
-> FromJSON ToolListChangedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ToolListChangedNotification
parseJSON :: Value -> Parser ToolListChangedNotification
$cparseJSONList :: Value -> Parser [ToolListChangedNotification]
parseJSONList :: Value -> Parser [ToolListChangedNotification]
$comittedField :: Maybe ToolListChangedNotification
omittedField :: Maybe ToolListChangedNotification
FromJSON) via ViaJSONRPCNotification ToolListChangedNotification

instance IsJSONRPCNotification ToolListChangedNotification where
    notificationsMethod :: Proxy ToolListChangedNotification -> Text
notificationsMethod Proxy ToolListChangedNotification
_ = Text
"notifications/tools/list_changed"

{- | Logging message notification parameters.

Parameters for log message notifications.
-}
data LoggingMessageParams = LoggingMessageParams
    { LoggingMessageParams -> LoggingLevel
level :: LoggingLevel
    -- ^ The severity of this log message.
    , LoggingMessageParams -> Value
data' :: Value
    {- ^ The data to be logged, such as a string message or an object.
    Any JSON serializable type is allowed here.
    -}
    , LoggingMessageParams -> Maybe Text
logger :: Maybe Text
    -- ^ An optional name of the logger issuing this message.
    }
    deriving stock (Int -> LoggingMessageParams -> ShowS
[LoggingMessageParams] -> ShowS
LoggingMessageParams -> String
(Int -> LoggingMessageParams -> ShowS)
-> (LoggingMessageParams -> String)
-> ([LoggingMessageParams] -> ShowS)
-> Show LoggingMessageParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LoggingMessageParams -> ShowS
showsPrec :: Int -> LoggingMessageParams -> ShowS
$cshow :: LoggingMessageParams -> String
show :: LoggingMessageParams -> String
$cshowList :: [LoggingMessageParams] -> ShowS
showList :: [LoggingMessageParams] -> ShowS
Show, LoggingMessageParams -> LoggingMessageParams -> Bool
(LoggingMessageParams -> LoggingMessageParams -> Bool)
-> (LoggingMessageParams -> LoggingMessageParams -> Bool)
-> Eq LoggingMessageParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LoggingMessageParams -> LoggingMessageParams -> Bool
== :: LoggingMessageParams -> LoggingMessageParams -> Bool
$c/= :: LoggingMessageParams -> LoggingMessageParams -> Bool
/= :: LoggingMessageParams -> LoggingMessageParams -> Bool
Eq, (forall x. LoggingMessageParams -> Rep LoggingMessageParams x)
-> (forall x. Rep LoggingMessageParams x -> LoggingMessageParams)
-> Generic LoggingMessageParams
forall x. Rep LoggingMessageParams x -> LoggingMessageParams
forall x. LoggingMessageParams -> Rep LoggingMessageParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LoggingMessageParams -> Rep LoggingMessageParams x
from :: forall x. LoggingMessageParams -> Rep LoggingMessageParams x
$cto :: forall x. Rep LoggingMessageParams x -> LoggingMessageParams
to :: forall x. Rep LoggingMessageParams x -> LoggingMessageParams
Generic)

$(deriveJSON mcpParseOpts ''LoggingMessageParams)

{- | Notification of a log message passed from server to client.

If no logging/setLevel request has been sent from the client, the server MAY decide
which messages to send automatically.
-}
data LoggingMessageNotification = LoggingMessageNotification
    { LoggingMessageNotification -> LoggingMessageParams
params :: LoggingMessageParams
    }
    deriving stock (Int -> LoggingMessageNotification -> ShowS
[LoggingMessageNotification] -> ShowS
LoggingMessageNotification -> String
(Int -> LoggingMessageNotification -> ShowS)
-> (LoggingMessageNotification -> String)
-> ([LoggingMessageNotification] -> ShowS)
-> Show LoggingMessageNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LoggingMessageNotification -> ShowS
showsPrec :: Int -> LoggingMessageNotification -> ShowS
$cshow :: LoggingMessageNotification -> String
show :: LoggingMessageNotification -> String
$cshowList :: [LoggingMessageNotification] -> ShowS
showList :: [LoggingMessageNotification] -> ShowS
Show, LoggingMessageNotification -> LoggingMessageNotification -> Bool
(LoggingMessageNotification -> LoggingMessageNotification -> Bool)
-> (LoggingMessageNotification
    -> LoggingMessageNotification -> Bool)
-> Eq LoggingMessageNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LoggingMessageNotification -> LoggingMessageNotification -> Bool
== :: LoggingMessageNotification -> LoggingMessageNotification -> Bool
$c/= :: LoggingMessageNotification -> LoggingMessageNotification -> Bool
/= :: LoggingMessageNotification -> LoggingMessageNotification -> Bool
Eq, (forall x.
 LoggingMessageNotification -> Rep LoggingMessageNotification x)
-> (forall x.
    Rep LoggingMessageNotification x -> LoggingMessageNotification)
-> Generic LoggingMessageNotification
forall x.
Rep LoggingMessageNotification x -> LoggingMessageNotification
forall x.
LoggingMessageNotification -> Rep LoggingMessageNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
LoggingMessageNotification -> Rep LoggingMessageNotification x
from :: forall x.
LoggingMessageNotification -> Rep LoggingMessageNotification x
$cto :: forall x.
Rep LoggingMessageNotification x -> LoggingMessageNotification
to :: forall x.
Rep LoggingMessageNotification x -> LoggingMessageNotification
Generic)
    deriving ([LoggingMessageNotification] -> Value
[LoggingMessageNotification] -> Encoding
LoggingMessageNotification -> Bool
LoggingMessageNotification -> Value
LoggingMessageNotification -> Encoding
(LoggingMessageNotification -> Value)
-> (LoggingMessageNotification -> Encoding)
-> ([LoggingMessageNotification] -> Value)
-> ([LoggingMessageNotification] -> Encoding)
-> (LoggingMessageNotification -> Bool)
-> ToJSON LoggingMessageNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: LoggingMessageNotification -> Value
toJSON :: LoggingMessageNotification -> Value
$ctoEncoding :: LoggingMessageNotification -> Encoding
toEncoding :: LoggingMessageNotification -> Encoding
$ctoJSONList :: [LoggingMessageNotification] -> Value
toJSONList :: [LoggingMessageNotification] -> Value
$ctoEncodingList :: [LoggingMessageNotification] -> Encoding
toEncodingList :: [LoggingMessageNotification] -> Encoding
$comitField :: LoggingMessageNotification -> Bool
omitField :: LoggingMessageNotification -> Bool
ToJSON, Maybe LoggingMessageNotification
Value -> Parser [LoggingMessageNotification]
Value -> Parser LoggingMessageNotification
(Value -> Parser LoggingMessageNotification)
-> (Value -> Parser [LoggingMessageNotification])
-> Maybe LoggingMessageNotification
-> FromJSON LoggingMessageNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser LoggingMessageNotification
parseJSON :: Value -> Parser LoggingMessageNotification
$cparseJSONList :: Value -> Parser [LoggingMessageNotification]
parseJSONList :: Value -> Parser [LoggingMessageNotification]
$comittedField :: Maybe LoggingMessageNotification
omittedField :: Maybe LoggingMessageNotification
FromJSON) via ViaJSONRPCNotification LoggingMessageNotification

instance IsJSONRPCNotification LoggingMessageNotification where
    notificationsMethod :: Proxy LoggingMessageNotification -> Text
notificationsMethod Proxy LoggingMessageNotification
_ = Text
"notifications/message"

{- | A notification from the client to the server, informing it that the list of roots has changed.

This notification should be sent whenever the client adds, removes, or modifies any root.
The server should then request an updated list of roots using the ListRootsRequest.
-}
data RootsListChangedNotification = RootsListChangedNotification
    { RootsListChangedNotification -> Maybe EmptyParams
params :: Maybe EmptyParams
    }
    deriving stock (Int -> RootsListChangedNotification -> ShowS
[RootsListChangedNotification] -> ShowS
RootsListChangedNotification -> String
(Int -> RootsListChangedNotification -> ShowS)
-> (RootsListChangedNotification -> String)
-> ([RootsListChangedNotification] -> ShowS)
-> Show RootsListChangedNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RootsListChangedNotification -> ShowS
showsPrec :: Int -> RootsListChangedNotification -> ShowS
$cshow :: RootsListChangedNotification -> String
show :: RootsListChangedNotification -> String
$cshowList :: [RootsListChangedNotification] -> ShowS
showList :: [RootsListChangedNotification] -> ShowS
Show, RootsListChangedNotification
-> RootsListChangedNotification -> Bool
(RootsListChangedNotification
 -> RootsListChangedNotification -> Bool)
-> (RootsListChangedNotification
    -> RootsListChangedNotification -> Bool)
-> Eq RootsListChangedNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RootsListChangedNotification
-> RootsListChangedNotification -> Bool
== :: RootsListChangedNotification
-> RootsListChangedNotification -> Bool
$c/= :: RootsListChangedNotification
-> RootsListChangedNotification -> Bool
/= :: RootsListChangedNotification
-> RootsListChangedNotification -> Bool
Eq, (forall x.
 RootsListChangedNotification -> Rep RootsListChangedNotification x)
-> (forall x.
    Rep RootsListChangedNotification x -> RootsListChangedNotification)
-> Generic RootsListChangedNotification
forall x.
Rep RootsListChangedNotification x -> RootsListChangedNotification
forall x.
RootsListChangedNotification -> Rep RootsListChangedNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
RootsListChangedNotification -> Rep RootsListChangedNotification x
from :: forall x.
RootsListChangedNotification -> Rep RootsListChangedNotification x
$cto :: forall x.
Rep RootsListChangedNotification x -> RootsListChangedNotification
to :: forall x.
Rep RootsListChangedNotification x -> RootsListChangedNotification
Generic)
    deriving ([RootsListChangedNotification] -> Value
[RootsListChangedNotification] -> Encoding
RootsListChangedNotification -> Bool
RootsListChangedNotification -> Value
RootsListChangedNotification -> Encoding
(RootsListChangedNotification -> Value)
-> (RootsListChangedNotification -> Encoding)
-> ([RootsListChangedNotification] -> Value)
-> ([RootsListChangedNotification] -> Encoding)
-> (RootsListChangedNotification -> Bool)
-> ToJSON RootsListChangedNotification
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: RootsListChangedNotification -> Value
toJSON :: RootsListChangedNotification -> Value
$ctoEncoding :: RootsListChangedNotification -> Encoding
toEncoding :: RootsListChangedNotification -> Encoding
$ctoJSONList :: [RootsListChangedNotification] -> Value
toJSONList :: [RootsListChangedNotification] -> Value
$ctoEncodingList :: [RootsListChangedNotification] -> Encoding
toEncodingList :: [RootsListChangedNotification] -> Encoding
$comitField :: RootsListChangedNotification -> Bool
omitField :: RootsListChangedNotification -> Bool
ToJSON, Maybe RootsListChangedNotification
Value -> Parser [RootsListChangedNotification]
Value -> Parser RootsListChangedNotification
(Value -> Parser RootsListChangedNotification)
-> (Value -> Parser [RootsListChangedNotification])
-> Maybe RootsListChangedNotification
-> FromJSON RootsListChangedNotification
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser RootsListChangedNotification
parseJSON :: Value -> Parser RootsListChangedNotification
$cparseJSONList :: Value -> Parser [RootsListChangedNotification]
parseJSONList :: Value -> Parser [RootsListChangedNotification]
$comittedField :: Maybe RootsListChangedNotification
omittedField :: Maybe RootsListChangedNotification
FromJSON) via ViaJSONRPCNotification RootsListChangedNotification

instance IsJSONRPCNotification RootsListChangedNotification where
    notificationsMethod :: Proxy RootsListChangedNotification -> Text
notificationsMethod Proxy RootsListChangedNotification
_ = Text
"notifications/roots/list_changed"

-- * Union Types

{- | Any request that can be sent from a client to a server.

This union type encompasses all possible client-to-server requests in the MCP protocol.
-}
data ClientRequest
    = InitializeReq InitializeRequest
    | PingReq PingRequest
    | ListResourcesReq ListResourcesRequest
    | ListResourceTemplatesReq ListResourceTemplatesRequest
    | ReadResourceReq ReadResourceRequest
    | SubscribeReq SubscribeRequest
    | UnsubscribeReq UnsubscribeRequest
    | ListPromptsReq ListPromptsRequest
    | GetPromptReq GetPromptRequest
    | ListToolsReq ListToolsRequest
    | CallToolReq CallToolRequest
    | SetLevelReq SetLevelRequest
    | CompleteReq CompleteRequest
    deriving stock (Int -> ClientRequest -> ShowS
[ClientRequest] -> ShowS
ClientRequest -> String
(Int -> ClientRequest -> ShowS)
-> (ClientRequest -> String)
-> ([ClientRequest] -> ShowS)
-> Show ClientRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClientRequest -> ShowS
showsPrec :: Int -> ClientRequest -> ShowS
$cshow :: ClientRequest -> String
show :: ClientRequest -> String
$cshowList :: [ClientRequest] -> ShowS
showList :: [ClientRequest] -> ShowS
Show, ClientRequest -> ClientRequest -> Bool
(ClientRequest -> ClientRequest -> Bool)
-> (ClientRequest -> ClientRequest -> Bool) -> Eq ClientRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClientRequest -> ClientRequest -> Bool
== :: ClientRequest -> ClientRequest -> Bool
$c/= :: ClientRequest -> ClientRequest -> Bool
/= :: ClientRequest -> ClientRequest -> Bool
Eq, (forall x. ClientRequest -> Rep ClientRequest x)
-> (forall x. Rep ClientRequest x -> ClientRequest)
-> Generic ClientRequest
forall x. Rep ClientRequest x -> ClientRequest
forall x. ClientRequest -> Rep ClientRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ClientRequest -> Rep ClientRequest x
from :: forall x. ClientRequest -> Rep ClientRequest x
$cto :: forall x. Rep ClientRequest x -> ClientRequest
to :: forall x. Rep ClientRequest x -> ClientRequest
Generic)

instance ToJSON ClientRequest where
    toJSON :: ClientRequest -> Value
toJSON (InitializeReq InitializeRequest
r) = InitializeRequest -> Value
forall a. ToJSON a => a -> Value
toJSON InitializeRequest
r
    toJSON (PingReq PingRequest
r) = PingRequest -> Value
forall a. ToJSON a => a -> Value
toJSON PingRequest
r
    toJSON (ListResourcesReq ListResourcesRequest
r) = ListResourcesRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ListResourcesRequest
r
    toJSON (ListResourceTemplatesReq ListResourceTemplatesRequest
r) = ListResourceTemplatesRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ListResourceTemplatesRequest
r
    toJSON (ReadResourceReq ReadResourceRequest
r) = ReadResourceRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ReadResourceRequest
r
    toJSON (SubscribeReq SubscribeRequest
r) = SubscribeRequest -> Value
forall a. ToJSON a => a -> Value
toJSON SubscribeRequest
r
    toJSON (UnsubscribeReq UnsubscribeRequest
r) = UnsubscribeRequest -> Value
forall a. ToJSON a => a -> Value
toJSON UnsubscribeRequest
r
    toJSON (ListPromptsReq ListPromptsRequest
r) = ListPromptsRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ListPromptsRequest
r
    toJSON (GetPromptReq GetPromptRequest
r) = GetPromptRequest -> Value
forall a. ToJSON a => a -> Value
toJSON GetPromptRequest
r
    toJSON (ListToolsReq ListToolsRequest
r) = ListToolsRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ListToolsRequest
r
    toJSON (CallToolReq CallToolRequest
r) = CallToolRequest -> Value
forall a. ToJSON a => a -> Value
toJSON CallToolRequest
r
    toJSON (SetLevelReq SetLevelRequest
r) = SetLevelRequest -> Value
forall a. ToJSON a => a -> Value
toJSON SetLevelRequest
r
    toJSON (CompleteReq CompleteRequest
r) = CompleteRequest -> Value
forall a. ToJSON a => a -> Value
toJSON CompleteRequest
r

instance FromJSON ClientRequest where
    parseJSON :: Value -> Parser ClientRequest
parseJSON Value
v =
        (InitializeRequest -> ClientRequest
InitializeReq (InitializeRequest -> ClientRequest)
-> Parser InitializeRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser InitializeRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (PingRequest -> ClientRequest
PingReq (PingRequest -> ClientRequest)
-> Parser PingRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser PingRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ListResourcesRequest -> ClientRequest
ListResourcesReq (ListResourcesRequest -> ClientRequest)
-> Parser ListResourcesRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ListResourcesRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ListResourceTemplatesRequest -> ClientRequest
ListResourceTemplatesReq (ListResourceTemplatesRequest -> ClientRequest)
-> Parser ListResourceTemplatesRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ListResourceTemplatesRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ReadResourceRequest -> ClientRequest
ReadResourceReq (ReadResourceRequest -> ClientRequest)
-> Parser ReadResourceRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ReadResourceRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (SubscribeRequest -> ClientRequest
SubscribeReq (SubscribeRequest -> ClientRequest)
-> Parser SubscribeRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser SubscribeRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (UnsubscribeRequest -> ClientRequest
UnsubscribeReq (UnsubscribeRequest -> ClientRequest)
-> Parser UnsubscribeRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser UnsubscribeRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ListPromptsRequest -> ClientRequest
ListPromptsReq (ListPromptsRequest -> ClientRequest)
-> Parser ListPromptsRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ListPromptsRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (GetPromptRequest -> ClientRequest
GetPromptReq (GetPromptRequest -> ClientRequest)
-> Parser GetPromptRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser GetPromptRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ListToolsRequest -> ClientRequest
ListToolsReq (ListToolsRequest -> ClientRequest)
-> Parser ListToolsRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ListToolsRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (CallToolRequest -> ClientRequest
CallToolReq (CallToolRequest -> ClientRequest)
-> Parser CallToolRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser CallToolRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (SetLevelRequest -> ClientRequest
SetLevelReq (SetLevelRequest -> ClientRequest)
-> Parser SetLevelRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser SetLevelRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientRequest
-> Parser ClientRequest -> Parser ClientRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (CompleteRequest -> ClientRequest
CompleteReq (CompleteRequest -> ClientRequest)
-> Parser CompleteRequest -> Parser ClientRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser CompleteRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)

{- | Any request that can be sent from a server to a client.

This union type encompasses all possible server-to-client requests in the MCP protocol.
-}
data ServerRequest
    = PingServerReq PingRequest
    | CreateMessageReq CreateMessageRequest
    | ListRootsReq ListRootsRequest
    | ElicitReq ElicitRequest
    deriving stock (Int -> ServerRequest -> ShowS
[ServerRequest] -> ShowS
ServerRequest -> String
(Int -> ServerRequest -> ShowS)
-> (ServerRequest -> String)
-> ([ServerRequest] -> ShowS)
-> Show ServerRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ServerRequest -> ShowS
showsPrec :: Int -> ServerRequest -> ShowS
$cshow :: ServerRequest -> String
show :: ServerRequest -> String
$cshowList :: [ServerRequest] -> ShowS
showList :: [ServerRequest] -> ShowS
Show, ServerRequest -> ServerRequest -> Bool
(ServerRequest -> ServerRequest -> Bool)
-> (ServerRequest -> ServerRequest -> Bool) -> Eq ServerRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ServerRequest -> ServerRequest -> Bool
== :: ServerRequest -> ServerRequest -> Bool
$c/= :: ServerRequest -> ServerRequest -> Bool
/= :: ServerRequest -> ServerRequest -> Bool
Eq, (forall x. ServerRequest -> Rep ServerRequest x)
-> (forall x. Rep ServerRequest x -> ServerRequest)
-> Generic ServerRequest
forall x. Rep ServerRequest x -> ServerRequest
forall x. ServerRequest -> Rep ServerRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ServerRequest -> Rep ServerRequest x
from :: forall x. ServerRequest -> Rep ServerRequest x
$cto :: forall x. Rep ServerRequest x -> ServerRequest
to :: forall x. Rep ServerRequest x -> ServerRequest
Generic)

instance ToJSON ServerRequest where
    toJSON :: ServerRequest -> Value
toJSON (PingServerReq PingRequest
r) = PingRequest -> Value
forall a. ToJSON a => a -> Value
toJSON PingRequest
r
    toJSON (CreateMessageReq CreateMessageRequest
r) = CreateMessageRequest -> Value
forall a. ToJSON a => a -> Value
toJSON CreateMessageRequest
r
    toJSON (ListRootsReq ListRootsRequest
r) = ListRootsRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ListRootsRequest
r
    toJSON (ElicitReq ElicitRequest
r) = ElicitRequest -> Value
forall a. ToJSON a => a -> Value
toJSON ElicitRequest
r

instance FromJSON ServerRequest where
    parseJSON :: Value -> Parser ServerRequest
parseJSON Value
v =
        (PingRequest -> ServerRequest
PingServerReq (PingRequest -> ServerRequest)
-> Parser PingRequest -> Parser ServerRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser PingRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerRequest
-> Parser ServerRequest -> Parser ServerRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (CreateMessageRequest -> ServerRequest
CreateMessageReq (CreateMessageRequest -> ServerRequest)
-> Parser CreateMessageRequest -> Parser ServerRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser CreateMessageRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerRequest
-> Parser ServerRequest -> Parser ServerRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ListRootsRequest -> ServerRequest
ListRootsReq (ListRootsRequest -> ServerRequest)
-> Parser ListRootsRequest -> Parser ServerRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ListRootsRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerRequest
-> Parser ServerRequest -> Parser ServerRequest
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ElicitRequest -> ServerRequest
ElicitReq (ElicitRequest -> ServerRequest)
-> Parser ElicitRequest -> Parser ServerRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ElicitRequest
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)

{- | Any notification that can be sent from a client to a server.

This union type encompasses all possible client-to-server notifications in the MCP protocol.
-}
data ClientNotification
    = CancelledNotif CancelledNotification
    | InitializedNotif InitializedNotification
    | ProgressNotif ProgressNotification
    | RootsListChangedNotif RootsListChangedNotification
    deriving stock (Int -> ClientNotification -> ShowS
[ClientNotification] -> ShowS
ClientNotification -> String
(Int -> ClientNotification -> ShowS)
-> (ClientNotification -> String)
-> ([ClientNotification] -> ShowS)
-> Show ClientNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClientNotification -> ShowS
showsPrec :: Int -> ClientNotification -> ShowS
$cshow :: ClientNotification -> String
show :: ClientNotification -> String
$cshowList :: [ClientNotification] -> ShowS
showList :: [ClientNotification] -> ShowS
Show, ClientNotification -> ClientNotification -> Bool
(ClientNotification -> ClientNotification -> Bool)
-> (ClientNotification -> ClientNotification -> Bool)
-> Eq ClientNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClientNotification -> ClientNotification -> Bool
== :: ClientNotification -> ClientNotification -> Bool
$c/= :: ClientNotification -> ClientNotification -> Bool
/= :: ClientNotification -> ClientNotification -> Bool
Eq, (forall x. ClientNotification -> Rep ClientNotification x)
-> (forall x. Rep ClientNotification x -> ClientNotification)
-> Generic ClientNotification
forall x. Rep ClientNotification x -> ClientNotification
forall x. ClientNotification -> Rep ClientNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ClientNotification -> Rep ClientNotification x
from :: forall x. ClientNotification -> Rep ClientNotification x
$cto :: forall x. Rep ClientNotification x -> ClientNotification
to :: forall x. Rep ClientNotification x -> ClientNotification
Generic)

instance ToJSON ClientNotification where
    toJSON :: ClientNotification -> Value
toJSON (CancelledNotif CancelledNotification
n) = CancelledNotification -> Value
forall a. ToJSON a => a -> Value
toJSON CancelledNotification
n
    toJSON (InitializedNotif InitializedNotification
n) = InitializedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON InitializedNotification
n
    toJSON (ProgressNotif ProgressNotification
n) = ProgressNotification -> Value
forall a. ToJSON a => a -> Value
toJSON ProgressNotification
n
    toJSON (RootsListChangedNotif RootsListChangedNotification
n) = RootsListChangedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON RootsListChangedNotification
n

instance FromJSON ClientNotification where
    parseJSON :: Value -> Parser ClientNotification
parseJSON Value
v =
        (CancelledNotification -> ClientNotification
CancelledNotif (CancelledNotification -> ClientNotification)
-> Parser CancelledNotification -> Parser ClientNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser CancelledNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientNotification
-> Parser ClientNotification -> Parser ClientNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (InitializedNotification -> ClientNotification
InitializedNotif (InitializedNotification -> ClientNotification)
-> Parser InitializedNotification -> Parser ClientNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser InitializedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientNotification
-> Parser ClientNotification -> Parser ClientNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ProgressNotification -> ClientNotification
ProgressNotif (ProgressNotification -> ClientNotification)
-> Parser ProgressNotification -> Parser ClientNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ProgressNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ClientNotification
-> Parser ClientNotification -> Parser ClientNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (RootsListChangedNotification -> ClientNotification
RootsListChangedNotif (RootsListChangedNotification -> ClientNotification)
-> Parser RootsListChangedNotification -> Parser ClientNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser RootsListChangedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)

{- | Any notification that can be sent from a server to a client.

This union type encompasses all possible server-to-client notifications in the MCP protocol.
-}
data ServerNotification
    = CancelledServerNotif CancelledNotification
    | ProgressServerNotif ProgressNotification
    | ResourceListChangedNotif ResourceListChangedNotification
    | ResourceUpdatedNotif ResourceUpdatedNotification
    | PromptListChangedNotif PromptListChangedNotification
    | ToolListChangedNotif ToolListChangedNotification
    | LoggingMessageNotif LoggingMessageNotification
    deriving stock (Int -> ServerNotification -> ShowS
[ServerNotification] -> ShowS
ServerNotification -> String
(Int -> ServerNotification -> ShowS)
-> (ServerNotification -> String)
-> ([ServerNotification] -> ShowS)
-> Show ServerNotification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ServerNotification -> ShowS
showsPrec :: Int -> ServerNotification -> ShowS
$cshow :: ServerNotification -> String
show :: ServerNotification -> String
$cshowList :: [ServerNotification] -> ShowS
showList :: [ServerNotification] -> ShowS
Show, ServerNotification -> ServerNotification -> Bool
(ServerNotification -> ServerNotification -> Bool)
-> (ServerNotification -> ServerNotification -> Bool)
-> Eq ServerNotification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ServerNotification -> ServerNotification -> Bool
== :: ServerNotification -> ServerNotification -> Bool
$c/= :: ServerNotification -> ServerNotification -> Bool
/= :: ServerNotification -> ServerNotification -> Bool
Eq, (forall x. ServerNotification -> Rep ServerNotification x)
-> (forall x. Rep ServerNotification x -> ServerNotification)
-> Generic ServerNotification
forall x. Rep ServerNotification x -> ServerNotification
forall x. ServerNotification -> Rep ServerNotification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ServerNotification -> Rep ServerNotification x
from :: forall x. ServerNotification -> Rep ServerNotification x
$cto :: forall x. Rep ServerNotification x -> ServerNotification
to :: forall x. Rep ServerNotification x -> ServerNotification
Generic)

instance ToJSON ServerNotification where
    toJSON :: ServerNotification -> Value
toJSON (CancelledServerNotif CancelledNotification
n) = CancelledNotification -> Value
forall a. ToJSON a => a -> Value
toJSON CancelledNotification
n
    toJSON (ProgressServerNotif ProgressNotification
n) = ProgressNotification -> Value
forall a. ToJSON a => a -> Value
toJSON ProgressNotification
n
    toJSON (ResourceListChangedNotif ResourceListChangedNotification
n) = ResourceListChangedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON ResourceListChangedNotification
n
    toJSON (ResourceUpdatedNotif ResourceUpdatedNotification
n) = ResourceUpdatedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON ResourceUpdatedNotification
n
    toJSON (PromptListChangedNotif PromptListChangedNotification
n) = PromptListChangedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON PromptListChangedNotification
n
    toJSON (ToolListChangedNotif ToolListChangedNotification
n) = ToolListChangedNotification -> Value
forall a. ToJSON a => a -> Value
toJSON ToolListChangedNotification
n
    toJSON (LoggingMessageNotif LoggingMessageNotification
n) = LoggingMessageNotification -> Value
forall a. ToJSON a => a -> Value
toJSON LoggingMessageNotification
n

instance FromJSON ServerNotification where
    parseJSON :: Value -> Parser ServerNotification
parseJSON Value
v =
        (CancelledNotification -> ServerNotification
CancelledServerNotif (CancelledNotification -> ServerNotification)
-> Parser CancelledNotification -> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser CancelledNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ProgressNotification -> ServerNotification
ProgressServerNotif (ProgressNotification -> ServerNotification)
-> Parser ProgressNotification -> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ProgressNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ResourceListChangedNotification -> ServerNotification
ResourceListChangedNotif (ResourceListChangedNotification -> ServerNotification)
-> Parser ResourceListChangedNotification
-> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ResourceListChangedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ResourceUpdatedNotification -> ServerNotification
ResourceUpdatedNotif (ResourceUpdatedNotification -> ServerNotification)
-> Parser ResourceUpdatedNotification -> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ResourceUpdatedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (PromptListChangedNotification -> ServerNotification
PromptListChangedNotif (PromptListChangedNotification -> ServerNotification)
-> Parser PromptListChangedNotification
-> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser PromptListChangedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (ToolListChangedNotification -> ServerNotification
ToolListChangedNotif (ToolListChangedNotification -> ServerNotification)
-> Parser ToolListChangedNotification -> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser ToolListChangedNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)
            Parser ServerNotification
-> Parser ServerNotification -> Parser ServerNotification
forall a. Parser a -> Parser a -> Parser a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (LoggingMessageNotification -> ServerNotification
LoggingMessageNotif (LoggingMessageNotification -> ServerNotification)
-> Parser LoggingMessageNotification -> Parser ServerNotification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser LoggingMessageNotification
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v)

{- | MCP protocol version string.

Indicates the version of the Model Context Protocol
that this implementation supports.
-}
pROTOCOL_VERSION :: Text
pROTOCOL_VERSION :: Text
pROTOCOL_VERSION = Text
"2025-06-18"

{- | Primitive schema definitions that only allow primitive types without nested objects or arrays.

Restricted schema definitions for elicitation requests.
-}
data PrimitiveSchemaDefinition
    = StringSchema
        { PrimitiveSchemaDefinition -> Text
schemaType :: Text -- Always "string"
        , PrimitiveSchemaDefinition -> Maybe Text
title :: Maybe Text
        , PrimitiveSchemaDefinition -> Maybe Text
description :: Maybe Text
        , PrimitiveSchemaDefinition -> Maybe Int
minLength :: Maybe Int
        , PrimitiveSchemaDefinition -> Maybe Int
maxLength :: Maybe Int
        , PrimitiveSchemaDefinition -> Maybe Text
format :: Maybe Text -- "email" | "uri" | "date" | "date-time"
        }
    | NumberSchema
        { schemaType :: Text -- "number" or "integer"
        , title :: Maybe Text
        , description :: Maybe Text
        , PrimitiveSchemaDefinition -> Maybe Double
minimum :: Maybe Double
        , PrimitiveSchemaDefinition -> Maybe Double
maximum :: Maybe Double
        }
    | BooleanSchema
        { schemaType :: Text -- Always "boolean"
        , title :: Maybe Text
        , description :: Maybe Text
        , PrimitiveSchemaDefinition -> Maybe Bool
defaultValue :: Maybe Bool
        }
    | EnumSchema
        { schemaType :: Text -- Always "string"
        , title :: Maybe Text
        , description :: Maybe Text
        , PrimitiveSchemaDefinition -> [Text]
enum :: [Text]
        , PrimitiveSchemaDefinition -> Maybe [Text]
enumNames :: Maybe [Text] -- Display names for enum values
        }
    deriving stock (Int -> PrimitiveSchemaDefinition -> ShowS
[PrimitiveSchemaDefinition] -> ShowS
PrimitiveSchemaDefinition -> String
(Int -> PrimitiveSchemaDefinition -> ShowS)
-> (PrimitiveSchemaDefinition -> String)
-> ([PrimitiveSchemaDefinition] -> ShowS)
-> Show PrimitiveSchemaDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrimitiveSchemaDefinition -> ShowS
showsPrec :: Int -> PrimitiveSchemaDefinition -> ShowS
$cshow :: PrimitiveSchemaDefinition -> String
show :: PrimitiveSchemaDefinition -> String
$cshowList :: [PrimitiveSchemaDefinition] -> ShowS
showList :: [PrimitiveSchemaDefinition] -> ShowS
Show, PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool
(PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool)
-> (PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool)
-> Eq PrimitiveSchemaDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool
== :: PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool
$c/= :: PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool
/= :: PrimitiveSchemaDefinition -> PrimitiveSchemaDefinition -> Bool
Eq, (forall x.
 PrimitiveSchemaDefinition -> Rep PrimitiveSchemaDefinition x)
-> (forall x.
    Rep PrimitiveSchemaDefinition x -> PrimitiveSchemaDefinition)
-> Generic PrimitiveSchemaDefinition
forall x.
Rep PrimitiveSchemaDefinition x -> PrimitiveSchemaDefinition
forall x.
PrimitiveSchemaDefinition -> Rep PrimitiveSchemaDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
PrimitiveSchemaDefinition -> Rep PrimitiveSchemaDefinition x
from :: forall x.
PrimitiveSchemaDefinition -> Rep PrimitiveSchemaDefinition x
$cto :: forall x.
Rep PrimitiveSchemaDefinition x -> PrimitiveSchemaDefinition
to :: forall x.
Rep PrimitiveSchemaDefinition x -> PrimitiveSchemaDefinition
Generic)

instance ToJSON PrimitiveSchemaDefinition where
    toJSON :: PrimitiveSchemaDefinition -> Value
toJSON (StringSchema Text
ty Maybe Text
ttl Maybe Text
desc Maybe Int
minL Maybe Int
maxL Maybe Text
fmt) =
        [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
            [Key
"type" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ty]
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
t -> [Key
"title" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
t]) Maybe Text
ttl
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
d -> [Key
"description" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
d]) Maybe Text
desc
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Int
ml -> [Key
"minLength" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
ml]) Maybe Int
minL
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Int -> [Pair]) -> Maybe Int -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Int
mx -> [Key
"maxLength" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
mx]) Maybe Int
maxL
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
f -> [Key
"format" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
f]) Maybe Text
fmt
    toJSON (NumberSchema Text
ty Maybe Text
ttl Maybe Text
desc Maybe Double
minV Maybe Double
maxV) =
        [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
            [Key
"type" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ty]
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
t -> [Key
"title" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
t]) Maybe Text
ttl
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
d -> [Key
"description" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
d]) Maybe Text
desc
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Double -> [Pair]) -> Maybe Double -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
mn -> [Key
"minimum" Key -> Double -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Double
mn]) Maybe Double
minV
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Double -> [Pair]) -> Maybe Double -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
mx -> [Key
"maximum" Key -> Double -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Double
mx]) Maybe Double
maxV
    toJSON (BooleanSchema Text
ty Maybe Text
ttl Maybe Text
desc Maybe Bool
defVal) =
        [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
            [Key
"type" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ty]
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
t -> [Key
"title" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
t]) Maybe Text
ttl
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
d -> [Key
"description" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
d]) Maybe Text
desc
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Bool -> [Pair]) -> Maybe Bool -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Bool
dv -> [Key
"default" Key -> Bool -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Bool
dv]) Maybe Bool
defVal
    toJSON (EnumSchema Text
ty Maybe Text
ttl Maybe Text
desc [Text]
vals Maybe [Text]
names) =
        [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
            [ Key
"type" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
ty
            , Key
"enum" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Text]
vals
            ]
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
t -> [Key
"title" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
t]) Maybe Text
ttl
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Text
d -> [Key
"description" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
d]) Maybe Text
desc
                [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> ([Text] -> [Pair]) -> Maybe [Text] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\[Text]
en -> [Key
"enumNames" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Text]
en]) Maybe [Text]
names

instance FromJSON PrimitiveSchemaDefinition where
    parseJSON :: Value -> Parser PrimitiveSchemaDefinition
parseJSON = String
-> (Object -> Parser PrimitiveSchemaDefinition)
-> Value
-> Parser PrimitiveSchemaDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"PrimitiveSchemaDefinition" ((Object -> Parser PrimitiveSchemaDefinition)
 -> Value -> Parser PrimitiveSchemaDefinition)
-> (Object -> Parser PrimitiveSchemaDefinition)
-> Value
-> Parser PrimitiveSchemaDefinition
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Text
ty <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
        case Text
ty of
            Text
"string" -> do
                Maybe [Text]
enums <- Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"enum"
                case Maybe [Text]
enums of
                    Just [Text]
vals ->
                        Text
-> Maybe Text
-> Maybe Text
-> [Text]
-> Maybe [Text]
-> PrimitiveSchemaDefinition
EnumSchema Text
ty
                            (Maybe Text
 -> Maybe Text
 -> [Text]
 -> Maybe [Text]
 -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> [Text] -> Maybe [Text] -> PrimitiveSchemaDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title"
                            Parser
  (Maybe Text -> [Text] -> Maybe [Text] -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser ([Text] -> Maybe [Text] -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description"
                            Parser ([Text] -> Maybe [Text] -> PrimitiveSchemaDefinition)
-> Parser [Text]
-> Parser (Maybe [Text] -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [Text] -> Parser [Text]
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [Text]
vals
                            Parser (Maybe [Text] -> PrimitiveSchemaDefinition)
-> Parser (Maybe [Text]) -> Parser PrimitiveSchemaDefinition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"enumNames"
                    Maybe [Text]
Nothing ->
                        Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> PrimitiveSchemaDefinition
StringSchema Text
ty
                            (Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> PrimitiveSchemaDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title"
                            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int -> Maybe Int -> Maybe Text -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description"
                            Parser
  (Maybe Int -> Maybe Int -> Maybe Text -> PrimitiveSchemaDefinition)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Text -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minLength"
                            Parser (Maybe Int -> Maybe Text -> PrimitiveSchemaDefinition)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxLength"
                            Parser (Maybe Text -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text) -> Parser PrimitiveSchemaDefinition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"format"
            Text
"number" ->
                Text
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> PrimitiveSchemaDefinition
NumberSchema Text
ty
                    (Maybe Text
 -> Maybe Text
 -> Maybe Double
 -> Maybe Double
 -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title"
                    Parser
  (Maybe Text
   -> Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description"
                    Parser (Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minimum"
                    Parser (Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Double) -> Parser PrimitiveSchemaDefinition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maximum"
            Text
"integer" ->
                Text
-> Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Double
-> PrimitiveSchemaDefinition
NumberSchema Text
ty
                    (Maybe Text
 -> Maybe Text
 -> Maybe Double
 -> Maybe Double
 -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title"
                    Parser
  (Maybe Text
   -> Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description"
                    Parser (Maybe Double -> Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minimum"
                    Parser (Maybe Double -> PrimitiveSchemaDefinition)
-> Parser (Maybe Double) -> Parser PrimitiveSchemaDefinition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maximum"
            Text
"boolean" ->
                Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> PrimitiveSchemaDefinition
BooleanSchema Text
ty
                    (Maybe Text
 -> Maybe Text -> Maybe Bool -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Bool -> PrimitiveSchemaDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title"
                    Parser (Maybe Text -> Maybe Bool -> PrimitiveSchemaDefinition)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> PrimitiveSchemaDefinition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description"
                    Parser (Maybe Bool -> PrimitiveSchemaDefinition)
-> Parser (Maybe Bool) -> Parser PrimitiveSchemaDefinition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"default"
            Text
_ -> String -> Parser PrimitiveSchemaDefinition
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser PrimitiveSchemaDefinition)
-> String -> Parser PrimitiveSchemaDefinition
forall a b. (a -> b) -> a -> b
$ String
"Unknown schema type: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Text -> String
forall a. Show a => a -> String
show Text
ty

{- | Elicit request parameters.

Parameters for requesting additional information from the user via the client.
-}
data ElicitParams = ElicitParams
    { ElicitParams -> Text
message :: Text
    -- ^ The message to present to the user.
    , ElicitParams -> Map Text PrimitiveSchemaDefinition
requestedSchema :: Map Text PrimitiveSchemaDefinition
    {- ^ A restricted subset of JSON Schema. Only top-level properties are allowed,
    without nesting. The schema type is always "object" with properties.
    -}
    , ElicitParams -> Maybe [Text]
requiredFields :: Maybe [Text]
    -- ^ Required fields in the schema.
    }
    deriving stock (Int -> ElicitParams -> ShowS
[ElicitParams] -> ShowS
ElicitParams -> String
(Int -> ElicitParams -> ShowS)
-> (ElicitParams -> String)
-> ([ElicitParams] -> ShowS)
-> Show ElicitParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ElicitParams -> ShowS
showsPrec :: Int -> ElicitParams -> ShowS
$cshow :: ElicitParams -> String
show :: ElicitParams -> String
$cshowList :: [ElicitParams] -> ShowS
showList :: [ElicitParams] -> ShowS
Show, ElicitParams -> ElicitParams -> Bool
(ElicitParams -> ElicitParams -> Bool)
-> (ElicitParams -> ElicitParams -> Bool) -> Eq ElicitParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ElicitParams -> ElicitParams -> Bool
== :: ElicitParams -> ElicitParams -> Bool
$c/= :: ElicitParams -> ElicitParams -> Bool
/= :: ElicitParams -> ElicitParams -> Bool
Eq, (forall x. ElicitParams -> Rep ElicitParams x)
-> (forall x. Rep ElicitParams x -> ElicitParams)
-> Generic ElicitParams
forall x. Rep ElicitParams x -> ElicitParams
forall x. ElicitParams -> Rep ElicitParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ElicitParams -> Rep ElicitParams x
from :: forall x. ElicitParams -> Rep ElicitParams x
$cto :: forall x. Rep ElicitParams x -> ElicitParams
to :: forall x. Rep ElicitParams x -> ElicitParams
Generic)

instance ToJSON ElicitParams where
    toJSON :: ElicitParams -> Value
toJSON (ElicitParams Text
msg Map Text PrimitiveSchemaDefinition
schema Maybe [Text]
reqFields) =
        [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
            [ Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg
            , Key
"requestedSchema"
                Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Pair] -> Value
object
                    ( [ Key
"type" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"object" :: Text)
                      , Key
"properties" Key -> Map Text PrimitiveSchemaDefinition -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Map Text PrimitiveSchemaDefinition
schema
                      ]
                        [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<> [Pair] -> ([Text] -> [Pair]) -> Maybe [Text] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\[Text]
rf -> [Key
"required" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Text]
rf]) Maybe [Text]
reqFields
                    )
            ]

instance FromJSON ElicitParams where
    parseJSON :: Value -> Parser ElicitParams
parseJSON = String
-> (Object -> Parser ElicitParams) -> Value -> Parser ElicitParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject String
"ElicitParams" ((Object -> Parser ElicitParams) -> Value -> Parser ElicitParams)
-> (Object -> Parser ElicitParams) -> Value -> Parser ElicitParams
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Text
msg <- Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"message"
        Value
schema <- Object
o Object -> Key -> Parser Value
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"requestedSchema"
        (Map Text PrimitiveSchemaDefinition, Maybe [Text])
schemaProps <-
            String
-> (Object
    -> Parser (Map Text PrimitiveSchemaDefinition, Maybe [Text]))
-> Value
-> Parser (Map Text PrimitiveSchemaDefinition, Maybe [Text])
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject
                String
"requestedSchema"
                ( \Object
so -> do
                    Text
ty <- Object
so Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type"
                    if Text
ty Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== (Text
"object" :: Text)
                        then do
                            Map Text PrimitiveSchemaDefinition
props <- Object
so Object -> Key -> Parser (Map Text PrimitiveSchemaDefinition)
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"properties"
                            Maybe [Text]
reqFields <- Object
so Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"required"
                            (Map Text PrimitiveSchemaDefinition, Maybe [Text])
-> Parser (Map Text PrimitiveSchemaDefinition, Maybe [Text])
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Map Text PrimitiveSchemaDefinition
props, Maybe [Text]
reqFields)
                        else String -> Parser (Map Text PrimitiveSchemaDefinition, Maybe [Text])
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Expected requestedSchema type to be 'object'"
                )
                Value
schema
        ElicitParams -> Parser ElicitParams
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ElicitParams -> Parser ElicitParams)
-> ElicitParams -> Parser ElicitParams
forall a b. (a -> b) -> a -> b
$ Text
-> Map Text PrimitiveSchemaDefinition
-> Maybe [Text]
-> ElicitParams
ElicitParams Text
msg ((Map Text PrimitiveSchemaDefinition, Maybe [Text])
-> Map Text PrimitiveSchemaDefinition
forall a b. (a, b) -> a
fst (Map Text PrimitiveSchemaDefinition, Maybe [Text])
schemaProps) ((Map Text PrimitiveSchemaDefinition, Maybe [Text]) -> Maybe [Text]
forall a b. (a, b) -> b
snd (Map Text PrimitiveSchemaDefinition, Maybe [Text])
schemaProps)

-- | A request from the server to elicit additional information from the user via the client.
data ElicitRequest = ElicitRequest
    { ElicitRequest -> RequestId
id :: RequestId
    , ElicitRequest -> ElicitParams
params :: ElicitParams
    }
    deriving stock (Int -> ElicitRequest -> ShowS
[ElicitRequest] -> ShowS
ElicitRequest -> String
(Int -> ElicitRequest -> ShowS)
-> (ElicitRequest -> String)
-> ([ElicitRequest] -> ShowS)
-> Show ElicitRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ElicitRequest -> ShowS
showsPrec :: Int -> ElicitRequest -> ShowS
$cshow :: ElicitRequest -> String
show :: ElicitRequest -> String
$cshowList :: [ElicitRequest] -> ShowS
showList :: [ElicitRequest] -> ShowS
Show, ElicitRequest -> ElicitRequest -> Bool
(ElicitRequest -> ElicitRequest -> Bool)
-> (ElicitRequest -> ElicitRequest -> Bool) -> Eq ElicitRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ElicitRequest -> ElicitRequest -> Bool
== :: ElicitRequest -> ElicitRequest -> Bool
$c/= :: ElicitRequest -> ElicitRequest -> Bool
/= :: ElicitRequest -> ElicitRequest -> Bool
Eq, (forall x. ElicitRequest -> Rep ElicitRequest x)
-> (forall x. Rep ElicitRequest x -> ElicitRequest)
-> Generic ElicitRequest
forall x. Rep ElicitRequest x -> ElicitRequest
forall x. ElicitRequest -> Rep ElicitRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ElicitRequest -> Rep ElicitRequest x
from :: forall x. ElicitRequest -> Rep ElicitRequest x
$cto :: forall x. Rep ElicitRequest x -> ElicitRequest
to :: forall x. Rep ElicitRequest x -> ElicitRequest
Generic)
    deriving ([ElicitRequest] -> Value
[ElicitRequest] -> Encoding
ElicitRequest -> Bool
ElicitRequest -> Value
ElicitRequest -> Encoding
(ElicitRequest -> Value)
-> (ElicitRequest -> Encoding)
-> ([ElicitRequest] -> Value)
-> ([ElicitRequest] -> Encoding)
-> (ElicitRequest -> Bool)
-> ToJSON ElicitRequest
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: ElicitRequest -> Value
toJSON :: ElicitRequest -> Value
$ctoEncoding :: ElicitRequest -> Encoding
toEncoding :: ElicitRequest -> Encoding
$ctoJSONList :: [ElicitRequest] -> Value
toJSONList :: [ElicitRequest] -> Value
$ctoEncodingList :: [ElicitRequest] -> Encoding
toEncodingList :: [ElicitRequest] -> Encoding
$comitField :: ElicitRequest -> Bool
omitField :: ElicitRequest -> Bool
ToJSON, Maybe ElicitRequest
Value -> Parser [ElicitRequest]
Value -> Parser ElicitRequest
(Value -> Parser ElicitRequest)
-> (Value -> Parser [ElicitRequest])
-> Maybe ElicitRequest
-> FromJSON ElicitRequest
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser ElicitRequest
parseJSON :: Value -> Parser ElicitRequest
$cparseJSONList :: Value -> Parser [ElicitRequest]
parseJSONList :: Value -> Parser [ElicitRequest]
$comittedField :: Maybe ElicitRequest
omittedField :: Maybe ElicitRequest
FromJSON) via ViaJSONRPCRequest ElicitRequest

instance IsJSONRPCRequest ElicitRequest where
    requestMethod :: Proxy ElicitRequest -> Text
requestMethod Proxy ElicitRequest
_ = Text
"elicitation/create"

-- | The client's response to an elicitation request.
data ElicitResult = ElicitResult
    { ElicitResult -> Text
action :: Text
    {- ^ The user action in response to the elicitation.
    - "accept": User submitted the form/confirmed the action
    - "decline": User explicitly declined the action
    - "cancel": User dismissed without making an explicit choice
    -}
    , ElicitResult -> Maybe (Map Text Value)
content :: Maybe (Map Text Value)
    {- ^ The submitted form data, only present when action is "accept".
    Contains values matching the requested schema.
    -}
    , ElicitResult -> Maybe Metadata
_meta :: Maybe Metadata
    }
    deriving stock (Int -> ElicitResult -> ShowS
[ElicitResult] -> ShowS
ElicitResult -> String
(Int -> ElicitResult -> ShowS)
-> (ElicitResult -> String)
-> ([ElicitResult] -> ShowS)
-> Show ElicitResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ElicitResult -> ShowS
showsPrec :: Int -> ElicitResult -> ShowS
$cshow :: ElicitResult -> String
show :: ElicitResult -> String
$cshowList :: [ElicitResult] -> ShowS
showList :: [ElicitResult] -> ShowS
Show, ElicitResult -> ElicitResult -> Bool
(ElicitResult -> ElicitResult -> Bool)
-> (ElicitResult -> ElicitResult -> Bool) -> Eq ElicitResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ElicitResult -> ElicitResult -> Bool
== :: ElicitResult -> ElicitResult -> Bool
$c/= :: ElicitResult -> ElicitResult -> Bool
/= :: ElicitResult -> ElicitResult -> Bool
Eq, (forall x. ElicitResult -> Rep ElicitResult x)
-> (forall x. Rep ElicitResult x -> ElicitResult)
-> Generic ElicitResult
forall x. Rep ElicitResult x -> ElicitResult
forall x. ElicitResult -> Rep ElicitResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ElicitResult -> Rep ElicitResult x
from :: forall x. ElicitResult -> Rep ElicitResult x
$cto :: forall x. Rep ElicitResult x -> ElicitResult
to :: forall x. Rep ElicitResult x -> ElicitResult
Generic)

$(deriveJSON mcpParseOpts ''ElicitResult)