docs

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

ABOUTME: Documentation generation for tools and APIs in multiple formats. ABOUTME: OpenAPI, Markdown, and JSON documentation with extensible generators. Package docs provides comprehensive documentation generation capabilities for tools, APIs, and components. It supports multiple output formats including OpenAPI specifications, Markdown documentation, and structured JSON, with an extensible architecture for adding new formats.

Key capabilities:

  • OpenAPI 3.0 specification generation
  • Markdown documentation with examples
  • JSON structured documentation
  • Tool documentation with schemas
  • Extensible generator interface
  • Integration with MCP protocols

Package docs provides documentation generation capabilities for go-llms components. It supports generating documentation in multiple formats including OpenAPI, Markdown, and JSON. The package provides interfaces and types that are bridge-friendly for integration with other systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSchemaToOpenAPI

func ConvertSchemaToOpenAPI(schema *Schema) map[string]interface{}

ConvertSchemaToOpenAPI converts our Schema type to OpenAPI schema format. It recursively transforms the Schema structure into a map suitable for JSON serialization in OpenAPI specifications.

Parameters:

  • schema: The schema to convert

Returns a map representing the OpenAPI schema.

func GenerateToolMarkdown

func GenerateToolMarkdown(ctx context.Context, toolInfos []tools.ToolInfo, config GeneratorConfig) (string, error)

GenerateToolMarkdown creates markdown documentation for tools. It converts tool information into human-readable markdown format suitable for documentation sites and README files.

Parameters:

  • ctx: The context for the operation
  • toolInfos: The tools to document
  • config: Generator configuration

Returns markdown-formatted documentation or an error.

func GenerateToolsMarkdown

func GenerateToolsMarkdown(ctx context.Context, config GeneratorConfig) (string, error)

GenerateToolsMarkdown is a convenience function to generate markdown for all tools. It creates a new discovery instance and integrator internally, suitable for one-off documentation generation tasks.

Parameters:

  • ctx: The context for the operation
  • config: Generator configuration

Returns markdown documentation or an error.

Types

type BatchGenerationOptions

type BatchGenerationOptions struct {
	// Categories to include (empty means all)
	Categories []string

	// Tags to filter by (empty means all)
	Tags []string

	// IncludeExamples whether to include examples in output
	IncludeExamples bool

	// IncludeSchemas whether to include schemas in output
	IncludeSchemas bool

	// GroupByCategory whether to group tools by category in output
	GroupByCategory bool

	// OutputFormat specifies the format: "openapi", "markdown", "json"
	OutputFormat string
}

BatchGenerationOptions provides options for batch generation operations. It allows fine-grained control over which tools to include and how to format the output when generating documentation in bulk.

type Components

type Components struct {
	Schemas         map[string]*Schema        `json:"schemas,omitempty"`
	Responses       map[string]*Response      `json:"responses,omitempty"`
	Parameters      map[string]*Parameter     `json:"parameters,omitempty"`
	Examples        map[string]*Example       `json:"examples,omitempty"`
	RequestBodies   map[string]*RequestBody   `json:"requestBodies,omitempty"`
	Headers         map[string]*Header        `json:"headers,omitempty"`
	SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
}

Components holds reusable objects. It provides a container for various reusable definitions that can be referenced throughout the OpenAPI specification.

type Contact

type Contact struct {
	Name  string `json:"name,omitempty"`
	URL   string `json:"url,omitempty"`
	Email string `json:"email,omitempty"`
}

Contact information. Provides contact details for the API support or development team.

type Documentable

type Documentable interface {
	// GetDocumentation returns the documentation for this item
	GetDocumentation() Documentation
}

Documentable represents an item that can be documented. Any component that implements this interface can have its documentation automatically generated.

type Documentation

