An implementable tool interface that allows custom Tool compilation for open-code
Find a file
cur1ousdude b85ed94cec feat(toolinterface): add InputSchema to Definition
Expose the full JSON call-argument schema on the stable tool definition so
compiled-in integrations can build model-callable tools without importing the
core (backend/api/msgmate/tools). Mirrors the core ToolDefinition.InputSchema.

Part of msgmate-io/open-chat-go-ci#423.
2026-10-15 22:10:02 +00:00
toolinterface feat(toolinterface): add InputSchema to Definition 2026-10-15 22:10:02 +00:00
.gitignore golang ignore 2026-06-21 20:45:16 +02:00
COPYRIGHT Relicense under AGPL-3.0-or-later 2026-09-20 17:11:35 +02:00
go.mod updated tool interface implementation 2026-06-21 20:45:35 +02:00
LICENSE Relicense under AGPL-3.0-or-later 2026-09-20 17:11:35 +02:00
NOTICE docs: add AGPL-3.0-or-later NOTICE with licensing exceptions 2026-09-27 01:33:52 +02:00
README.md docs: register integrations via integrations.yaml 2026-09-27 01:03:36 +02:00

go-tool-interface

Small Go SDK for registering external Open Chat tools.

This module remains independent and can be used by any Go project.

In Open Chat, tool definitions are discovered via integrations (go-integration-interface), not via a separate tooldeps.json manifest.

Migration for existing tool-only subrepos:

  1. Keep your tool definitions in this module.
  2. Add an integration package that imports those definitions.
  3. Register them via integrationinterface.Definition{ToolDefinitions: ...}.
  4. Add that integration module to integrations.yaml.

Usage

package mytool

import "github.com/msgmate-io/go-tool-interface/toolinterface"

func init() {
	toolinterface.MustRegister(toolinterface.Definition{
		Name:        "my_tool",
		Description: "My external tool",
		InputType: struct {
			Message string `json:"message"`
		}{},
		RequiredParams: []string{"message"},
		Parameters: map[string]interface{}{
			"message": map[string]interface{}{"type": "string"},
		},
		Run: func(input interface{}, init map[string]interface{}) (string, error) {
			in := input.(struct {
				Message string `json:"message"`
			})
			return "echo: " + in.Message, nil
		},
	})
}

To expose tools in Open Chat, include the definitions in an integration's Definition.ToolDefinitions field.