tools

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONSchemaForAccessMode

func NewJSONSchemaForAccessMode[T any](accessMode string) *jsonschema.Schema

NewJSONSchemaForAccessMode creates a JSONSchema from a Go struct, filtering fields based on access mode

Access tag examples:

  • access:"local" - only available for local access mode
  • access:"remote" - only available for remote access mode
  • access:"local,remote" - available for both local and remote access modes
  • no access tag - available in all access modes

The function uses comma-separated parsing, so you can specify multiple access modes.

Types

type AccessMode added in v1.5.0

type AccessMode string

AccessMode represents the security access level for MCP operations

const (
	// AccessModeLocal indicates the mode has local filesystem access and can execute local operations
	AccessModeLocal AccessMode = "local"
	// AccessModeRemote indicates the mode operates over network and has security restrictions
	AccessModeRemote AccessMode = "remote"
)

type AddUserToChannelArgs

type AddUserToChannelArgs struct {
	UserID    string `json:"user_id" jsonschema:"ID of the user to add"`
	ChannelID string `json:"channel_id" jsonschema:"ID of the channel to add user to"`
}

AddUserToChannelArgs represents arguments for the add_user_to_channel tool (dev mode only)

type AddUserToTeamArgs

type AddUserToTeamArgs struct {
	UserID string `json:"user_id" jsonschema:"ID of the user to add"`
	TeamID string `json:"team_id" jsonschema:"ID of the team to add user to"`
}

AddUserToTeamArgs represents arguments for the add_user_to_team tool (dev mode only)

type CreateChannelArgs

type CreateChannelArgs struct {
	Name        string `json:"name" jsonschema:"The channel name (URL-friendly),minLength=1,maxLength=64"`
	DisplayName string `json:"display_name" jsonschema:"The channel display name,minLength=1,maxLength=64"`
	Type        string `json:"type" jsonschema:"Channel type,enum=O,enum=P"`
	TeamID      string `json:"team_id" jsonschema:"The team ID where the channel will be created,minLength=26,maxLength=26"`
	Purpose     string `json:"purpose" jsonschema:"Optional channel purpose,maxLength=250"`
	Header      string `json:"header" jsonschema:"Optional channel header,maxLength=1024"`
}

CreateChannelArgs represents arguments for the create_channel tool

type CreatePostArgs

type CreatePostArgs struct {
	ChannelID   string   `json:"channel_id" jsonschema:"The ID of the channel to post in,minLength=26,maxLength=26"`
	Message     string   `json:"message" jsonschema:"The message content,minLength=1"`
	RootID      string   `json:"root_id,omitempty" jsonschema:"Optional root post ID for replies,minLength=26,maxLength=26"`
	Attachments []string `json:"attachments,omitempty" access:"local" jsonschema:"Optional list of file paths or URLs to attach to the post"`
}

CreatePostArgs represents arguments for the create_post tool

type CreatePostAsUserArgs

type CreatePostAsUserArgs struct {
	Username    string   `json:"username" jsonschema:"Username to login as"`
	Password    string   `json:"password" jsonschema:"Password to login with"`
	ChannelID   string   `json:"channel_id" jsonschema:"The ID of the channel to post in"`
	Message     string   `json:"message" jsonschema:"The message content"`
	RootID      string   `json:"root_id" jsonschema:"Optional root post ID for replies"`
	Props       string   `json:"props" jsonschema:"Optional post properties (JSON string)"`
	Attachments []string `json:"attachments,omitempty" access:"local" jsonschema:"Optional list of file paths or URLs to attach to the post"`
}

CreatePostAsUserArgs represents arguments for the create_post_as_user tool (dev mode only)

type CreateTeamArgs

type CreateTeamArgs struct {
	Name        string `json:"name" jsonschema:"URL name for the team,minLength=1,maxLength=64"`
	DisplayName string `json:"display_name" jsonschema:"Display name for the team,minLength=1,maxLength=64"`
	Type        string `json:"type" jsonschema:"Team type,enum=O,enum=I"`
	Description string `json:"description" jsonschema:"Team description,maxLength=255"`
	TeamIcon    string `` /* 126-byte string literal not displayed */
}

CreateTeamArgs represents arguments for the create_team tool (dev mode only)

type CreateUserArgs

type CreateUserArgs struct {
	Username     string `json:"username" jsonschema:"Username for the new user"`
	Email        string `json:"email" jsonschema:"Email address for the new user"`
	Password     string `json:"password" jsonschema:"Password for the new user"`
	FirstName    string `json:"first_name" jsonschema:"First name of the user"`
	LastName     string `json:"last_name" jsonschema:"Last name of the user"`
	Nickname     string `json:"nickname" jsonschema:"Nickname for the user"`
	ProfileImage string `` /* 136-byte string literal not displayed */
}

CreateUserArgs represents arguments for the create_user tool (dev mode only)

type DMSelfArgs

type DMSelfArgs struct {
	Message     string   `json:"message" jsonschema:"The message content to send to yourself,minLength=1"`
	Attachments []string `json:"attachments,omitempty" access:"local" jsonschema:"Optional list of file paths or URLs to attach to the message"`
}

DMSelfArgs represents arguments for the dm_self tool

type GetChannelInfoArgs

type GetChannelInfoArgs struct {
	ChannelID          string `json:"channel_id,omitempty" jsonschema:"The exact channel ID (fastest, most reliable method),maxLength=26"`
	ChannelDisplayName string `` /* 174-byte string literal not displayed */
	ChannelName        string `` /* 158-byte string literal not displayed */
	TeamID             string `` /* 153-byte string literal not displayed */
}

GetChannelInfoArgs represents arguments for the get_channel_info tool

type GetChannelMembersArgs

type GetChannelMembersArgs struct {
	ChannelID string `json:"channel_id" jsonschema:"ID of the channel to get members for,minLength=26,maxLength=26"`
	Limit     int    `json:"limit,omitempty" jsonschema:"Number of members to return (default: 50, max: 200),minimum=1,maximum=200"`
	Page      int    `json:"page,omitempty" jsonschema:"Page number for pagination (default: 0),minimum=0"`
}

GetChannelMembersArgs represents arguments for the get_channel_members tool

type GetTeamInfoArgs

type GetTeamInfoArgs struct {
	TeamID          string `json:"team_id,omitempty" jsonschema:"The exact team ID (fastest, most reliable method)"`
	TeamDisplayName string `json:"team_display_name,omitempty" jsonschema:"The human-readable display name users see (e.g. 'Engineering Team')"`
	TeamName        string `json:"team_name,omitempty" jsonschema:"The URL-friendly team name (e.g. 'engineering-team')"`
}

GetTeamInfoArgs represents arguments for the get_team_info tool

type GetTeamMembersArgs

type GetTeamMembersArgs struct {
	TeamID string `json:"team_id" jsonschema:"ID of the team to get members for,minLength=26,maxLength=26"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Number of members to return (default: 50, max: 200),minimum=1,maximum=200"`
	Page   int    `json:"page,omitempty" jsonschema:"Page number for pagination (default: 0),minimum=0"`
}

GetTeamMembersArgs represents arguments for the get_team_members tool

type MCPTool

type MCPTool struct {
	Name        string
	Description string
	Schema      *jsonschema.Schema
	Resolver    MCPToolResolver
}

MCPTool represents a tool specifically for MCP use with our custom context

type MCPToolContext

type MCPToolContext struct {
	Client     *model.Client4
	AccessMode AccessMode
}

MCPToolContext provides MCP-specific functionality with the authenticated client

type MCPToolResolver

type MCPToolResolver func(*MCPToolContext, llm.ToolArgumentGetter) (string, error)

MCPToolResolver defines the signature for MCP tool resolvers

type MattermostToolProvider

type MattermostToolProvider struct {
	// contains filtered or unexported fields
}

MattermostToolProvider provides Mattermost tools following the mmtools pattern

func NewMattermostToolProvider

func NewMattermostToolProvider(authProvider auth.AuthenticationProvider, logger logger.Logger, mmServerURL, mmInternalServerURL string, devMode bool, accessMode AccessMode) *MattermostToolProvider

NewMattermostToolProvider creates a new tool provider

func (*MattermostToolProvider) ProvideTools

func (p *MattermostToolProvider) ProvideTools(mcpServer *mcp.Server)

ProvideTools provides all tools to the MCP server by registering them

type ReadChannelArgs

type ReadChannelArgs struct {
	ChannelID string `json:"channel_id" jsonschema:"The ID of the channel to read from,minLength=26,maxLength=26"`
	Limit     int    `json:"limit,omitempty" jsonschema:"Number of posts to retrieve (default: 20, max: 100),minimum=1,maximum=100"`
	Since     string `json:"since,omitempty" jsonschema:"Only get posts since this timestamp (ISO 8601 format),format=date-time"`
}

ReadChannelArgs represents arguments for the read_channel tool

type ReadPostArgs

type ReadPostArgs struct {
	PostID        string `json:"post_id" jsonschema:"The ID of the post to read,minLength=26,maxLength=26"`
	IncludeThread bool   `json:"include_thread,omitempty" jsonschema:"Whether to include the entire thread (default: true)"`
}

ReadPostArgs represents arguments for the read_post tool

type SearchPostsArgs

type SearchPostsArgs struct {
	Query     string `json:"query" jsonschema:"The search query,minLength=1,maxLength=4000"`
	TeamID    string `json:"team_id,omitempty" jsonschema:"Optional team ID to limit search scope,minLength=26,maxLength=26"`
	ChannelID string `json:"channel_id,omitempty" jsonschema:"Optional channel ID to limit search to a specific channel,minLength=26,maxLength=26"`
	Limit     int    `json:"limit,omitempty" jsonschema:"Number of results to return (default: 20, max: 100),minimum=1,maximum=100"`
}

SearchPostsArgs represents arguments for the search_posts tool

type SearchUsersArgs

type SearchUsersArgs struct {
	Term  string `json:"term" jsonschema:"Search term (username, email, first name, or last name),minLength=1,maxLength=64"`
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum number of results to return (default: 20, max: 100),minimum=1,maximum=100"`
}

SearchUsersArgs represents arguments for the search_users tool

type ToolProvider

type ToolProvider interface {
	ProvideTools(*mcp.Server)
}

Jump to

Keyboard shortcuts

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