type Documentation struct {
	// Basic information
	Name        string `json:"name"`        // Name of the component
	Description string `json:"description"` // Brief description

	// Extended information
	LongDescription string   `json:"longDescription,omitempty"` // Detailed description
	Category        string   `json:"category,omitempty"`        // Category for grouping
	Tags            []string `json:"tags,omitempty"`            // Tags for discovery
	Version         string   `json:"version,omitempty"`         // Version information
	Deprecated      bool     `json:"deprecated,omitempty"`      // Deprecation status
	DeprecationNote string   `json:"deprecationNote,omitempty"` // Deprecation details

	// Usage information
	Examples []Example `json:"examples,omitempty"` // Usage examples

	// Schema information
	Schema  *Schema            `json:"schema,omitempty"`  // Input/output schema
	Schemas map[string]*Schema `json:"schemas,omitempty"` // Multiple schemas (e.g., input/output)

	// Metadata
	Metadata map[string]interface{} `json:"metadata,omitempty"` // Additional metadata
}

Documentation contains all documentation details for an item. It provides comprehensive information including descriptions, examples, schemas, and metadata for documentation generation.

func GenerateToolDocumentation

func GenerateToolDocumentation(toolInfo tools.ToolInfo) (Documentation, error)

GenerateToolDocumentation converts a ToolInfo from the discovery system to Documentation format. It transforms tool metadata, schemas, and examples into a standardized documentation structure that can be rendered in various formats (OpenAPI, Markdown, JSON).

Parameters:

  • toolInfo: The tool information from the discovery system

Returns a Documentation struct or an error if conversion fails.

func GenerateToolsJSON

func GenerateToolsJSON(ctx context.Context, config GeneratorConfig) ([]Documentation, error)

GenerateToolsJSON is a convenience function to generate JSON docs for all tools. It creates a new discovery instance and integrator internally, suitable for one-off documentation generation tasks.

Parameters:

  • ctx: The context for the operation
  • config: Generator configuration

Returns JSON documentation structs or an error.

type DocumentationType

type DocumentationType string

DocumentationType represents the type of documentation to generate. It defines the output format for documentation generation, supporting OpenAPI, Markdown, and JSON formats.

const (
	// TypeOpenAPI generates OpenAPI 3.0 specification
	TypeOpenAPI DocumentationType = "openapi"

	// TypeMarkdown generates Markdown documentation
	TypeMarkdown DocumentationType = "markdown"

	// TypeJSON generates JSON documentation
	TypeJSON DocumentationType = "json"
)

type Encoding

type Encoding struct {
	ContentType string            `json:"contentType,omitempty"`
	Headers     map[string]Header `json:"headers,omitempty"`
	Style       string            `json:"style,omitempty"`
	Explode     bool              `json:"explode,omitempty"`
}

Encoding represents encoding information. It defines how a specific property should be encoded in multipart or application/x-www-form-urlencoded requests.

type Example

type Example struct {
	Name        string      `json:"name"`                  // Example name
	Description string      `json:"description,omitempty"` // What this example shows
	Input       interface{} `json:"input,omitempty"`       // Example input
	Output      interface{} `json:"output,omitempty"`      // Expected output
	Code        string      `json:"code,omitempty"`        // Code snippet
	Language    string      `json:"language,omitempty"`    // Code language
}

Example represents a usage example. Examples demonstrate how to use a component with concrete inputs, expected outputs, and code snippets. They are essential for helping users understand practical usage patterns.

type ExternalDocumentation

type ExternalDocumentation struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"url"`
}

ExternalDocumentation represents external documentation. It provides a reference to external documentation that supplements the API description.

type Generator

type Generator interface {
	// GenerateOpenAPI generates OpenAPI 3.0 specification
	GenerateOpenAPI(ctx context.Context, items []Documentable) (*OpenAPISpec, error)

	// GenerateMarkdown generates Markdown documentation
	GenerateMarkdown(ctx context.Context, items []Documentable) (string, error)

	// GenerateJSON generates JSON documentation
	GenerateJSON(ctx context.Context, items []Documentable) ([]byte, error)
}

Generator defines the interface for documentation generators. Implementations can generate documentation in various formats from a collection of Documentable items.

type GeneratorConfig

type GeneratorConfig struct {
	// Title for the documentation
	Title string `json:"title"`

	// Description for the documentation
	Description string `json:"description"`

	// Version of the API/component
	Version string `json:"version"`

	// BaseURL for API endpoints (OpenAPI)
	BaseURL string `json:"baseUrl,omitempty"`

	// GroupBy specifies how to group items (e.g., "category", "type")
	GroupBy string `json:"groupBy,omitempty"`

	// IncludeExamples whether to include examples
	IncludeExamples bool `json:"includeExamples,omitempty"`

	// IncludeSchemas whether to include schemas
	IncludeSchemas bool `json:"includeSchemas,omitempty"`

	// CustomMetadata additional metadata
	CustomMetadata map[string]interface{} `json:"customMetadata,omitempty"`
}

GeneratorConfig contains configuration for documentation generation. It provides options to customize the output format, grouping, and content inclusion for generated documentation.

type Header struct {
	Description string      `json:"description,omitempty"`
	Schema      *Schema     `json:"schema,omitempty"`
	Example     interface{} `json:"example,omitempty"`
}

Header represents a response header. It defines a single HTTP header that can be returned in the response, including its schema and examples.

type Info

type Info struct {
	Title          string   `json:"title"`
	Description    string   `json:"description,omitempty"`
	TermsOfService string   `json:"termsOfService,omitempty"`
	Contact        *Contact `json:"contact,omitempty"`
	License        *License `json:"license,omitempty"`
	Version        string   `json:"version"`
}

Info contains API metadata. It provides essential information about the API including title, version, description, and contact details.

type License

type License struct {
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

License information. Specifies the license under which the API is provided.

type MarkdownGenerator

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

MarkdownGenerator generates Markdown documentation. It converts Documentable items into human-readable markdown format suitable for documentation sites, README files, and other text-based documentation needs.

func NewMarkdownGenerator

func NewMarkdownGenerator(config GeneratorConfig) *MarkdownGenerator

NewMarkdownGenerator creates a new Markdown generator.

Parameters:

  • config: Configuration for the generator including title, version, and formatting options

Returns a configured MarkdownGenerator instance.

func (*MarkdownGenerator) GenerateJSON

func (g *MarkdownGenerator) GenerateJSON(ctx context.Context, items []Documentable) ([]byte, error)

GenerateJSON generates JSON representation of the documentation. It creates a structured JSON document containing all documentation items along with generator metadata.

Parameters:

  • ctx: The context for the operation
  • items: The documentable items to include

Returns JSON bytes or an error.

func (*MarkdownGenerator) GenerateMarkdown

func (g *MarkdownGenerator) GenerateMarkdown(ctx context.Context, items []Documentable) (string, error)

GenerateMarkdown generates Markdown documentation from documentable items. It creates a comprehensive markdown document with table of contents, grouped sections, metadata tables, schemas, and examples.

Parameters:

  • ctx: The context for the operation
  • items: The documentable items to include

Returns formatted markdown string or an error.

func (*MarkdownGenerator) GenerateOpenAPI

func (g *MarkdownGenerator) GenerateOpenAPI(ctx context.Context, items []Documentable) (*OpenAPISpec, error)

GenerateOpenAPI is not implemented by MarkdownGenerator. This method exists to satisfy the Generator interface but returns an error as markdown generation doesn't produce OpenAPI specifications.

Parameters:

  • ctx: The context (unused)
  • items: The items to document (unused)

Returns an error indicating OpenAPI generation is not supported.

type MediaType

type MediaType struct {
	Schema   *Schema             `json:"schema,omitempty"`
	Example  interface{}         `json:"example,omitempty"`
	Examples map[string]Example  `json:"examples,omitempty"`
	Encoding map[string]Encoding `json:"encoding,omitempty"`
}

MediaType represents content for a specific media type. It describes the schema, examples, and encoding for content in a specific format (e.g., application/json).

type OAuthFlow

type OAuthFlow struct {
	AuthorizationURL string            `json:"authorizationUrl,omitempty"`
	TokenURL         string            `json:"tokenUrl,omitempty"`
	RefreshURL       string            `json:"refreshUrl,omitempty"`
	Scopes           map[string]string `json:"scopes"`
}

OAuthFlow represents an OAuth flow. It contains the configuration details for a specific OAuth 2.0 flow, including URLs and available scopes.

type OAuthFlows

type OAuthFlows struct {
	Implicit          *OAuthFlow `json:"implicit,omitempty"`
	Password          *OAuthFlow `json:"password,omitempty"`
	ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty"`
	AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty"`
}

OAuthFlows represents OAuth flows. It contains configuration for the supported OAuth 2.0 flows (implicit, password, client credentials, authorization code).

type OpenAPIGenerator

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

OpenAPIGenerator generates OpenAPI 3.0 specifications. It converts Documentable items into OpenAPI specifications with paths, schemas, and examples suitable for API documentation.

func NewOpenAPIGenerator

func NewOpenAPIGenerator(config GeneratorConfig) *OpenAPIGenerator

NewOpenAPIGenerator creates a new OpenAPI generator.

Parameters:

  • config: Configuration for the generator including title, version, and base URL

Returns a configured OpenAPIGenerator instance.

func (*OpenAPIGenerator) GenerateJSON

func (g *OpenAPIGenerator) GenerateJSON(ctx context.Context, items []Documentable) ([]byte, error)

GenerateJSON generates JSON representation of the OpenAPI spec. It first generates the OpenAPI specification, then serializes it to JSON.

Parameters:

  • ctx: The context for the operation
  • items: The documentable items to include

Returns JSON bytes of the OpenAPI spec or an error.

func (*OpenAPIGenerator) GenerateMarkdown

func (g *OpenAPIGenerator) GenerateMarkdown(ctx context.Context, items []Documentable) (string, error)

GenerateMarkdown is not implemented by OpenAPIGenerator. This method exists to satisfy the Generator interface but returns an error as OpenAPI generation doesn't produce markdown.

Parameters:

  • ctx: The context (unused)
  • items: The items to document (unused)

Returns an error indicating markdown generation is not supported.

func (*OpenAPIGenerator) GenerateOpenAPI

func (g *OpenAPIGenerator) GenerateOpenAPI(ctx context.Context, items []Documentable) (*OpenAPISpec, error)

GenerateOpenAPI generates an OpenAPI specification from documentable items. It creates a complete OpenAPI 3.0.3 specification with paths, schemas, tags, and components based on the provided items.

Parameters:

  • ctx: The context for the operation
  • items: The documentable items to include

Returns an OpenAPI specification or an error.

type OpenAPISpec

type OpenAPISpec struct {
	OpenAPI      string                 `json:"openapi"`
	Info         *Info                  `json:"info"`
	Servers      []Server               `json:"servers,omitempty"`
	Paths        map[string]*PathItem   `json:"paths,omitempty"`
	Components   *Components            `json:"components,omitempty"`
	Security     []SecurityRequirement  `json:"security,omitempty"`
	Tags         []Tag                  `json:"tags,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}

OpenAPISpec represents an OpenAPI 3.0 specification. It provides a complete description of an API including paths, components, security schemes, and metadata. All fields are JSON-serializable for easy integration with external systems.

func GenerateOpenAPIForTool

func GenerateOpenAPIForTool(tool Documentable, config GeneratorConfig) (*OpenAPISpec, error)

GenerateOpenAPIForTool generates OpenAPI documentation for a single tool. This is a convenience function for generating documentation for individual tools.

Parameters:

  • tool: The tool to document
  • config: Generator configuration

Returns an OpenAPI specification for the tool or an error.

func GenerateToolOpenAPI

func GenerateToolOpenAPI(ctx context.Context, toolInfos []tools.ToolInfo, config GeneratorConfig) (*OpenAPISpec, error)

GenerateToolOpenAPI creates an OpenAPI specification specifically for tools. It converts tool information from the discovery system into a complete OpenAPI 3.0 specification with paths, schemas, and examples.

Parameters:

  • ctx: The context for the operation
  • toolInfos: The tools to include in the specification
  • config: Generator configuration

Returns an OpenAPI specification or an error.

func GenerateToolsOpenAPI

func GenerateToolsOpenAPI(ctx context.Context, config GeneratorConfig) (*OpenAPISpec, error)

GenerateToolsOpenAPI is a convenience function to generate OpenAPI spec for all tools. It creates a new discovery instance and integrator internally, suitable for one-off documentation generation tasks.

Parameters:

  • ctx: The context for the operation
  • config: Generator configuration

Returns an OpenAPI specification or an error.

func (*OpenAPISpec) MarshalJSON

func (o *OpenAPISpec) MarshalJSON() ([]byte, error)

MarshalJSON ensures all types are JSON serializable. This custom marshaler handles the OpenAPISpec serialization, ensuring all nested structures are properly converted to JSON.

Returns the JSON representation or an error.

func (*OpenAPISpec) UnmarshalJSON

func (o *OpenAPISpec) UnmarshalJSON(data []byte) error

UnmarshalJSON ensures OpenAPISpec can be deserialized. This custom unmarshaler handles the OpenAPISpec deserialization, properly reconstructing all nested structures from JSON.

Parameters:

  • data: The JSON data to unmarshal

Returns an error if unmarshaling fails.

type Operation

type Operation struct {
	Tags         []string               `json:"tags,omitempty"`
	Summary      string                 `json:"summary,omitempty"`
	Description  string                 `json:"description,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
	OperationID  string                 `json:"operationId,omitempty"`
	Parameters   []Parameter            `json:"parameters,omitempty"`
	RequestBody  *RequestBody           `json:"requestBody,omitempty"`
	Responses    map[string]*Response   `json:"responses"`
	Deprecated   bool                   `json:"deprecated,omitempty"`
	Security     []SecurityRequirement  `json:"security,omitempty"`
}

Operation represents an API operation. It describes a single API operation on a path, including parameters, request body, responses, and security requirements.

func ConvertToolInfoToOpenAPIOperation

func ConvertToolInfoToOpenAPIOperation(toolInfo tools.ToolInfo) (*Operation, error)

ConvertToolInfoToOpenAPIOperation converts a single ToolInfo to an OpenAPI operation. It creates a complete operation definition including request body, responses, and examples based on the tool's schema and metadata.

Parameters:

  • toolInfo: The tool information to convert

Returns an OpenAPI Operation or an error.

type Parameter

type Parameter struct {
	Name            string      `json:"name"`
	In              string      `json:"in"`
	Description     string      `json:"description,omitempty"`
	Required        bool        `json:"required,omitempty"`
	Deprecated      bool        `json:"deprecated,omitempty"`
	AllowEmptyValue bool        `json:"allowEmptyValue,omitempty"`
	Schema          *Schema     `json:"schema,omitempty"`
	Example         interface{} `json:"example,omitempty"`
}

Parameter represents an operation parameter. Parameters can be located in the path, query, header, or cookie. They define the expected inputs for an operation.

type PathItem

type PathItem struct {
	Summary     string     `json:"summary,omitempty"`
	Description string     `json:"description,omitempty"`
	Get         *Operation `json:"get,omitempty"`
	Put         *Operation `json:"put,omitempty"`
	Post        *Operation `json:"post,omitempty"`
	Delete      *Operation `json:"delete,omitempty"`
	Options     *Operation `json:"options,omitempty"`
	Head        *Operation `json:"head,omitempty"`
	Patch       *Operation `json:"patch,omitempty"`
	Trace       *Operation `json:"trace,omitempty"`
}

PathItem represents operations on a path. It can contain multiple operations (GET, POST, etc.) along with common parameters and descriptions that apply to all operations.

type RequestBody

type RequestBody struct {
	Description string               `json:"description,omitempty"`
	Content     map[string]MediaType `json:"content"`
	Required    bool                 `json:"required,omitempty"`
}

RequestBody represents a request body. It describes a single request body with content in various media types (e.g., application/json, multipart/form-data).

type Response

type Response struct {
	Description string               `json:"description"`
	Headers     map[string]Header    `json:"headers,omitempty"`
	Content     map[string]MediaType `json:"content,omitempty"`
}

Response represents an operation response. It describes a single response from an API operation, including headers and content in various media types.

type Schema

type Schema struct {
	Type        string                 `json:"type,omitempty"`
	Title       string                 `json:"title,omitempty"`
	Description string                 `json:"description,omitempty"`
	Properties  map[string]*Schema     `json:"properties,omitempty"`
	Items       *Schema                `json:"items,omitempty"`
	Required    []string               `json:"required,omitempty"`
	Enum        []interface{}          `json:"enum,omitempty"`
	Default     interface{}            `json:"default,omitempty"`
	Format      string                 `json:"format,omitempty"`
	Pattern     string                 `json:"pattern,omitempty"`
	MinLength   *int                   `json:"minLength,omitempty"`
	MaxLength   *int                   `json:"maxLength,omitempty"`
	Minimum     *float64               `json:"minimum,omitempty"`
	Maximum     *float64               `json:"maximum,omitempty"`
	Additional  map[string]interface{} `json:"additionalProperties,omitempty"`
}

Schema represents a JSON schema (bridge-friendly). It provides a subset of JSON Schema Draft 7 for describing data structures, validation rules, and type constraints. This type is designed to be easily serializable and compatible with various documentation formats.

func (*Schema) MarshalJSON

func (s *Schema) MarshalJSON() ([]byte, error)

MarshalJSON ensures Schema is JSON serializable. This custom marshaler handles the Schema type's serialization to JSON format, preserving all schema properties correctly.

Returns the JSON representation or an error if marshaling fails.

func (*Schema) UnmarshalJSON

func (s *Schema) UnmarshalJSON(data []byte) error

UnmarshalJSON ensures Schema can be deserialized from JSON. This custom unmarshaler handles the Schema type's deserialization from JSON format, properly reconstructing all schema properties.

Parameters:

  • data: The JSON data to unmarshal

Returns an error if unmarshaling fails.

type SecurityRequirement

type SecurityRequirement map[string][]string

SecurityRequirement represents a security requirement. It maps security scheme names to the scopes required for execution. An empty array means the security scheme is applied without scopes.

type SecurityScheme

type SecurityScheme struct {
	Type        string      `json:"type"`
	Description string      `json:"description,omitempty"`
	Name        string      `json:"name,omitempty"`
	In          string      `json:"in,omitempty"`
	Scheme      string      `json:"scheme,omitempty"`
	Flows       *OAuthFlows `json:"flows,omitempty"`
}

SecurityScheme represents a security scheme. It defines a security mechanism that can be used across the API, such as API keys, HTTP authentication, or OAuth2.

type Server

type Server struct {
	URL         string                    `json:"url"`
	Description string                    `json:"description,omitempty"`
	Variables   map[string]ServerVariable `json:"variables,omitempty"`
}

Server represents a server. It defines a server URL along with optional variables that can be substituted into the URL template.

type ServerVariable

type ServerVariable struct {
	Enum        []string `json:"enum,omitempty"`
	Default     string   `json:"default"`
	Description string   `json:"description,omitempty"`
}

ServerVariable represents a server variable. Variables can be used in server URL templates and support enumerated values with defaults.

type Tag

