specgen

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 3 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 specgen produces API specifications (MCP, A2A agent card, OAS3 transport) from neutral, provider-agnostic inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCard

type AgentCard struct {
	Name               string                `json:"name"`
	Description        string                `json:"description"`
	URL                string                `json:"url"`
	Version            string                `json:"version"`
	Capabilities       AgentCardCapabilities `json:"capabilities"`
	DefaultInputModes  []string              `json:"defaultInputModes"`
	DefaultOutputModes []string              `json:"defaultOutputModes"`
	Skills             []AgentCardSkill      `json:"skills"`
}

AgentCard is a minimal A2A agent card (subset of the A2A spec) sufficient to register the runtime as an API service without backend access.

type AgentCardBuilder

type AgentCardBuilder interface {
	SetName(name string) AgentCardBuilder
	SetDescription(description string) AgentCardBuilder
	SetVersion(version string) AgentCardBuilder
	SetEndpointURL(endpointURL string) AgentCardBuilder
	SetCapabilities(capabilities AgentCardCapabilities) AgentCardBuilder
	SetDefaultInputModes(modes []string) AgentCardBuilder
	SetDefaultOutputModes(modes []string) AgentCardBuilder
	// SetSkills sets the agent's skills. Leave unset when they are not known,
	// which is the case for a card that could not be fetched from the agent.
	SetSkills(skills []AgentCardSkill) AgentCardBuilder
	Build() *AgentCard
}

AgentCardBuilder builds an A2A agent card. It produces the bare minimum card, for use when the real one cannot be fetched from the agent; everything beyond the defaults is set by the caller.

func NewAgentCardBuilder

func NewAgentCardBuilder() AgentCardBuilder

NewAgentCardBuilder returns a builder for an A2A agent card.

type AgentCardCapabilities

type AgentCardCapabilities struct {
	Streaming bool `json:"streaming"`
}

type AgentCardSkill

type AgentCardSkill struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
}

type HTTPStreamTransport

type HTTPStreamTransport struct {
	Definition json.RawMessage `json:"definition"`
}

type MCPCapabilities

type MCPCapabilities struct {
	Tools MCPToolsCapability `json:"tools"`
}

type MCPDetails

type MCPDetails struct {
	ProtocolVersion string          `json:"protocolVersion"`
	Capabilities    MCPCapabilities `json:"capabilities"`
	ServerInfo      MCPServerInfo   `json:"serverInfo"`
}

type MCPServerInfo

type MCPServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type MCPSpec

type MCPSpec struct {
	MCP        string        `json:"mcp"`
	Details    MCPDetails    `json:"details"`
	Tools      []Tool        `json:"tools"`
	Transports MCPTransports `json:"transports"`
}

MCPSpec is the top-level spec document describing an MCP server.

type MCPSpecBuilder

type MCPSpecBuilder interface {
	SetName(name string) MCPSpecBuilder
	SetVersion(version string) MCPSpecBuilder
	SetEndpointURL(endpointURL string) MCPSpecBuilder
	// SetTools sets the server's tools. Leave unset when they cannot be
	// introspected, as for an MCP runtime target.
	SetTools(tools []Tool) MCPSpecBuilder
	SetProtocolVersion(protocolVersion string) MCPSpecBuilder
	SetCapabilities(capabilities MCPCapabilities) MCPSpecBuilder
	Build() *MCPSpec
}

MCPSpecBuilder builds the spec document for an MCP server or gateway target. The protocol version and the capabilities are defaulted and can be overridden; the embedded OAS3 transport is derived from the endpoint URL.

func NewMCPSpecBuilder

func NewMCPSpecBuilder() MCPSpecBuilder

NewMCPSpecBuilder returns a builder for an MCP spec.

type MCPToolsCapability

type MCPToolsCapability struct {
	ListChanged bool `json:"listChanged"`
}

type MCPTransports

type MCPTransports struct {
	HTTPStream *HTTPStreamTransport `json:"http-stream,omitempty"`
}

type Tool

type Tool struct {
	Name         string          `json:"name"`
	Description  string          `json:"description"`
	InputSchema  json.RawMessage `json:"inputSchema"`
	OutputSchema json.RawMessage `json:"outputSchema,omitempty"`
}

Tool is a neutral tool definition, used both as input and, directly, as the tool element of an MCP spec. A nil InputSchema marshals as null; OutputSchema is omitted when absent.

Jump to

Keyboard shortcuts

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