dynamic

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dynamic registers the low-token dynamic toolset for GitLab actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStandaloneCatalog

func AddStandaloneCatalog(catalog *actionregistry.Catalog, client *gitlabclient.Client, opts StandaloneOptions) (*actionregistry.Catalog, error)

AddStandaloneCatalog adds non-meta standalone tools to the canonical dynamic action catalog so dynamic mode can execute them without increasing the visible tool count.

func AddStandaloneRoutes

func AddStandaloneRoutes(routes map[string]toolutil.ActionMap, client *gitlabclient.Client, opts StandaloneOptions) (map[string]toolutil.ActionMap, error)

AddStandaloneRoutes adds non-meta standalone tools to the canonical dynamic action catalog so dynamic mode can still execute them through gitlab_execute_tool without increasing the visible tool count.

func NormalizeActionScopedParams

func NormalizeActionScopedParams(actionID string, params, schema map[string]any) map[string]any

NormalizeActionScopedParams applies compatibility aliases that are safe only for a specific dynamic catalog action.

func RegisterCatalogFindExecuteTools

func RegisterCatalogFindExecuteTools(server *mcp.Server, catalog *actionregistry.Catalog)

RegisterCatalogFindExecuteTools registers the experimental two-tool dynamic catalog from the canonical action catalog.

func RegisterCatalogTools

func RegisterCatalogTools(server *mcp.Server, catalog *actionregistry.Catalog)

RegisterCatalogTools registers the dynamic search, describe, and execute tools from the canonical action catalog.

Types

type ActionDescription

type ActionDescription struct {
	ID             string         `json:"id" jsonschema:"Canonical action ID."`
	Tool           string         `json:"tool" jsonschema:"Backing meta-tool name."`
	Domain         string         `json:"domain" jsonschema:"Canonical action domain."`
	Action         string         `json:"action" jsonschema:"Action name inside the catalog group."`
	SchemaURI      string         `json:"schema_uri" jsonschema:"MCP resource URI for the action parameter schema."`
	Destructive    bool           `json:"destructive" jsonschema:"Whether this action requires explicit confirmation."`
	RequiredParams []string       `json:"required_params,omitempty" jsonschema:"Required parameter names captured from the input schema."`
	Usage          string         `json:"usage,omitempty" jsonschema:"Short disambiguation note for commonly confused actions."`
	InputSchema    map[string]any `json:"input_schema" jsonschema:"Exact JSON Schema for action-specific params."`
	OutputSchema   map[string]any `json:"output_schema,omitempty" jsonschema:"Best-effort JSON Schema for the action result."`
	Example        ActionExample  `json:"example" jsonschema:"Example gitlab_execute_tool call."`
}

ActionDescription describes one GitLab catalog action.

type ActionExample

type ActionExample struct {
	Tool      string         `json:"tool" jsonschema:"Tool to call for execution."`
	Arguments map[string]any `json:"arguments" jsonschema:"Example arguments for gitlab_execute_tool."`
}

ActionExample shows how to call gitlab_execute_tool for an action.

type DescribeInput

type DescribeInput struct {
	Action  string   `json:"action,omitempty" jsonschema:"Canonical action ID to describe, such as project.create. Use either action or actions."`
	Actions []string `json:"actions,omitempty" jsonschema:"Canonical action IDs to describe in one call."`
}

DescribeInput is the input for gitlab_describe_tools.

type DescribeOutput

type DescribeOutput struct {
	Count   int                 `json:"count" jsonschema:"Number of described actions."`
	Actions []ActionDescription `json:"actions" jsonschema:"Detailed action descriptions."`
}

DescribeOutput is the structured output for gitlab_describe_tools.

type ExecuteInput

type ExecuteInput struct {
	Action  string         `` /* 147-byte string literal not displayed */
	Params  map[string]any `` /* 162-byte string literal not displayed */
	Confirm bool           `json:"confirm,omitempty" jsonschema:"Set true to explicitly confirm destructive actions."`
}

ExecuteInput is the input for gitlab_execute_tool.

type FindInput

type FindInput struct {
	Query string `` /* 137-byte string literal not displayed */
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum number of matches to return. Defaults to 20 and is capped at 50."`
}

FindInput is the input for gitlab_find_action.

type FindOutput

