mcptools

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerName        = "kalshi-kernel"
	ServerVersion     = "0.1.0"
	ServerDescription = "Safety-focused Kalshi event-contract and perpetuals trading kernel."
)

Variables

View Source
var SourcesByTool = map[string][]Source{
	"kernel_status": {},
	"search_markets": {
		{Spec: "trade", OperationID: "GetMarkets", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginMarkets", Channel: ""},
	},
	"get_market": {
		{Spec: "trade", OperationID: "GetMarket", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginMarket", Channel: ""},
	},
	"get_orderbook": {
		{Spec: "trade", OperationID: "GetMarketOrderbook", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginMarketOrderbook", Channel: ""},
		{Spec: "market_data_ws", OperationID: "", Channel: "orderbook_delta"},
		{Spec: "perps_ws", OperationID: "", Channel: "orderbook_delta"},
	},
	"get_portfolio": {
		{Spec: "trade", OperationID: "GetBalance", Channel: ""},
		{Spec: "trade", OperationID: "GetPositions", Channel: ""},
		{Spec: "trade", OperationID: "GetOrders", Channel: ""},
		{Spec: "trade", OperationID: "GetFills", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginBalance", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginPositions", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginOrders", Channel: ""},
		{Spec: "perps", OperationID: "GetMarginFills", Channel: ""},
	},
	"place_order": {
		{Spec: "trade", OperationID: "CreateOrderV2", Channel: ""},
		{Spec: "perps", OperationID: "CreateMarginOrder", Channel: ""},
	},
	"amend_order": {
		{Spec: "trade", OperationID: "AmendOrderV2", Channel: ""},
		{Spec: "perps", OperationID: "AmendMarginOrder", Channel: ""},
	},
	"cancel_order": {
		{Spec: "trade", OperationID: "CancelOrderV2", Channel: ""},
		{Spec: "perps", OperationID: "CancelMarginOrder", Channel: ""},
	},
}

Functions

func Register

func Register(server *mcp.Server, handler Handler)

Types

type AmendOrderInput

type AmendOrderInput struct {
	Product              string  `json:"product" jsonschema:"Product family containing the order. Allowed values: event, perp."`
	OrderID              string  `json:"order_id" jsonschema:"Exchange or paper order identifier."`
	Ticker               string  `json:"ticker" jsonschema:"Exact market ticker used for routing and validation."`
	Side                 string  `json:"side" jsonschema:"Existing single-book order side required by the upstream amend operation. Allowed values: bid, ask."`
	Price                string  `json:"price" jsonschema:"Desired fixed-point dollar price; pass the existing value when changing only quantity."`
	Count                string  `json:"count" jsonschema:"Desired total maximum fillable quantity; pass the existing value when changing only price."`
	ClientOrderID        *string `json:"client_order_id,omitempty" jsonschema:"Existing client order identifier."`
	UpdatedClientOrderID *string `json:"updated_client_order_id,omitempty" jsonschema:"New idempotency identifier for the amended order."`
	Subaccount           *int    `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}

AmendOrderInput is generated from specs/mcp-tools.yaml.

type CancelOrderInput

type CancelOrderInput struct {
	Product    string `json:"product" jsonschema:"Product family containing the order. Allowed values: event, perp."`
	OrderID    string `json:"order_id" jsonschema:"Exchange or paper order identifier."`
	Ticker     string `json:"ticker" jsonschema:"Exact market ticker used for routing and validation."`
	Subaccount *int   `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}

CancelOrderInput is generated from specs/mcp-tools.yaml.

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type GetMarketInput

type GetMarketInput struct {
	Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
	Ticker  string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
}

GetMarketInput is generated from specs/mcp-tools.yaml.

type GetOrderbookInput

type GetOrderbookInput struct {
	Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
	Ticker  string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
	Depth   *int   `json:"depth,omitempty" jsonschema:"Maximum price levels to return on each side. Minimum: 1. Maximum: 100."`
}

GetOrderbookInput is generated from specs/mcp-tools.yaml.

type GetPortfolioInput

type GetPortfolioInput struct {
	Product    string `json:"product" jsonschema:"Product family to report. Allowed values: event, perp."`
	Subaccount *int   `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}

GetPortfolioInput is generated from specs/mcp-tools.yaml.

type KernelStatusInput

type KernelStatusInput struct {
}

KernelStatusInput is generated from specs/mcp-tools.yaml.

type PlaceOrderInput

type PlaceOrderInput struct {
	Product                 string  `json:"product" jsonschema:"Product family containing the market. Allowed values: event, perp."`
	Ticker                  string  `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
	ClientOrderID           *string `` /* 131-byte string literal not displayed */
	Side                    string  `json:"side" jsonschema:"Single-book order side. Allowed values: bid, ask."`
	Count                   string  `json:"count" jsonschema:"Fixed-point contract quantity encoded as a decimal string."`
	Price                   string  `json:"price" jsonschema:"Fixed-point dollar price encoded as a decimal string."`
	TimeInForce             string  `` /* 135-byte string literal not displayed */
	ExpirationTime          *int64  `json:"expiration_time,omitempty" jsonschema:"Optional Unix time in seconds; only valid with good_till_canceled."`
	PostOnly                *bool   `json:"post_only,omitempty" jsonschema:"Reject rather than immediately take liquidity."`
	ReduceOnly              *bool   `json:"reduce_only,omitempty" jsonschema:"Prevent the order from increasing exposure."`
	CancelOrderOnPause      *bool   `json:"cancel_order_on_pause,omitempty" jsonschema:"Cancel the resting order if exchange trading pauses."`
	SelfTradePreventionType string  `json:"self_trade_prevention_type" jsonschema:"Exchange self-trade prevention policy. Allowed values: taker_at_cross, maker."`
	Subaccount              *int    `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}

PlaceOrderInput is generated from specs/mcp-tools.yaml.

type Response

type Response struct {
	Mode  string         `json:"mode"`
	OK    bool           `json:"ok"`
	Data  map[string]any `json:"data,omitempty"`
	Error *Error         `json:"error,omitempty"`
}

type SearchMarketsInput

type SearchMarketsInput struct {
	Product      string   `json:"product" jsonschema:"Product family to search. Allowed values: event, perp."`
	Tickers      []string `json:"tickers,omitempty" jsonschema:"Exact market tickers to include."`
	EventTicker  *string  `json:"event_ticker,omitempty" jsonschema:"Restrict event contracts to one event."`
	SeriesTicker *string  `json:"series_ticker,omitempty" jsonschema:"Restrict event contracts to one series."`
	Status       *string  `json:"status,omitempty" jsonschema:"Exchange market status filter."`
	Limit        *int     `json:"limit,omitempty" jsonschema:"Maximum number of markets to return. Minimum: 1. Maximum: 1000."`
	Cursor       *string  `json:"cursor,omitempty" jsonschema:"Pagination cursor returned by a previous call."`
}

SearchMarketsInput is generated from specs/mcp-tools.yaml.

type Source

type Source struct {
	Spec        string `json:"spec"`
	OperationID string `json:"operation_id,omitempty"`
	Channel     string `json:"channel,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL