parser

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("parser",
	fx.Provide(
		fx.Annotate(
			NewSwaggerParser,
			fx.As(new(Parser)),
		),
		NewAdjuster,
	),
)

Module provides the parser dependencies

Functions

This section is empty.

Types

type Adjuster

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

Adjuster provides filtering and description overrides based on YAML configuration

func NewAdjuster

func NewAdjuster() *Adjuster

NewAdjuster creates a new Adjuster instance

func (*Adjuster) ExistsInMCP

func (a *Adjuster) ExistsInMCP(route, method string) bool

ExistsInMCP checks if a route with the given method exists in MCP Returns true if the route/method IS in the selected routes

func (*Adjuster) GetDescription

func (a *Adjuster) GetDescription(route, method, originalDesc string) string

GetDescription returns the updated description for a route/method if it exists

func (*Adjuster) Load

func (a *Adjuster) Load(filePath string) error

Load loads adjustments from a YAML file

type Parser

type Parser interface {
	// Init parses a Swagger/OpenAPI specification from a file
	Init(openAPISpec string, adjustmentsFile string) error
	// ParseReader parses a Swagger/OpenAPI specification from a reader
	ParseReader(reader io.Reader) error
	// GetRouteTools returns the parsed route tools
	GetRouteTools() []*RouteTool
}

Parser handles parsing of Swagger/OpenAPI specifications

type RouteTool

type RouteTool struct {
	RouteConfig *requester.RouteConfig
	Tool        mcp.Tool
}

RouteTool combines a route configuration with its corresponding MCP tool

type SwaggerParser

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

SwaggerParser parses Swagger specifications and generates route configurations

func NewSwaggerParser

func NewSwaggerParser(adjuster *Adjuster) *SwaggerParser

NewSwaggerParser creates a new SwaggerParser instance

func (*SwaggerParser) GetRouteTools

func (p *SwaggerParser) GetRouteTools() []*RouteTool

GetRouteTools returns the parsed route tools

func (*SwaggerParser) Init

func (p *SwaggerParser) Init(openAPISpec string, adjustmentsFile string) error

Init parses a Swagger/OpenAPI specification from a file

func (*SwaggerParser) ParseReader

func (p *SwaggerParser) ParseReader(reader io.Reader) error

ParseReader parses a Swagger/OpenAPI specification from a reader

Jump to

Keyboard shortcuts

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