tooldef

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "agent.tools/v1"
	KindDraft  = "ToolDraft"
)

Variables

This section is empty.

Functions

func Encode

func Encode(tool *ToolDraft, format string) ([]byte, error)

func WriteFile

func WriteFile(path string, tool *ToolDraft, format string) error

Types

type Annotations

type Annotations struct {
	GeneratedBy       string   `json:"generated_by" yaml:"generated_by"`
	Warnings          []string `json:"warnings,omitempty" yaml:"warnings,omitempty"`
	GovernanceReasons []string `json:"governance_reasons,omitempty" yaml:"governance_reasons,omitempty"`
	Deprecated        bool     `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
}

type Confirmation

type Confirmation string
const (
	ConfirmNever       Confirmation = "never"
	ConfirmRecommended Confirmation = "recommended"
	ConfirmRequired    Confirmation = "required"
)

type CostTags

type CostTags struct {
	Category string `json:"category" yaml:"category"`
}

type DataClassification

type DataClassification struct {
	Input  string `json:"input" yaml:"input"`
	Output string `json:"output" yaml:"output"`
}

type Finding

type Finding struct {
	Tool     string   `json:"tool" yaml:"tool"`
	Code     string   `json:"code" yaml:"code"`
	Severity Severity `json:"severity" yaml:"severity"`
	Message  string   `json:"message" yaml:"message"`
	Path     string   `json:"path,omitempty" yaml:"path,omitempty"`
}

type Idempotency

type Idempotency string
const (
	IdemSafe          Idempotency = "safe"
	IdemIdempotent    Idempotency = "idempotent"
	IdemNonIdempotent Idempotency = "non_idempotent"
	IdemUnknown       Idempotency = "unknown"
)

type LintReport

type LintReport struct {
	Summary  LintSummary `json:"summary" yaml:"summary"`
	Findings []Finding   `json:"findings" yaml:"findings"`
}

type LintSummary

type LintSummary struct {
	Tools    int `json:"tools" yaml:"tools"`
	Errors   int `json:"errors" yaml:"errors"`
	Warnings int `json:"warnings" yaml:"warnings"`
	Infos    int `json:"infos" yaml:"infos"`
	HighRisk int `json:"high_risk" yaml:"high_risk"`
}

type Manifest

type Manifest struct {
	GeneratedBy string         `json:"generated_by" yaml:"generated_by"`
	SpecHash    string         `json:"spec_hash" yaml:"spec_hash"`
	SpecTitle   string         `json:"spec_title" yaml:"spec_title"`
	ToolCount   int            `json:"tool_count" yaml:"tool_count"`
	Tools       []ManifestTool `json:"tools" yaml:"tools"`
}

type ManifestTool

type ManifestTool struct {
	Name      string    `json:"name" yaml:"name"`
	Method    string    `json:"method" yaml:"method"`
	Path      string    `json:"path" yaml:"path"`
	RiskLevel RiskLevel `json:"risk_level" yaml:"risk_level"`
}

type Metadata

type Metadata struct {
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
	Source  Source `json:"source" yaml:"source"`
}

type RetryPolicy

type RetryPolicy struct {
	MaxAttempts     int      `json:"max_attempts" yaml:"max_attempts"`
	RetryableErrors []string `json:"retryable_errors,omitempty" yaml:"retryable_errors,omitempty"`
}

type RiskLevel

type RiskLevel string
const (
	RiskLow      RiskLevel = "low"
	RiskMedium   RiskLevel = "medium"
	RiskHigh     RiskLevel = "high"
	RiskCritical RiskLevel = "critical"
)

type Severity

type Severity string
const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
	SeverityInfo    Severity = "info"
)

type SideEffect

type SideEffect string
const (
	SideNone    SideEffect = "none"
	SideRead    SideEffect = "read"
	SideWrite   SideEffect = "write"
	SideDelete  SideEffect = "delete"
	SideExecute SideEffect = "execute"
)

type Source

type Source struct {
	Type        string `json:"type" yaml:"type"`
	SpecHash    string `json:"spec_hash" yaml:"spec_hash"`
	OperationID string `json:"operation_id,omitempty" yaml:"operation_id,omitempty"`
	Method      string `json:"method" yaml:"method"`
	Path        string `json:"path" yaml:"path"`
	SpecTitle   string `json:"spec_title,omitempty" yaml:"spec_title,omitempty"`
	SpecVersion string `json:"spec_version,omitempty" yaml:"spec_version,omitempty"`
}

type Spec

type Spec struct {
	Description        string             `json:"description" yaml:"description"`
	InputSchema        map[string]any     `json:"input_schema" yaml:"input_schema"`
	OutputSchema       map[string]any     `json:"output_schema" yaml:"output_schema"`
	RiskLevel          RiskLevel          `json:"risk_level" yaml:"risk_level"`
	SideEffect         SideEffect         `json:"side_effect" yaml:"side_effect"`
	Idempotency        Idempotency        `json:"idempotency" yaml:"idempotency"`
	Confirmation       Confirmation       `json:"confirmation" yaml:"confirmation"`
	TimeoutMs          int                `json:"timeout_ms" yaml:"timeout_ms"`
	RetryPolicy        RetryPolicy        `json:"retry_policy" yaml:"retry_policy"`
	Permissions        []string           `json:"permissions" yaml:"permissions"`
	DataClassification DataClassification `json:"data_classification" yaml:"data_classification"`
	CostTags           CostTags           `json:"cost_tags" yaml:"cost_tags"`
	Annotations        Annotations        `json:"annotations" yaml:"annotations"`
}

type ToolDraft

type ToolDraft struct {
	APIVersion string   `json:"apiVersion" yaml:"apiVersion"`
	Kind       string   `json:"kind" yaml:"kind"`
	Metadata   Metadata `json:"metadata" yaml:"metadata"`
	Spec       Spec     `json:"spec" yaml:"spec"`
}

func Decode

func Decode(data []byte) (*ToolDraft, error)

func LoadDir

func LoadDir(dir string) ([]*ToolDraft, error)

func LoadFile

func LoadFile(path string) (*ToolDraft, error)

Jump to

Keyboard shortcuts

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