 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func AddDefaultTools(ts ...*Tool)
- func ClearDefaultTools()
- func ResultString(r any, logger util.Logger) string
- func UsageCLI() string
- func UsageHTTP() string
- func WireLibrary(s *Server, as *app.State, logger util.Logger) error
- type Prompt
- type PromptHandler
- type Prompts
- type Resource
- func NewBlobResource(name string, description string, uri string, mimeType string, content []byte) *Resource
- func NewResourceTemplate(name string, description string, uri string, mimeType string, content string) *Resource
- func NewTextResource(name string, description string, uri string, mimeType string, content string) *Resource
 
- type ResourceTemplate
- type ResourceTemplateHandler
- type ResourceTemplates
- type Resources
- type Server
- func (s *Server) AddPrompts(as *app.State, logger util.Logger, prompts ...*Prompt) error
- func (s *Server) AddResourceTemplates(as *app.State, logger util.Logger, resources ...*ResourceTemplate) error
- func (s *Server) AddResources(as *app.State, logger util.Logger, resources ...*Resource) error
- func (s *Server) AddTools(as *app.State, logger util.Logger, tools ...*Tool) error
- func (s *Server) ServeCLI(ctx context.Context) error
- func (s *Server) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, ...)
 
- type Tool
- type ToolHandler
- type Tools
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
    var ( AllTools = Tools{ListProjectsTool, GetProjectTool} AllResources = Resources{} AllResourceTemplates = ResourceTemplates{ProjectContentResource} AllPrompts = Prompts{ProjectPrompt} )
      View Source
      
  
    var ExampleTool = &Tool{ Name: "example_mcp_server", Description: "Returns a random integer", Args: util.FieldDescs{{Key: "max", Description: "Maximum possible random int (exclusive), defaults to 100"}}, Fn: exampleHandler, }
      View Source
      
  
    var GetProjectTool = &Tool{ Name: "get_project", Description: "Get details of a specific project managed by " + util.AppName, Args: util.FieldDescs{ {Key: "id", Description: "Optional project id. If omitted, all projects will be returned"}, }, Fn: getProjectHandler, }
      View Source
      
  
    var ListProjectsTool = &Tool{ Name: "list_projects", Description: "List the projects managed by " + util.AppName, Fn: listProjectsHandler, }
      View Source
      
  
    var ProjectContentResource = &ResourceTemplate{ Name: "project_content", Description: "Get details of a specific file within a project managed by " + util.AppName, URI: fmt.Sprintf(uriTemplate, "{id}", "{path*}"), Args: util.FieldDescs{ {Key: "id", Description: "Project ID", Type: "string"}, {Key: "path", Description: "Path to the file within the project"}, }, Fn: projectContentHandler, }
      View Source
      
  
    var ProjectPrompt = &Prompt{ Name: "project_usage", Description: "A simple prompt that helps the system build, test, and work with an application managed by Project Forge" + util.AppName, Content: `This application is written using Go, and is a web application managed by Project Forge.`, }
      View Source
      
  
var ResourceTemplateArgs = util.FieldDescs{{Key: "uri", Description: "URI to request", Type: "string"}}
    Functions ¶
func AddDefaultTools ¶ added in v1.7.12
func AddDefaultTools(ts ...*Tool)
func ClearDefaultTools ¶ added in v1.7.12
func ClearDefaultTools()
Types ¶
type Prompt ¶ added in v1.7.14
type Prompt struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Content     string `json:"content,omitempty"`
}
    func NewStaticPrompt ¶ added in v1.7.14
type PromptHandler ¶ added in v1.7.14
type Resource ¶ added in v1.7.14
type Resource struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
	URI         string `json:"uri"`
	MIMEType    string `json:"mimeType"`
	Content     string `json:"content"`
	Binary      bool   `json:"binary,omitempty"`
}
    func NewBlobResource ¶ added in v1.7.14
func NewResourceTemplate ¶ added in v1.7.15
func NewTextResource ¶ added in v1.7.14
type ResourceTemplate ¶ added in v1.7.15
type ResourceTemplate struct {
	Name        string                  `json:"name"`
	Description string                  `json:"description,omitempty"`
	Icon        string                  `json:"icon,omitempty"`
	URI         string                  `json:"uri"`
	MIMEType    string                  `json:"mimeType"`
	Args        util.FieldDescs         `json:"args,omitempty"`
	Fn          ResourceTemplateHandler `json:"-"`
}
    func (*ResourceTemplate) Handler ¶ added in v1.7.15
func (r *ResourceTemplate) Handler(as *app.State, logger util.Logger) server.ResourceTemplateHandlerFunc
func (*ResourceTemplate) IconSafe ¶ added in v1.7.15
func (r *ResourceTemplate) IconSafe() string
func (*ResourceTemplate) ToMCP ¶ added in v1.7.15
func (r *ResourceTemplate) ToMCP() (mcp.ResourceTemplate, error)
type ResourceTemplateHandler ¶ added in v1.7.15
type ResourceTemplates ¶ added in v1.7.15
type ResourceTemplates []*ResourceTemplate
func (ResourceTemplates) Get ¶ added in v1.7.15
func (r ResourceTemplates) Get(n string) *ResourceTemplate
type Server ¶
type Server struct {
	MCP               *server.MCPServer `json:"-"`
	State             *app.State        `json:"-"`
	Resources         Resources         `json:"resources"`
	ResourceTemplates ResourceTemplates `json:"resourceTemplates"`
	Prompts           Prompts           `json:"prompts"`
	Tools             Tools             `json:"tools"`
	HTTP              http.Handler      `json:"-"`
}
    func CurrentDefaultServer ¶ added in v1.7.13
func CurrentDefaultServer() *Server
func GetDefaultServer ¶ added in v1.7.12
func (*Server) AddPrompts ¶ added in v1.7.14
func (*Server) AddResourceTemplates ¶ added in v1.7.15
func (*Server) AddResources ¶ added in v1.7.14
type Tool ¶
type Tool struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Icon        string          `json:"icon,omitempty"`
	Args        util.FieldDescs `json:"args,omitempty"`
	Fn          ToolHandler     `json:"-"`
}
    type ToolHandler ¶
 Click to show internal directories. 
   Click to hide internal directories.