resource

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GetResourceToolDescription = `` /* 1452-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryBrowse added in v0.3.1

type CategoryBrowse struct {
	URI           string                   `json:"uri"`
	Subcategories []map[string]interface{} `json:"subcategories,omitempty"`
	Resources     []map[string]interface{} `json:"resources,omitempty"`
}

CategoryBrowse represents a directory listing of resources and subcategories

func NewCategoryBrowse added in v0.3.1

func NewCategoryBrowse(uri string, subcategories []map[string]interface{}, resources []map[string]interface{}) *CategoryBrowse

type GetResourceParams added in v0.3.1

type GetResourceParams struct {
	URI string `` /* 157-byte string literal not displayed */
}

GetResourceParams defines the input parameters for the get-resource tool

type GetResourceResult added in v0.3.1

type GetResourceResult struct {
	Resource *ResourceContent `json:"resource,omitempty"`
	Category *CategoryBrowse  `json:"category,omitempty"`
}

GetResourceResult is the unified response type for get-resource operations Either Resource OR Category will be populated, never both

func NewCategoryResult added in v0.3.1

func NewCategoryResult(category *CategoryBrowse) *GetResourceResult

func NewResourceResult added in v0.3.1

func NewResourceResult(resource *ResourceContent) *GetResourceResult

func (GetResourceResult) Unwrap added in v0.3.1

func (r GetResourceResult) Unwrap() any

Unwrap implements utils.Unwrapper to flatten the union for serialization.

type ResourceContent added in v0.3.1

type ResourceContent struct {
	URI      string      `json:"uri"`
	Name     string      `json:"name"`
	MIMEType string      `json:"mimeType,omitempty"`
	Content  string      `json:"content,omitempty"`
	Data     interface{} `json:"data,omitempty"`
}

ResourceContent represents a specific resource with content

func NewResourceContent added in v0.3.1

func NewResourceContent(uri, name, mimeType string) *ResourceContent

func (*ResourceContent) SetDataContent added in v0.3.1

func (rc *ResourceContent) SetDataContent(data interface{}) *ResourceContent

func (*ResourceContent) SetTextContent added in v0.3.1

func (rc *ResourceContent) SetTextContent(content string) *ResourceContent

type ResourceTool

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

func NewResourceTool

func NewResourceTool(registry *resources.ResourceRegistry) *ResourceTool

func (*ResourceTool) Definition

func (t *ResourceTool) Definition() mcp.Tool

func (*ResourceTool) Handle

func (*ResourceTool) Handler added in v0.3.1

func (t *ResourceTool) Handler() server.ToolHandlerFunc

func (*ResourceTool) Name added in v0.3.1

func (t *ResourceTool) Name() string

func (*ResourceTool) ValidateParams added in v0.3.1

func (t *ResourceTool) ValidateParams(params *GetResourceParams) error

func (*ResourceTool) ValidatePermissions added in v0.3.1

func (t *ResourceTool) ValidatePermissions(ctx context.Context, params GetResourceParams) error

Jump to

Keyboard shortcuts

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