ExMCP.Types (ex_mcp v0.1.0)

View Source

Type definitions for the Model Context Protocol.

This module defines the core types used throughout ExMCP, matching the MCP specification.

Summary

Types

capabilities()

@type capabilities() :: %{
  optional(:tools) => map(),
  optional(:resources) => map(),
  optional(:prompts) => map(),
  optional(:logging) => map()
}

client_info()

@type client_info() :: %{name: String.t(), version: String.t()}

completion_argument()

@type completion_argument() :: %{name: String.t(), value: String.t()}

content_part()

@type content_part() :: text_content() | image_content() | resource_ref()

error_code()

@type error_code() :: -32700..-32600 | -32099..-32000

image_content()

@type image_content() :: %{type: String.t(), data: String.t(), mime_type: String.t()}

initialize_result()

@type initialize_result() :: %{
  protocolVersion: String.t(),
  serverInfo: server_info(),
  capabilities: capabilities()
}

json_schema()

@type json_schema() :: map()

log_level()

@type log_level() :: :debug | :info | :warning | :error

prompt()

@type prompt() :: %{
  :name => String.t(),
  optional(:description) => String.t(),
  optional(:arguments) => [prompt_argument()]
}

prompt_argument()

@type prompt_argument() :: %{
  :name => String.t(),
  optional(:description) => String.t(),
  optional(:required) => boolean()
}

prompt_content()

@type prompt_content() :: String.t() | [content_part()]

prompt_message()

@type prompt_message() :: %{role: String.t(), content: prompt_content()}

resource()

@type resource() :: %{
  :uri => String.t(),
  :name => String.t(),
  optional(:description) => String.t(),
  optional(:mime_type) => String.t()
}

resource_content()

@type resource_content() :: %{
  :uri => String.t(),
  optional(:mime_type) => String.t(),
  optional(:text) => String.t(),
  optional(:blob) => String.t()
}

resource_ref()

@type resource_ref() :: %{type: String.t(), resource: resource_content()}

server_info()

@type server_info() :: %{name: String.t(), version: String.t()}

text_content()

@type text_content() :: %{type: String.t(), text: String.t()}

tool()

@type tool() :: %{
  :name => String.t(),
  :description => String.t(),
  optional(:input_schema) => json_schema()
}

tool_result()

@type tool_result() :: [content_part()] | {:error, String.t()}

transport()

@type transport() :: :stdio | :sse | :websocket | module()