Documentation
¶
Index ¶
- Constants
- func BoolArg(arguments map[string]any, key string) (bool, bool, error)
- func BuildToolErrorResult(message string) map[string]any
- func BuildToolSuccessResult(structured any) map[string]any
- func ContextWithServerName(ctx context.Context, sn string) context.Context
- func IntArg(arguments map[string]any, key string) (int, bool, error)
- func ServerNameFromContext(ctx context.Context) string
- func StringArg(arguments map[string]any, key string) string
- type HeaderCate
- func (z *HeaderCate) Decode(s string) error
- func (z HeaderCate) Has(o HeaderCate) bool
- func (z HeaderCate) HasAuthorization() bool
- func (z HeaderCate) HasOwnerSession() bool
- func (z HeaderCate) MarshalText() ([]byte, error)
- func (z HeaderCate) String() string
- func (z *HeaderCate) UnmarshalText(b []byte) error
- type HeaderFunc
- type Invoker
- type Server
- type ServerBasic
- type ServerSet
- type Servers
- type Status
- type ToolCallPayload
- type ToolDescriptor
- type ToolNames
- type TransType
Constants ¶
View Source
const ( ServerTable = "mcp_server" ServerAlias = "ms" ServerLabel = "server" ServerTypID = "mcpsServer" )
consts of Server 服务器
Variables ¶
This section is empty.
Functions ¶
func BuildToolErrorResult ¶
BuildToolErrorResult 构建标准的 MCP 工具错误结果
func BuildToolSuccessResult ¶
BuildToolSuccessResult 构建标准的 MCP 工具成功结果
func ContextWithServerName ¶ added in v0.2.4
func ServerNameFromContext ¶ added in v0.2.4
Types ¶
type HeaderCate ¶ added in v0.2.4
type HeaderCate int8
头类型
const ( HeaderCateAuthorization HeaderCate = 1 << iota // 1 Authorization HeaderCateOwnerID // 2 OwnerID HeaderCateSessionID // 4 SessionID HeaderCateNone HeaderCate = 0 // None )
func (*HeaderCate) Decode ¶ added in v0.2.4
func (z *HeaderCate) Decode(s string) error
func (HeaderCate) Has ¶ added in v0.2.4
func (z HeaderCate) Has(o HeaderCate) bool
func (HeaderCate) HasAuthorization ¶ added in v0.2.4
func (z HeaderCate) HasAuthorization() bool
func (HeaderCate) HasOwnerSession ¶ added in v0.2.4
func (z HeaderCate) HasOwnerSession() bool
func (HeaderCate) MarshalText ¶ added in v0.2.4
func (z HeaderCate) MarshalText() ([]byte, error)
func (HeaderCate) String ¶ added in v0.2.4
func (z HeaderCate) String() string
func (*HeaderCate) UnmarshalText ¶ added in v0.2.4
func (z *HeaderCate) UnmarshalText(b []byte) error
type Server ¶
type Server struct {
comm.BaseModel `bun:"table:mcp_server,alias:ms" json:"-"`
comm.DefaultModel
ServerBasic
// 定制头函数
HeaderFunc HeaderFunc `bson:"-" bun:"-" extensions:"x-order=I" json:"-" pg:"-"`
comm.MetaField
} // @name mcpsServer
Server 服务器
func NewServerWithBasic ¶
func NewServerWithBasic(in ServerBasic) *Server
func NewServerWithID ¶
func (*Server) IdentityAlias ¶
func (*Server) IdentityLabel ¶
func (*Server) IdentityModel ¶
func (*Server) IdentityTable ¶
type ServerBasic ¶
type ServerBasic struct {
// 名称
Name string `` /* 140-byte string literal not displayed */
// 传输类型
// * `stdIO` - 标准IO
// * `sse`
// * `streamable`
// * `inMemory` - 内部运行
TransType TransType `` /* 189-byte string literal not displayed */
// 指令 仅对 TransType 为 StdIO 时有效
Command string `bson:"command" bun:",notnull" extensions:"x-order=C" form:"command" json:"command" pg:",notnull"`
// 完整网址 仅对 TransType 为 SSE 或 HTTP 时有效
URL string `bson:"url" bun:",notnull" extensions:"x-order=D" form:"url" json:"url" pg:",notnull"`
// 是否激活
IsActive bool `bson:"isActive" bun:",notnull" extensions:"x-order=E" form:"isActive" json:"isActive" pg:",notnull"`
// 连接状态
// * `disconnected` - 断开
// * `connecting` - 连接中
// * `connected` - 已连接
Status Status `` /* 184-byte string literal not displayed */
// 备注
Remark string `bson:"remark" bun:",notnull" extensions:"x-order=G" form:"remark" json:"remark" pg:",notnull"`
// 头分类
// * `authorization`
// * `ownerID`
// * `sessionID`
HeaderCate HeaderCate `` /* 176-byte string literal not displayed */
// for meta update
MetaDiff *comm.MetaDiff `bson:"-" bun:"-" json:"metaUp,omitempty" pg:"-" swaggerignore:"true"`
} // @name mcpsServerBasic
func (*ServerBasic) MetaAddKVs ¶
func (in *ServerBasic) MetaAddKVs(args ...any) *ServerBasic
type ServerSet ¶
type ServerSet struct {
// 名称
Name *string `extensions:"x-order=A" json:"name"`
// 传输类型
// * `stdIO` - 标准IO
// * `sse`
// * `streamable`
// * `inMemory` - 内部运行
TransType *TransType `enums:"stdIO,sse,streamable,inMemory" extensions:"x-order=B" json:"transType" swaggertype:"string"`
// 指令 仅对 TransType 为 StdIO 时有效
Command *string `extensions:"x-order=C" json:"command"`
// 完整网址 仅对 TransType 为 SSE 或 HTTP 时有效
URL *string `extensions:"x-order=D" json:"url"`
// 是否激活
IsActive *bool `extensions:"x-order=E" json:"isActive"`
// 连接状态
// * `disconnected` - 断开
// * `connecting` - 连接中
// * `connected` - 已连接
Status *Status `enums:"disconnected,connecting,connected" extensions:"x-order=F" json:"status" swaggertype:"string"`
// 备注
Remark *string `extensions:"x-order=G" json:"remark"`
// 头分类
// * `authorization`
// * `ownerID`
// * `sessionID`
HeaderCate *HeaderCate `enums:"authorization,ownerID,sessionID" extensions:"x-order=H" json:"headerCate" swaggertype:"string"`
// for meta update
MetaDiff *comm.MetaDiff `json:"metaUp,omitempty" swaggerignore:"true"`
} // @name mcpsServerSet
func (*ServerSet) MetaAddKVs ¶
type ToolCallPayload ¶
type ToolCallPayload struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments"`
}
ToolCallPayload 是 MCP tools/call 的参数
type ToolDescriptor ¶
type ToolDescriptor struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema map[string]any `json:"inputSchema"`
}
ToolDescriptor 是工具的描述符,用于 MCP 工具列表
type TransType ¶
type TransType int8
MCP 传输类型
func (TransType) MarshalText ¶
func (*TransType) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.