tools

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SearchLocalInputSchema

func SearchLocalInputSchema() json.RawMessage

SearchLocalInputSchema returns the JSON schema for SearchLocalInput. This is manually defined to avoid union types (type: ["array", "null"]) that mcphost can't parse. The MCP SDK auto-generates union types for optional array fields, which causes parsing failures in mcphost.

Types

type DomainItem

type DomainItem struct {
	Name    string `json:"name"`
	Caption string `json:"caption,omitempty"`
	ID      int    `json:"id,omitempty"`
}

DomainItem represents a domain in the OASF schema.

type DomainVerificationDetail

type DomainVerificationDetail struct {
	Domain       string `json:"domain"                   jsonschema:"The domain that was verified"`
	Method       string `json:"method"                   jsonschema:"Verification method used (e.g., 'wellknown')"`
	MatchedKeyID string `json:"matched_key_id,omitempty" jsonschema:"The key ID that matched from the domain's well-known file"`
	VerifiedAt   string `json:"verified_at,omitempty"    jsonschema:"Timestamp when verification occurred"`
}

DomainVerificationDetail provides details about the domain verification.

type ExportRecordInput

type ExportRecordInput struct {
	RecordJSON   string `json:"record_json"   jsonschema:"JSON string of the OASF agent record to export (required)"`
	TargetFormat string `json:"target_format" jsonschema:"Target format to export to (a2a, ghcopilot, agentskills) (required)"`
}

ExportRecordInput defines the input parameters for exporting a record.

type ExportRecordOutput

type ExportRecordOutput struct {
	ExportedData string `json:"exported_data,omitempty" jsonschema:"The exported data in the target format (JSON string)"`
	ErrorMessage string `json:"error_message,omitempty" jsonschema:"Error message if export failed"`
}

ExportRecordOutput defines the output of exporting a record.

type GetSchemaDomainsInput

type GetSchemaDomainsInput struct {
	Version      string `json:"version"                 jsonschema:"OASF schema version to retrieve domains from (e.g., 0.7.0, 0.8.0)"`
	ParentDomain string `` /* 127-byte string literal not displayed */
}

GetSchemaDomainsInput represents the input for getting OASF schema domains.

type GetSchemaDomainsOutput

type GetSchemaDomainsOutput struct {
	Version           string       `json:"version"                      jsonschema:"The requested OASF schema version"`
	Domains           []DomainItem `json:"domains"                      jsonschema:"List of domains (top-level or filtered by parent)"`
	ParentDomain      string       `json:"parent_domain,omitempty"      jsonschema:"The parent domain filter if specified"`
	ErrorMessage      string       `json:"error_message,omitempty"      jsonschema:"Error message if domain retrieval failed"`
	AvailableVersions []string     `json:"available_versions,omitempty" jsonschema:"List of available OASF schema versions"`
}

GetSchemaDomainsOutput represents the output after getting OASF schema domains.

type GetSchemaInput

type GetSchemaInput struct {
	Version string `json:"version" jsonschema:"OASF schema version to retrieve (e.g., 0.7.0, 0.8.0, 1.0.0)"`
}

GetSchemaInput represents the input for getting OASF schema content.

type GetSchemaOutput

type GetSchemaOutput struct {
	Version           string   `json:"version"                      jsonschema:"The requested OASF schema version"`
	Schema            string   `json:"schema"                       jsonschema:"The complete OASF schema JSON content"`
	ErrorMessage      string   `json:"error_message"                jsonschema:"Err	or message if schema retrieval failed"` //nolint:tagalign
	AvailableVersions []string `json:"available_versions,omitempty" jsonschema:"List of available OASF schema versions"`
}

GetSchemaOutput represents the output after getting OASF schema content.

type GetSchemaSkillsInput

type GetSchemaSkillsInput struct {
	Version     string `json:"version"                jsonschema:"OASF schema version to retrieve skills from (e.g., 0.7.0, 0.8.0)"`
	ParentSkill string `` /* 131-byte string literal not displayed */
}