type FindOutput struct {
	Query   string       `json:"query" jsonschema:"Original search query."`
	Count   int          `json:"count" jsonschema:"Number of returned matches."`
	Results []FindResult `json:"results" jsonschema:"Matching GitLab catalog actions with schemas and execute examples."`
}

FindOutput is the structured output for gitlab_find_action.

type FindResult

type FindResult struct {
	ID             string         `json:"id" jsonschema:"Canonical action ID to pass to gitlab_execute_tool."`
	Tool           string         `json:"tool" jsonschema:"Backing meta-tool name."`
	Domain         string         `json:"domain" jsonschema:"Canonical action domain."`
	Action         string         `json:"action" jsonschema:"Action name inside the catalog group."`
	SchemaURI      string         `json:"schema_uri" jsonschema:"MCP resource URI for the action parameter schema."`
	Destructive    bool           `json:"destructive" jsonschema:"Whether this action requires explicit confirmation."`
	RequiredParams []string       `json:"required_params,omitempty" jsonschema:"Required parameter names captured from the input schema."`
	Usage          string         `json:"usage,omitempty" jsonschema:"Short disambiguation note for commonly confused actions."`
	Score          int            `json:"score" jsonschema:"Lexical relevance score for the query."`
	InputSchema    map[string]any `json:"input_schema" jsonschema:"Exact JSON Schema for action-specific params."`
	OutputSchema   map[string]any `json:"output_schema,omitempty" jsonschema:"Best-effort JSON Schema for the action result."`
	Example        ActionExample  `json:"example" jsonschema:"Example gitlab_execute_tool call."`
}

FindResult is a matching catalog action with schema details and an execute example.

type Registry

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

Registry holds a deterministic action index and dispatch handlers.

func NewRegistry

func NewRegistry(routes map[string]toolutil.ActionMap) *Registry

NewRegistry builds a deterministic action registry from visible meta routes.

func NewRegistryFromCatalog

func NewRegistryFromCatalog(catalog *actionregistry.Catalog) *Registry

NewRegistryFromCatalog builds a deterministic dynamic action index from the canonical action catalog.

func (*Registry) Describe

Describe returns schemas and execution metadata for GitLab catalog actions.

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, req *mcp.CallToolRequest, input ExecuteInput) (*mcp.CallToolResult, any, error)

Execute dispatches one catalog action through the existing meta-tool handler.

func (*Registry) Find

Find searches GitLab catalog actions and includes exact schemas for matches.

func (*Registry) Search

Search finds GitLab catalog actions by lexical matching over action metadata.

type SearchInput

type SearchInput struct {
	Query string `` /* 137-byte string literal not displayed */
	Limit int    `json:"limit,omitempty" jsonschema:"Maximum number of matches to return. Defaults to 20 and is capped at 50."`
}

SearchInput is the input for gitlab_search_tools.

type SearchOutput

type SearchOutput struct {
	Query   string         `json:"query" jsonschema:"Original search query."`
	Count   int            `json:"count" jsonschema:"Number of returned matches."`
	Results []SearchResult `json:"results" jsonschema:"Matching GitLab catalog actions."`
}

SearchOutput is the structured output for gitlab_search_tools.

type SearchResult

type SearchResult struct {
	ID             string   `json:"id" jsonschema:"Canonical action ID to pass to gitlab_describe_tools or gitlab_execute_tool."`
	Tool           string   `json:"tool" jsonschema:"Backing meta-tool name."`
	Domain         string   `json:"domain" jsonschema:"Canonical action domain."`
	Action         string   `json:"action" jsonschema:"Action name inside the catalog group."`
	SchemaURI      string   `json:"schema_uri" jsonschema:"MCP resource URI for the action parameter schema."`
	Destructive    bool     `json:"destructive" jsonschema:"Whether this action is marked destructive and requires explicit confirmation."`
	RequiredParams []string `json:"required_params,omitempty" jsonschema:"Required parameter names captured from the action input schema."`
	Usage          string   `json:"usage,omitempty" jsonschema:"Short disambiguation note for commonly confused actions."`
	Score          int      `json:"score" jsonschema:"Lexical relevance score for the query."`
}

SearchResult is one matching GitLab catalog action.

type StandaloneOptions

type StandaloneOptions struct {
	ReadOnly     bool
	ExcludeTools []string
}

StandaloneOptions controls which standalone tools are added to the canonical dynamic action catalog.

Jump to

Keyboard shortcuts

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