codemode

package
v0.0.0-...-a17b574 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTool

func AddTool[In, Out any](c *Convertor, t *mcp.Tool, handler mcp.ToolHandlerFor[In, Out])

func MapToDict

func MapToDict(m map[string]any) (*starlark.Dict, error)

MapToDict is a convenience wrapper for maps

func ToStarlarkValue

func ToStarlarkValue(v any) (starlark.Value, error)

ToStarlarkValue converts native Go types to starlark.Value

func UnpackDict

func UnpackDict(d *starlark.Dict) (map[string]any, error)

UnpackDict converts a Starlark Dict into a Go map[string]any

Types

type Convertor

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

func NewConvertor

func NewConvertor() *Convertor

func (*Convertor) ExecuteTool

func (c *Convertor) ExecuteTool(ctx context.Context, req *mcp.CallToolRequest, input ExecuteInput) (
	*mcp.CallToolResult,
	ExecuteOutput,
	error,
)

func (*Convertor) GetSchemaTool

func (*Convertor) Register

func (c *Convertor) Register(srv *mcp.Server)

func (*Convertor) SearchTool

func (c *Convertor) SearchTool(ctx context.Context, req *mcp.CallToolRequest, input SearchInput) (
	*mcp.CallToolResult,
	SearchOutput,
	error,
)

type ExecuteInput

type ExecuteInput struct {
	Code string `json:"code" jsonschema:"Starlark code to execute tool calls via call_tool(tool_name, input)"`
}

type ExecuteOutput

type ExecuteOutput struct {
	Result any `json:"result" jsonschema:"Result returned by the executed code"`
}

type GetSchemaInput

type GetSchemaInput struct {
	Tools []string `json:"tools" jsonschema:"List of tool names for which details schema is needed"`
}

type GetSchemaOutput

type GetSchemaOutput struct {
	Results []ToolDetail
}

type JSON

type JSON = json.RawMessage

type SearchHit

type SearchHit struct {
	ToolDetail
	Score int `json:"score" jsonschema:"Rank score of the result"`
}

type SearchInput

type SearchInput struct {
	Query  string `json:"query" jsonschema:"Search terms (space separated) to find availabel tools"`
	Detail string `json:"detail" jsonschema:"Level of detail the search output is required in. (brief, detail, full)"`
	Limit  *int   `json:"limit" jsonschema:"Maximum number of results to return"`
}

type SearchOutput

type SearchOutput struct {
	Hits []SearchHit `json:"hits" jsonschema:"Results of the search call"`
}

type Tool

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

type ToolDetail

type ToolDetail struct {
	Name         string `json:"name" jsonschema:"Name of the tool"`
	Description  string `json:"description" jsonschema:"Description of the tool"`
	InputSchema  any    `json:"input_schema" jsonschema:"Input parameters of the tool"`
	OutputSchema any    `json:"output_schema" jsonschema:"Output structure of the tool"`
}

Jump to

Keyboard shortcuts

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