GetSchemaSkillsInput represents the input for getting OASF schema skills.

type GetSchemaSkillsOutput

type GetSchemaSkillsOutput struct {
	Version           string      `json:"version"                      jsonschema:"The requested OASF schema version"`
	Skills            []SkillItem `json:"skills"                       jsonschema:"List of skills (top-level or filtered by parent)"`
	ParentSkill       string      `json:"parent_skill,omitempty"       jsonschema:"The parent skill filter if specified"`
	ErrorMessage      string      `json:"error_message,omitempty"      jsonschema:"Error message if skill retrieval failed"`
	AvailableVersions []string    `json:"available_versions,omitempty" jsonschema:"List of available OASF schema versions"`
}

GetSchemaSkillsOutput represents the output after getting OASF schema skills.

type ImportRecordInput

type ImportRecordInput struct {
	SourceData   string `` /* 183-byte string literal not displayed */
	SourceFormat string `json:"source_format" jsonschema:"Source format to import from (mcp, a2a, agentskills) (required)"`
}

ImportRecordInput defines the input parameters for importing a record.

type ImportRecordOutput

type ImportRecordOutput struct {
	RecordJSON   string `json:"record_json,omitempty"   jsonschema:"The imported OASF record (JSON string)"`
	ErrorMessage string `json:"error_message,omitempty" jsonschema:"Error message if import failed"`
}

ImportRecordOutput defines the output of importing a record.

type ListVersionsInput

type ListVersionsInput struct {
}

ListVersionsInput represents the input for listing available OASF schema versions.

type ListVersionsOutput

type ListVersionsOutput struct {
	AvailableVersions []string `json:"available_versions"      jsonschema:"List of available OASF schema versions"`
	DefaultVersion    string   `json:"default_version"         jsonschema:"The default OASF schema version"`
	Count             int      `json:"count"                   jsonschema:"Number of available schema versions"`
	ErrorMessage      string   `json:"error_message,omitempty" jsonschema:"Error message if version listing failed"`
}

ListVersionsOutput represents the output after listing available OASF schema versions.

type PullRecordInput

type PullRecordInput struct {
	CID string `json:"cid" jsonschema:"Content Identifier (CID) of the record to pull (required)"`
}

PullRecordInput defines the input parameters for pulling a record.

type PullRecordOutput

type PullRecordOutput struct {
	RecordData   string `json:"record_data,omitempty"   jsonschema:"The record data (JSON string)"`
	ErrorMessage string `json:"error_message,omitempty" jsonschema:"Error message if pull failed"`
}

PullRecordOutput defines the output of pulling a record.

type PushRecordInput

type PushRecordInput struct {
	RecordJSON string `json:"record_json" jsonschema:"JSON string of the OASF agent record to push to Directory server"`
}

PushRecordInput defines the input parameters for the push_record tool.

type PushRecordOutput

type PushRecordOutput struct {
	CID           string `json:"cid,omitempty"            jsonschema:"Content identifier (CID) of the pushed record"`
	ServerAddress string `json:"server_address,omitempty" jsonschema:"Directory server address where the record was pushed"`
	ErrorMessage  string `json:"error_message,omitempty"  jsonschema:"Error message if push failed"`
}

PushRecordOutput defines the output structure for the push_record tool.

type SearchLocalInput

