mcputils

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcputils provides utilities for integrating MCP (Model Context Protocol) tools with trpc-agent-go. It handles the conversion of MCP tool schemas and provides wrapper types to make MCP tools compatible with the trpc-agent-go tool interface.

The main components are:

  • ConvertMCPSchema: Converts MCP ToolInputSchema to trpc-agent-go tool.Schema
  • MCPTool: Wraps MCP ServerTool to implement tool.Tool interface

Example usage:

import (
    "github.com/stackgenhq/genie/pkg/mcputils"
    "github.com/hashicorp/terraform-mcp-server/pkg/tools/registry"
    "github.com/sirupsen/logrus"
)

logger := logrus.New()
mcpServerTool := registry.SearchModules(logger)
trpcTool := mcputils.NewMCPTool(mcpServerTool, logger)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMCPSchema

func ConvertMCPSchema(mcpSchema mcp.ToolInputSchema) *tool.Schema

ConvertMCPSchema converts MCP input schema to trpc-agent-go schema This function handles the conversion of MCP ToolInputSchema to the tool.Schema format required by trpc-agent-go, including all nested properties and JSON Schema features.

Types

type MCPTool

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

MCPTool wraps an MCP ServerTool to implement the trpc-agent-go tool.Tool interface

func NewMCPTool

func NewMCPTool(mcpTool server.ServerTool) *MCPTool

NewMCPTool creates a new MCPTool wrapper around an MCP ServerTool

func (*MCPTool) Call

func (t *MCPTool) Call(ctx context.Context, jsonArgs []byte) (any, error)

Call executes the MCP tool with the provided arguments

func (*MCPTool) Declaration

func (t *MCPTool) Declaration() *tool.Declaration

Declaration returns the tool declaration with converted schema

Jump to

Keyboard shortcuts

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