resources

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FileURIPrefix = "file://"

URI prefix for file resources

Variables

This section is empty.

Functions

func EnsureUTF8 added in v0.0.2

func EnsureUTF8(data []byte) ([]byte, error)

EnsureUTF8 converts text to UTF-8 encoding

func FileExists added in v0.0.2

func FileExists(path string) bool

FileExists checks if a file exists and is accessible

func GetFileMIMEType added in v0.0.2

func GetFileMIMEType(path string) string

GetFileMIMEType returns the MIME type for a file

func IsLikelyTextFile added in v0.0.2

func IsLikelyTextFile(path string) bool

IsLikelyTextFile checks if a file is likely to be a text file

func LogDebug added in v0.0.2

func LogDebug(debug bool, format string, v ...interface{})

LogDebug logs a debug message if debug is enabled

func ReadFileContents added in v0.0.2

func ReadFileContents(path string) ([]byte, error)

ReadFileContents reads and returns the contents of a file handling encoding conversion to UTF-8

Types

type ResourceManager

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

ResourceManager manages file resources for the MCP server

func NewResourceManager

func NewResourceManager(workspacePath string, debug bool) *ResourceManager

NewResourceManager creates a new resource manager

func (*ResourceManager) GetFileURI

func (rm *ResourceManager) GetFileURI(path string) string

GetFileURI returns the URI for a file path

func (*ResourceManager) GetResourceIDFromPath

func (rm *ResourceManager) GetResourceIDFromPath(path string) string

GetResourceIDFromPath returns a resource ID from a file path

Jump to

Keyboard shortcuts

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