Documentation
¶
Index ¶
- Variables
- func DBWithOperator(ctx context.Context, db orm.DB) orm.DB
- func GetPrincipalFromContext(ctx context.Context) *security.Principal
- func MustSchemaFor[T any]() map[string]any
- func MustSchemaOf(v any) map[string]any
- func SchemaFor[T any]() map[string]any
- func SchemaOf(v any) map[string]any
- type Annotations
- type AudioContent
- type CallToolRequest
- type CallToolResult
- type Content
- type GetPromptParams
- type GetPromptRequest
- type GetPromptResult
- type ImageContent
- type Implementation
- type Prompt
- type PromptArgument
- type PromptDefinition
- type PromptHandler
- type PromptMessage
- type PromptProvider
- type ReadResourceRequest
- type ReadResourceResult
- type Resource
- type ResourceDefinition
- type ResourceHandler
- type ResourceProvider
- type ResourceTemplate
- type ResourceTemplateDefinition
- type ResourceTemplateProvider
- type Role
- type Server
- type ServerInfo
- type ServerOptions
- type ServerSession
- type TextContent
- type Tool
- type ToolDefinition
- type ToolHandler
- type ToolProvider
Constants ¶
This section is empty.
Variables ¶
var (
ResourceNotFoundError = mcp.ResourceNotFoundError
)
Function aliases.
Functions ¶
func DBWithOperator ¶
DBWithOperator returns a database connection with the operator ID bound from the MCP context.
func GetPrincipalFromContext ¶
GetPrincipalFromContext extracts the Principal from MCP request context.
func MustSchemaFor ¶
MustSchemaFor is like SchemaFor but panics on error.
func MustSchemaOf ¶
MustSchemaOf is like SchemaOf but panics on error.
func SchemaFor ¶
SchemaFor returns a JSON Schema for the type T. This follows the same naming convention as reflect.TypeFor.
The generated schema is suitable for use as MCP Tool.InputSchema or output schema.
Usage:
type MyInput struct {
Name string `json:"name" jsonschema:"required,description=The name"`
Age int `json:"age,omitempty" jsonschema:"minimum=0,maximum=150"`
}
schema := mcp.SchemaFor[MyInput]()
Supported jsonschema tags (use `jsonschema:"tag1,tag2=value"`):
Generic (all types):
- required: marks the field as required
- title=xxx: field title
- description=xxx: field description
- default=xxx: default value
- example=xxx: example value (can be repeated)
- enum=A,enum=B: enumeration values
- oneof_type=string;integer: field can be one of multiple types
- anyof_type=string;integer: field can be any of multiple types
String type:
- minLength=N: minimum string length
- maxLength=N: maximum string length
- pattern=xxx: regex pattern
- format=xxx: format hint (email, uri, uuid, date-time, date, time, ipv4, ipv6, etc.)
- readOnly=true: field is read-only
- writeOnly=true: field is write-only
Number/Integer type:
- minimum=N: minimum value
- maximum=N: maximum value
- exclusiveMinimum=N: exclusive minimum value
- exclusiveMaximum=N: exclusive maximum value
- multipleOf=N: value must be multiple of N
Array type:
- minItems=N: minimum array length
- maxItems=N: maximum array length
- uniqueItems=true: items must be unique
Additional tags:
- jsonschema_description:"xxx": standalone description tag
- jsonschema_extras:"a=b,c=d": add custom schema properties
Types ¶
type Annotations ¶
type Annotations = mcp.Annotations
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type AudioContent ¶
type AudioContent = mcp.AudioContent
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type CallToolRequest ¶
type CallToolRequest = mcp.CallToolRequest
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type CallToolResult ¶
type CallToolResult = mcp.CallToolResult
Type aliases for MCP SDK types - users don't need to import the SDK directly.
func NewToolResultError ¶
func NewToolResultError(errMsg string) *CallToolResult
NewToolResultError creates a CallToolResult indicating an error.
func NewToolResultText ¶
func NewToolResultText(text string) *CallToolResult
NewToolResultText creates a CallToolResult with text content.
type GetPromptParams ¶
type GetPromptParams = mcp.GetPromptParams
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type GetPromptRequest ¶
type GetPromptRequest = mcp.GetPromptRequest
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type GetPromptResult ¶
type GetPromptResult = mcp.GetPromptResult
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ImageContent ¶
type ImageContent = mcp.ImageContent
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type Implementation ¶
type Implementation = mcp.Implementation
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type PromptArgument ¶
type PromptArgument = mcp.PromptArgument
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type PromptDefinition ¶
type PromptDefinition struct {
Prompt *Prompt
Handler PromptHandler
}
PromptDefinition defines a prompt and its handler.
type PromptHandler ¶
type PromptHandler = mcp.PromptHandler
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type PromptMessage ¶
type PromptMessage = mcp.PromptMessage
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type PromptProvider ¶
type PromptProvider interface {
// Prompts returns the list of prompt definitions this provider registers.
Prompts() []PromptDefinition
}
PromptProvider provides MCP prompts to the server.
type ReadResourceRequest ¶
type ReadResourceRequest = mcp.ReadResourceRequest
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ReadResourceResult ¶
type ReadResourceResult = mcp.ReadResourceResult
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ResourceDefinition ¶
type ResourceDefinition struct {
Resource *Resource
Handler ResourceHandler
}
ResourceDefinition defines a static resource and its handler.
type ResourceHandler ¶
type ResourceHandler = mcp.ResourceHandler
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ResourceProvider ¶
type ResourceProvider interface {
// Resources returns the list of static resource definitions this provider registers.
Resources() []ResourceDefinition
}
ResourceProvider provides static MCP resources to the server.
type ResourceTemplate ¶
type ResourceTemplate = mcp.ResourceTemplate
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ResourceTemplateDefinition ¶
type ResourceTemplateDefinition struct {
Template *ResourceTemplate
Handler ResourceHandler
}
ResourceTemplateDefinition defines a dynamic resource template and its handler.
type ResourceTemplateProvider ¶
type ResourceTemplateProvider interface {
// ResourceTemplates returns the list of resource template definitions this provider registers.
ResourceTemplates() []ResourceTemplateDefinition
}
ResourceTemplateProvider provides dynamic MCP resource templates to the server.
type ServerInfo ¶
ServerInfo configures MCP server identification.
type ServerOptions ¶
type ServerOptions = mcp.ServerOptions
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ServerSession ¶
type ServerSession = mcp.ServerSession
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type TextContent ¶
type TextContent = mcp.TextContent
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ToolDefinition ¶
type ToolDefinition struct {
Tool *Tool
Handler ToolHandler
}
ToolDefinition defines a tool and its handler.
type ToolHandler ¶
type ToolHandler = mcp.ToolHandler
Type aliases for MCP SDK types - users don't need to import the SDK directly.
type ToolProvider ¶
type ToolProvider interface {
// Tools returns the list of tool definitions this provider registers.
Tools() []ToolDefinition
}
ToolProvider provides MCP tools to the server.