tool

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tool defines MCP tool definitions and shared property builders.

Index

Constants

This section is empty.

Variables

View Source
var Defs = []proto.Tool{
	{
		Name: cfgMcpTool.Status,
		Description: desc.Text(
			text.DescKeyMCPToolStatusDesc),
		InputSchema: proto.InputSchema{Type: schema.Object},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
	{
		Name: cfgMcpTool.Add,
		Description: desc.Text(
			text.DescKeyMCPToolAddDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: MergeProps(map[string]proto.Property{
				cli.AttrType: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropType),
					Enum: []string{
						"task", "decision",
						"learning", "convention",
					},
				},
				field.Content: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropContent),
				},
				field.Priority: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropPriority),
					Enum: entry.Priorities,
				},
			}, EntryAttrProps(
				text.DescKeyMCPToolPropContext)),
			Required: []string{cli.AttrType, field.Content},
		},
		Annotations: &proto.ToolAnnotations{},
	},
	{
		Name: cfgMcpTool.Complete,
		Description: desc.Text(
			text.DescKeyMCPToolCompleteDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: map[string]proto.Property{
				field.Query: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropQuery),
				},
			},
			Required: []string{field.Query},
		},
		Annotations: &proto.ToolAnnotations{IdempotentHint: true},
	},
	{
		Name: cfgMcpTool.Drift,
		Description: desc.Text(
			text.DescKeyMCPToolDriftDesc),
		InputSchema: proto.InputSchema{Type: schema.Object},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
	{
		Name: cfgMcpTool.Recall,
		Description: desc.Text(
			text.DescKeyMCPToolRecallDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: map[string]proto.Property{
				field.Limit: {
					Type: schema.Number,
					Description: desc.Text(
						text.DescKeyMCPToolPropLimit),
				},
				field.Since: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropSince),
				},
			},
		},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
	{
		Name: cfgMcpTool.WatchUpdate,
		Description: desc.Text(
			text.DescKeyMCPToolWatchUpdateDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: MergeProps(map[string]proto.Property{
				cli.AttrType: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropEntryType),
				},
				field.Content: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropMainContent),
				},
			}, EntryAttrProps(
				text.DescKeyMCPToolPropCtxBg)),
			Required: []string{cli.AttrType, field.Content},
		},
		Annotations: &proto.ToolAnnotations{},
	},
	{
		Name: cfgMcpTool.Compact,
		Description: desc.Text(
			text.DescKeyMCPToolCompactDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: map[string]proto.Property{
				field.Archive: {
					Type: schema.Boolean,
					Description: desc.Text(
						text.DescKeyMCPToolPropArchive),
				},
			},
		},
		Annotations: &proto.ToolAnnotations{},
	},
	{
		Name: cfgMcpTool.Next,
		Description: desc.Text(
			text.DescKeyMCPToolNextDesc),
		InputSchema: proto.InputSchema{Type: schema.Object},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
	{
		Name: cfgMcpTool.CheckTaskCompletion,
		Description: desc.Text(
			text.DescKeyMCPToolCheckTaskDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: map[string]proto.Property{
				field.RecentAction: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropRecentAct),
				},
			},
		},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
	{
		Name: cfgMcpTool.SessionEvent,
		Description: desc.Text(
			text.DescKeyMCPToolSessionDesc),
		InputSchema: proto.InputSchema{
			Type: schema.Object,
			Properties: map[string]proto.Property{
				cli.AttrType: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropEventType),
				},
				field.Caller: {
					Type: schema.String,
					Description: desc.Text(
						text.DescKeyMCPToolPropCaller),
				},
			},
			Required: []string{cli.AttrType},
		},
		Annotations: &proto.ToolAnnotations{},
	},
	{
		Name: cfgMcpTool.Remind,
		Description: desc.Text(
			text.DescKeyMCPToolRemindDesc),
		InputSchema: proto.InputSchema{Type: schema.Object},
		Annotations: &proto.ToolAnnotations{ReadOnlyHint: true},
	},
}

Defs defines all available MCP tools.

Functions

func EntryAttrProps

func EntryAttrProps(contextKey string) map[string]proto.Property

EntryAttrProps returns the five entry-attribute properties shared by tools that accept structured context entries (add, watch-update). contextKey selects the DescKey for the "context" field since each tool describes it differently.

Parameters:

  • contextKey: DescKey selecting the description for the context field

Returns:

  • map[string]proto.Property: property map with context, rationale, consequence, lesson, and application fields

func MergeProps

func MergeProps(dst, src map[string]proto.Property) map[string]proto.Property

MergeProps copies all entries from src into dst, returning dst.

Parameters:

  • dst: target property map
  • src: source property map to merge from

Returns:

  • map[string]proto.Property: the dst map with src entries added

Types

This section is empty.

Jump to

Keyboard shortcuts

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