type SearchLocalInput struct {
	Limit          int      `json:"limit,omitempty"           jsonschema:"Maximum number of results to return (default: 100 max: 1000)"`
	Offset         int      `json:"offset,omitempty"          jsonschema:"Pagination offset (default: 0)"`
	Names          []string `json:"names,omitempty"           jsonschema:"Agent name patterns (supports wildcards: * ?)"`
	Versions       []string `json:"versions,omitempty"        jsonschema:"Version patterns (supports wildcards: * ?)"`
	SkillIDs       []string `json:"skill_ids,omitempty"       jsonschema:"Skill ID patterns (exact match only)"`
	SkillNames     []string `json:"skill_names,omitempty"     jsonschema:"Skill name patterns (supports wildcards: * ?)"`
	Locators       []string `json:"locators,omitempty"        jsonschema:"Locator patterns (supports wildcards: * ?)"`
	ModuleNames    []string `json:"module_names,omitempty"    jsonschema:"Module name patterns (supports wildcards: * ?)"`
	DomainIDs      []string `json:"domain_ids,omitempty"      jsonschema:"Domain ID patterns (exact match only)"`
	DomainNames    []string `json:"domain_names,omitempty"    jsonschema:"Domain name patterns (supports wildcards: * ?)"`
	CreatedAts     []string `json:"created_ats,omitempty"     jsonschema:"Created_at timestamp patterns (supports wildcards: * ?)"`
	Authors        []string `json:"authors,omitempty"         jsonschema:"Author name patterns (supports wildcards: * ?)"`
	SchemaVersions []string `json:"schema_versions,omitempty" jsonschema:"Schema version patterns (supports wildcards: * ?)"`
	ModuleIDs      []string `json:"module_ids,omitempty"      jsonschema:"Module ID patterns (exact match only)"`
}

SearchLocalInput defines the input parameters for local search.

type SearchLocalOutput

type SearchLocalOutput struct {
	RecordCIDs   []string `json:"record_cids,omitempty"   jsonschema:"Array of matching record CIDs"`
	Count        int      `json:"count"                   jsonschema:"Number of results returned"`
	HasMore      bool     `json:"has_more"                jsonschema:"Whether more results are available beyond the limit"`
	ErrorMessage string   `json:"error_message,omitempty" jsonschema:"Error message if search failed"`
}

SearchLocalOutput defines the output of local search.

type SignerDetail

type SignerDetail struct {
	Identity string `json:"identity"`
	Issuer   string `json:"issuer,omitempty"`
}

SignerDetail provides a JSON-friendly representation of signer information.

type SkillItem

type SkillItem struct {
	Name    string `json:"name"`
	Caption string `json:"caption,omitempty"`
	ID      int    `json:"id,omitempty"`
}

SkillItem represents a skill in the OASF schema.

type Tools

type Tools struct {
	Client        *client.Client
	ServerAddress string
	Validator     corev1.Validator
}

Tools provides Directory client-dependent tool implementations. Create with NewTools and use the methods as MCP tool handlers.

Validator is required by tools that perform OASF schema validation (e.g. PushRecord, ValidateRecord). It is injected by the caller (the MCP server entrypoint) so that no process-wide singleton is needed and so that tests can supply fakes. See github.com/agntcy/dir issue #856.

func NewTools

func NewTools(ctx context.Context, validator corev1.Validator) (*Tools, error)

NewTools creates a new Tools instance with a Directory client and the provided OASF validator. The caller is responsible for calling Close() when done. The validator is owned by the caller; Close() does not touch it.

func (*Tools) Close

func (t *Tools) Close() error

Close releases the client resources.

func (*Tools) ExportRecord

ExportRecord exports an OASF agent record to a different format using the OASF SDK translator. Currently supported formats: - "a2a": Agent-to-Agent (A2A) format. - "ghcopilot": GitHub Copilot MCP configuration format. - "agentskills"/"agent-skill": Agent Skills SKILL.md markdown format.

func (*Tools) GetSchema

GetSchema retrieves the OASF schema content for the specified version. This tool provides direct access to the complete OASF schema JSON.

func (*Tools) GetSchemaDomains

GetSchemaDomains retrieves domains from the OASF schema for the specified version. If parent_domain is provided, returns only sub-domains under that parent. Otherwise, returns all top-level domains.

func (*Tools) GetSchemaSkills

