mcp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Core MCP Attributes
	AttrMCPMethodName      = "mcp.method.name"
	AttrMCPRequestID       = "mcp.request.id"
	AttrMCPSessionID       = "mcp.session.id"
	AttrMCPTransport       = "mcp.transport"
	AttrNetworkTransport   = "network.transport"
	AttrNetworkProtocolVer = "network.protocol.version"

	// Tool-specific Attributes
	AttrMCPToolName               = "mcp.tool.name"
	AttrMCPToolResultIsError      = "mcp.tool.result.is_error"
	AttrMCPToolResultContentCount = "mcp.tool.result.content_count"
	AttrMCPToolResultContent      = "mcp.tool.result.content"

	// Request Arguments Prefix
	AttrMCPRequestArgumentPrefix = "mcp.request.argument"

	// Sentry-specific Values
	OpMCPServer          = "mcp.server"
	OriginMCPFunction    = "auto.function.mcp_server"
	SourceMCPRoute       = "route"
	TransportStdio       = "stdio"
	NetworkTransportPipe = "pipe"
	JSONRPCVersion       = "2.0"
)

Variables

This section is empty.

Functions

func WithSentryTracing

func WithSentryTracing[In, Out any](toolName string, handler mcp.ToolHandlerFor[In, Out]) mcp.ToolHandlerFor[In, Out]

WithSentryTracing wraps an MCP tool handler with Sentry tracing. It creates transactions following OpenTelemetry MCP semantic conventions and captures tool execution results and errors.

Example usage:

mcp.AddTool(server, &mcp.Tool{
    Name:        "my_tool",
    Description: "Does something useful",
}, WithSentryTracing("my_tool", func(ctx context.Context, req *mcp.CallToolRequest, args MyToolArgs) (*mcp.CallToolResult, any, error) {
    return m.handleMyTool(ctx, req, args)
}))

Types

type GetActionParametersArgs

type GetActionParametersArgs struct {
	ActionRef string `json:"actionRef" jsonschema:"GitHub Action reference (e.g., 'actions/checkout@v5')"`
}

GetActionParametersArgs defines the parameters for the get_action_parameters tool.

type GetReadmeArgs

type GetReadmeArgs struct {
	RepoRef string `` /* 141-byte string literal not displayed */
}

GetReadmeArgs defines the parameters for the get_readme tool.

type MCPServer

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

MCPServer wraps the ActionsService and provides MCP tool handlers. It uses dependency injection to receive its dependencies.

func NewMCPServer

func NewMCPServer(actionsService *github.ActionsService, logger *slog.Logger) *MCPServer

NewMCPServer creates a new MCP server with the given dependencies.

func (*MCPServer) RegisterTools

func (m *MCPServer) RegisterTools(server *mcp.Server)

RegisterTools registers all available tools with the MCP server.

Jump to

Keyboard shortcuts

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