Copyright | (C) 2025 Matthias Pall Gissurarson |
---|---|
License | MIT |
Maintainer | mpg@mpg.is |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
MCP.Types
Description
This module defines the core types used in the Model Context Protocol (MCP), including JSON-RPC message types, client/server capabilities, resources, tools, prompts, and various request/response types.
Synopsis
- newtype RequestId = RequestId Value
- data Role
- newtype Cursor = Cursor Text
- newtype ProgressToken = ProgressToken Value
- data LoggingLevel
- data Annotations = Annotations {}
- data TextContent = TextContent {
- textType :: Text
- text :: Text
- annotations :: Maybe Annotations
- data ImageContent = ImageContent {
- imageType :: Text
- data' :: Text
- mimeType :: Text
- annotations :: Maybe Annotations
- data AudioContent = AudioContent {
- audioType :: Text
- data' :: Text
- mimeType :: Text
- annotations :: Maybe Annotations
- data EmbeddedResource = EmbeddedResource {}
- data Content
- data ResourceContents
- data TextResourceContents = TextResourceContents {}
- data BlobResourceContents = BlobResourceContents {}
- data Resource = Resource {}
- data ResourceTemplate = ResourceTemplate {
- name :: Text
- uriTemplate :: Text
- description :: Maybe Text
- mimeType :: Maybe Text
- annotations :: Maybe Annotations
- data ResourceReference = ResourceReference {}
- data ToolAnnotations = ToolAnnotations {}
- data Tool = Tool {}
- data InputSchema = InputSchema {
- schemaType :: Text
- properties :: Maybe (Map Text Value)
- required :: Maybe [Text]
- data PromptArgument = PromptArgument {}
- data Prompt = Prompt {
- name :: Text
- description :: Maybe Text
- arguments :: Maybe [PromptArgument]
- data PromptMessage = PromptMessage {}
- data PromptReference = PromptReference {}
- data ModelHint = ModelHint {}
- data ModelPreferences = ModelPreferences {}
- data IncludeContext
- = AllServers
- | None
- | ThisServer
- data SamplingMessage = SamplingMessage {}
- data ClientCapabilities = ClientCapabilities {}
- data ServerCapabilities = ServerCapabilities {}
- data RootsCapability = RootsCapability {
- listChanged :: Maybe Bool
- data PromptsCapability = PromptsCapability {
- listChanged :: Maybe Bool
- data ResourcesCapability = ResourcesCapability {}
- data ToolsCapability = ToolsCapability {
- listChanged :: Maybe Bool
- data CompletionsCapability = CompletionsCapability
- data LoggingCapability = LoggingCapability
- data SamplingCapability = SamplingCapability
- newtype ExperimentalCapability = ExperimentalCapability (Map Text Value)
- data Implementation = Implementation {}
- data Root = Root {}
- data Result = Result {}
- newtype Metadata = Metadata (Map Text Value)
Basic Types
A uniquely identifying ID for a request in JSON-RPC
The sender or recipient of messages and data in a conversation
An opaque token used to represent a cursor for pagination
newtype ProgressToken Source #
A progress token, used to associate progress notifications with the original request
Constructors
ProgressToken Value |
Instances
FromJSON ProgressToken Source # | |
Defined in MCP.Types Methods parseJSON :: Value -> Parser ProgressToken # parseJSONList :: Value -> Parser [ProgressToken] # | |
ToJSON ProgressToken Source # | |
Defined in MCP.Types Methods toJSON :: ProgressToken -> Value # toEncoding :: ProgressToken -> Encoding # toJSONList :: [ProgressToken] -> Value # toEncodingList :: [ProgressToken] -> Encoding # omitField :: ProgressToken -> Bool # | |
Show ProgressToken Source # | |
Defined in MCP.Types Methods showsPrec :: Int -> ProgressToken -> ShowS # show :: ProgressToken -> String # showList :: [ProgressToken] -> ShowS # | |
Eq ProgressToken Source # | |
Defined in MCP.Types Methods (==) :: ProgressToken -> ProgressToken -> Bool # (/=) :: ProgressToken -> ProgressToken -> Bool # |
data LoggingLevel Source #
The severity of a log message
Instances
Content Types
data Annotations Source #
Optional annotations for the client
Instances
FromJSON Annotations Source # | |
Defined in MCP.Types | |
ToJSON Annotations Source # | |
Defined in MCP.Types Methods toJSON :: Annotations -> Value # toEncoding :: Annotations -> Encoding # toJSONList :: [Annotations] -> Value # toEncodingList :: [Annotations] -> Encoding # omitField :: Annotations -> Bool # | |
Generic Annotations Source # | |
Show Annotations Source # | |
Defined in MCP.Types Methods showsPrec :: Int -> Annotations -> ShowS # show :: Annotations -> String # showList :: [Annotations] -> ShowS # | |
Eq Annotations Source # | |
Defined in MCP.Types | |
type Rep Annotations Source # | |
Defined in MCP.Types type Rep Annotations = D1 ('MetaData "Annotations" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Annotations" 'PrefixI 'True) (S1 ('MetaSel ('Just "audience") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Role])) :*: S1 ('MetaSel ('Just "priority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double)))) |
data TextContent Source #
Text provided to or from an LLM
Constructors
TextContent | |
Fields
|
Instances
data ImageContent Source #
An image provided to or from an LLM
Constructors
ImageContent | |
Fields
|
Instances
data AudioContent Source #
Audio provided to or from an LLM
Constructors
AudioContent | |
Fields
|
Instances
data EmbeddedResource Source #
The contents of a resource, embedded into a prompt or tool call result
Constructors
EmbeddedResource | |
Fields |
Instances
Content that can be text, image, audio, or embedded resource
Constructors
TextContentType TextContent | |
ImageContentType ImageContent | |
AudioContentType AudioContent | |
EmbeddedResourceType EmbeddedResource |
Instances
FromJSON Content Source # | |
ToJSON Content Source # | |
Generic Content Source # | |
Show Content Source # | |
Eq Content Source # | |
type Rep Content Source # | |
Defined in MCP.Types type Rep Content = D1 ('MetaData "Content" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) ((C1 ('MetaCons "TextContentType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TextContent)) :+: C1 ('MetaCons "ImageContentType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ImageContent))) :+: (C1 ('MetaCons "AudioContentType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AudioContent)) :+: C1 ('MetaCons "EmbeddedResourceType" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EmbeddedResource)))) |
Resource Types
data ResourceContents Source #
Resource contents (text or blob)
Instances
data TextResourceContents Source #
Text resource contents
Instances
data BlobResourceContents Source #
Blob resource contents
Instances
A known resource that the server is capable of reading
Constructors
Resource | |
Instances
FromJSON Resource Source # | |
ToJSON Resource Source # | |
Generic Resource Source # | |
Show Resource Source # | |
Eq Resource Source # | |
type Rep Resource Source # | |
Defined in MCP.Types type Rep Resource = D1 ('MetaData "Resource" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Resource" 'PrefixI 'True) ((S1 ('MetaSel ('Just "uri") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) :*: (S1 ('MetaSel ('Just "mimeType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "size") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "annotations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Annotations)))))) |
data ResourceTemplate Source #
A template description for resources available on the server
Constructors
ResourceTemplate | |
Fields
|
Instances
data ResourceReference Source #
A reference to a resource or resource template definition
Constructors
ResourceReference | |
Instances
Tool Types
data ToolAnnotations Source #
Additional properties describing a Tool to clients
Constructors
ToolAnnotations | |
Fields
|
Instances
Definition for a tool the client can call
Constructors
Tool | |
Fields
|
Instances
FromJSON Tool Source # | |
ToJSON Tool Source # | |
Generic Tool Source # | |
Show Tool Source # | |
Eq Tool Source # | |
type Rep Tool Source # | |
Defined in MCP.Types type Rep Tool = D1 ('MetaData "Tool" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Tool" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "inputSchema") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InputSchema) :*: S1 ('MetaSel ('Just "annotations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ToolAnnotations))))) |
data InputSchema Source #
Input schema for a tool
Constructors
InputSchema | |
Fields
|
Instances
Prompt Types
data PromptArgument Source #
Describes an argument that a prompt can accept
Constructors
PromptArgument | |
Instances
A prompt or prompt template that the server offers
Constructors
Prompt | |
Fields
|
Instances
FromJSON Prompt Source # | |
ToJSON Prompt Source # | |
Generic Prompt Source # | |
Show Prompt Source # | |
Eq Prompt Source # | |
type Rep Prompt Source # | |
Defined in MCP.Types type Rep Prompt = D1 ('MetaData "Prompt" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Prompt" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "arguments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [PromptArgument]))))) |
data PromptMessage Source #
Describes a message returned as part of a prompt
Constructors
PromptMessage | |
Instances
data PromptReference Source #
Identifies a prompt
Constructors
PromptReference | |
Instances
Model Types
Hints to use for model selection
data ModelPreferences Source #
The server's preferences for model selection
Constructors
ModelPreferences | |
Fields
|
Instances
data IncludeContext Source #
Include context options for sampling
Constructors
AllServers | |
None | |
ThisServer |
Instances
data SamplingMessage Source #
Describes a message issued to or received from an LLM API
Constructors
SamplingMessage | |
Instances
Capability Types
data ClientCapabilities Source #
Capabilities a client may support
Constructors
ClientCapabilities | |
Instances
data ServerCapabilities Source #
Capabilities that a server may support
Constructors
ServerCapabilities | |
Instances
data RootsCapability Source #
Roots capability
Constructors
RootsCapability | |
Fields
|
Instances
data PromptsCapability Source #
Prompts capability
Constructors
PromptsCapability | |
Fields
|
Instances
data ResourcesCapability Source #
Resources capability
Constructors
ResourcesCapability | |
Instances
data ToolsCapability Source #
Tools capability
Constructors
ToolsCapability | |
Fields
|
Instances
data CompletionsCapability Source #
Completions capability
Constructors
CompletionsCapability |
Instances
data LoggingCapability Source #
Logging capability
Constructors
LoggingCapability |
Instances
data SamplingCapability Source #
Sampling capability
Constructors
SamplingCapability |
Instances
newtype ExperimentalCapability Source #
Experimental capability
Constructors
ExperimentalCapability (Map Text Value) |
Instances
Implementation Info
data Implementation Source #
Describes the name and version of an MCP implementation
Constructors
Implementation | |
Instances
Roots
Represents a root directory or file that the server can operate on
Instances
FromJSON Root Source # | |
ToJSON Root Source # | |
Generic Root Source # | |
Show Root Source # | |
Eq Root Source # | |
type Rep Root Source # | |
Defined in MCP.Types type Rep Root = D1 ('MetaData "Root" "MCP.Types" "mcp-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Root" 'PrefixI 'True) (S1 ('MetaSel ('Just "uri") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) |
Result Types
Base result type