type Tag struct {
	Name         string                 `json:"name"`
	Description  string                 `json:"description,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}

Tag represents a tag for grouping. Tags are used to group operations in the OpenAPI specification and can include descriptions and links to external documentation.

type ToolDocumentationIntegrator

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

ToolDocumentationIntegrator provides high-level integration between discovery and documentation. It bridges the tool discovery system with the documentation generation capabilities, enabling batch operations, filtering, and format conversion for tool documentation.

func NewToolDocumentationIntegrator

func NewToolDocumentationIntegrator(discovery tools.ToolDiscovery, config GeneratorConfig) *ToolDocumentationIntegrator

NewToolDocumentationIntegrator creates a new integrator with the discovery system.

Parameters:

  • discovery: The tool discovery interface for accessing tool information
  • config: Generator configuration for controlling output format

Returns a configured ToolDocumentationIntegrator instance.

func (*ToolDocumentationIntegrator) BatchGenerate

func (i *ToolDocumentationIntegrator) BatchGenerate(ctx context.Context, options BatchGenerationOptions) (interface{}, error)

BatchGenerate performs batch generation with advanced filtering options. It supports filtering by categories and tags, grouping by category, and generating output in multiple formats (OpenAPI, Markdown, JSON).

Parameters:

  • ctx: The context for the operation
  • options: Configuration options for batch generation

Returns the generated documentation in the requested format or an error.

func (*ToolDocumentationIntegrator) GenerateDocsForAllTools

func (i *ToolDocumentationIntegrator) GenerateDocsForAllTools(ctx context.Context) ([]Documentation, error)

GenerateDocsForAllTools generates documentation for all tools in the discovery system. It iterates through all discovered tools and creates comprehensive documentation for each one, including descriptions, schemas, and examples.

Parameters:

  • ctx: The context for the operation

Returns a slice of Documentation structs or an error.

func (*ToolDocumentationIntegrator) GenerateDocsForCategory

func (i *ToolDocumentationIntegrator) GenerateDocsForCategory(ctx context.Context, category string) ([]Documentation, error)

GenerateDocsForCategory generates documentation for tools in a specific category. This allows filtering tools by their category for targeted documentation generation.

Parameters:

  • ctx: The context for the operation
  • category: The category to filter by

Returns documentation for tools in the specified category or an error.

func (*ToolDocumentationIntegrator) GenerateDocsForSearchQuery

func (i *ToolDocumentationIntegrator) GenerateDocsForSearchQuery(ctx context.Context, query string) ([]Documentation, error)

GenerateDocsForSearchQuery generates documentation for tools matching a search query. It uses the discovery system's search functionality to find matching tools and generates documentation for each match.

Parameters:

  • ctx: The context for the operation
  • query: The search query string

Returns documentation for matching tools or an error.

func (*ToolDocumentationIntegrator) GenerateMarkdownForAllTools

func (i *ToolDocumentationIntegrator) GenerateMarkdownForAllTools(ctx context.Context) (string, error)

GenerateMarkdownForAllTools creates markdown documentation for all discovered tools. The output is formatted markdown suitable for documentation sites, README files, or other human-readable documentation needs.

Parameters:

  • ctx: The context for the operation

Returns markdown-formatted documentation or an error.

func (*ToolDocumentationIntegrator) GenerateOpenAPIForAllTools

func (i *ToolDocumentationIntegrator) GenerateOpenAPIForAllTools(ctx context.Context) (*OpenAPISpec, error)

GenerateOpenAPIForAllTools creates an OpenAPI specification for all discovered tools. The specification includes endpoints, schemas, and examples for all tools in the discovery system, formatted according to OpenAPI 3.0 standards.

Parameters:

  • ctx: The context for the operation

Returns an OpenAPI specification or an error.

func (*ToolDocumentationIntegrator) GenerateOpenAPIForCategory

func (i *ToolDocumentationIntegrator) GenerateOpenAPIForCategory(ctx context.Context, category string) (*OpenAPISpec, error)

GenerateOpenAPIForCategory creates OpenAPI spec for tools in a specific category. The specification title is automatically updated to reflect the category filter.

Parameters:

  • ctx: The context for the operation
  • category: The category to filter by

Returns an OpenAPI specification for the category or an error.

func (*ToolDocumentationIntegrator) GetToolCategories

func (i *ToolDocumentationIntegrator) GetToolCategories() []string

GetToolCategories returns all unique categories from discovered tools. This is useful for understanding the available categories and building category-based navigation or filtering interfaces.

Returns a slice of unique category names.

func (*ToolDocumentationIntegrator) GetToolTags

func (i *ToolDocumentationIntegrator) GetToolTags() []string

GetToolTags returns all unique tags from discovered tools. Tags can be used for cross-category grouping and advanced filtering of tools in documentation generation.

Returns a slice of unique tag names.

func (*ToolDocumentationIntegrator) IntegrateWithToolHelp

func (i *ToolDocumentationIntegrator) IntegrateWithToolHelp(ctx context.Context, toolName string) (string, error)

IntegrateWithToolHelp enhances the existing GetToolHelp with documentation formatting. It retrieves basic help information and augments it with structured documentation, schemas, and examples in a human-readable format.

Parameters:

  • ctx: The context for the operation
  • toolName: The name of the tool to get help for

Returns enhanced help text or an error.

Jump to

Keyboard shortcuts

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