GetSchemaSkills retrieves skills from the OASF schema for the specified version. If parent_skill is provided, returns only sub-skills under that parent. Otherwise, returns all top-level skills.

func (*Tools) ImportRecord

ImportRecord imports data from a different format to an OASF agent record using the OASF SDK translator. Currently supported formats: - "mcp": Model Context Protocol format. - "a2a": Agent-to-Agent (A2A) format. - "agentskills"/"agent-skill": Agent Skills SKILL.md markdown format.

func (*Tools) ListVersions

ListVersions retrieves the list of available OASF schema versions. This tool provides a simple way to discover what schema versions are supported.

func (*Tools) PullRecord

PullRecord pulls a record from the Directory by its CID.

func (*Tools) PushRecord

PushRecord implements the agntcy_dir_push_record tool. It pushes an OASF agent record to a Directory server and returns the CID.

func (*Tools) SearchLocal

SearchLocal searches for agent records on the local directory node.

func (*Tools) ValidateRecord

ValidateRecord validates an agent record against the OASF schema. This performs full OASF schema validation and returns detailed errors.

func (*Tools) VerifyName

VerifyName verifies that a record's name is owned by the domain it claims. This checks that the record was signed with a key published in the domain's well-known JWKS file.

func (*Tools) VerifyRecord

VerifyRecord verifies the signature of a record in the Directory by its CID.

type ValidateRecordInput

type ValidateRecordInput struct {
	RecordJSON string `json:"record_json" jsonschema:"JSON string of the agent record to validate against OASF schema"`
}

ValidateRecordInput represents the input for validating an agent record.

type ValidateRecordOutput

type ValidateRecordOutput struct {
	Valid            bool     `json:"valid"                       jsonschema:"Whether the record is valid according to OASF schema validation"`
	SchemaVersion    string   `json:"schema_version,omitempty"    jsonschema:"Detected OASF schema version (e.g. 0.7.0, 0.8.0, or 1.0.0)"`
	ValidationErrors []string `` /* 139-byte string literal not displayed */
	ErrorMessage     string   `json:"error_message,omitempty"     jsonschema:"General error message if validation process failed"`
}

ValidateRecordOutput represents the output after validating an agent record.

type VerifyNameInput

type VerifyNameInput struct {
	CID     string `json:"cid,omitempty"     jsonschema:"Content Identifier (CID) of the record to verify"`
	Name    string `json:"name,omitempty"    jsonschema:"Human-readable name of the record (e.g., 'example.com/my-agent')"`
	Version string `json:"version,omitempty" jsonschema:"Optional version to verify (e.g., 'v1.0.0'). If omitted, verifies the latest version."`
}

VerifyNameInput defines the input parameters for verifying a record's name ownership.

type VerifyNameOutput

type VerifyNameOutput struct {
	Verified           bool                      `json:"verified"                      jsonschema:"Whether the name ownership was verified"`
	DomainVerification *DomainVerificationDetail `json:"domain_verification,omitempty" jsonschema:"Details about the domain verification (only present if verified)"`
	ErrorMessage       string                    `json:"error_message,omitempty"       jsonschema:"Error message if verification failed"`
}

VerifyNameOutput defines the output of name verification.

type VerifyRecordInput

type VerifyRecordInput struct {
	CID string `json:"cid" jsonschema:"Content Identifier (CID) of the record to verify (required)"`
}

VerifyRecordInput defines the input parameters for verifying a record signature.

type VerifyRecordOutput

type VerifyRecordOutput struct {
	Success bool           `json:"success"           jsonschema:"Whether the signature verification was successful"`
	Message string         `json:"message"           jsonschema:"Status message indicating trust level"`
	Error   string         `json:"error,omitempty"   jsonschema:"Error message if verification request failed"`
	Signers []SignerDetail `json:"signers,omitempty" jsonschema:"Information about verified signers"`
}

VerifyRecordOutput defines the output of verifying a record signature.

Jump to

Keyboard shortcuts

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