adapter

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package adapter provides adapters to integrate MCP with Loom's existing systems. This package bridges MCP tools to Loom's shuttle.Tool interface.

Index

Constants

View Source
const (
	// SchemaCacheTTL is how long schema results are cached
	SchemaCacheTTL = 5 * time.Minute
)

Schema caching configuration

Variables

This section is empty.

Functions

func AdaptMCPTools

func AdaptMCPTools(ctx context.Context, mcpClient *client.Client, serverName string) ([]shuttle.Tool, error)

AdaptMCPTools converts all tools from an MCP client to shuttle.Tool instances

func ClearSchemaCache

func ClearSchemaCache()

ClearSchemaCache clears the global schema cache (useful for testing or cache invalidation)

func GetSchemaCacheStats

func GetSchemaCacheStats() (entries int, oldestAge time.Duration)

GetSchemaCacheStats returns cache statistics

Types

type MCPToolAdapter

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

MCPToolAdapter wraps an MCP tool as a shuttle.Tool

func NewMCPToolAdapter

func NewMCPToolAdapter(client *client.Client, tool protocol.Tool, serverName string) *MCPToolAdapter

NewMCPToolAdapter creates a new adapter that wraps an MCP tool

func (*MCPToolAdapter) Backend

func (a *MCPToolAdapter) Backend() string

Backend implements shuttle.Tool

func (*MCPToolAdapter) Description

func (a *MCPToolAdapter) Description() string

Description implements shuttle.Tool

func (*MCPToolAdapter) Execute

func (a *MCPToolAdapter) Execute(ctx context.Context, params map[string]interface{}) (*shuttle.Result, error)

Execute implements shuttle.Tool

func (*MCPToolAdapter) HasUI added in v1.2.0

func (a *MCPToolAdapter) HasUI() bool

HasUI returns true if this tool has an associated MCP Apps UI resource.

func (*MCPToolAdapter) InputSchema

func (a *MCPToolAdapter) InputSchema() *shuttle.JSONSchema

InputSchema implements shuttle.Tool

func (*MCPToolAdapter) Name

func (a *MCPToolAdapter) Name() string

Name implements shuttle.Tool

func (*MCPToolAdapter) SetLogger added in v1.2.0

func (a *MCPToolAdapter) SetLogger(logger *zap.Logger)

SetLogger configures the structured logger for this adapter. If not called, a no-op logger is used.

func (*MCPToolAdapter) UIResourceURI added in v1.2.0

func (a *MCPToolAdapter) UIResourceURI() string

UIResourceURI returns the URI of the associated UI resource, or empty string.

Jump to

Keyboard shortcuts

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