pocketbase

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package pocketbase provides integration between Cortex and PocketBase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CortexPlugin

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

CortexPlugin is a PocketBase plugin that provides Cortex MCP server capabilities.

func NewCortexPlugin

func NewCortexPlugin(opts ...Option) *CortexPlugin

NewCortexPlugin creates a new CortexPlugin with the given options.

func (*CortexPlugin) AddTool

func (p *CortexPlugin) AddTool(tool *types.Tool, handler func(ctx context.Context, request ToolCallRequest) (interface{}, error)) error

AddTool adds a tool to the Cortex server.

func (*CortexPlugin) GetBasePath

func (p *CortexPlugin) GetBasePath() string

GetBasePath returns the base path configured for the plugin.

func (*CortexPlugin) GetHTTPHandler

func (p *CortexPlugin) GetHTTPHandler() http.Handler

GetHTTPHandler returns an HTTP handler for the Cortex server. This can be used to integrate with PocketBase or any other HTTP server.

func (*CortexPlugin) GetSSEHandler

func (p *CortexPlugin) GetSSEHandler() http.Handler

GetSSEHandler returns a dedicated handler just for the SSE endpoint

func (*CortexPlugin) GetServerInfo

func (p *CortexPlugin) GetServerInfo() server.ServerInfo

GetServerInfo returns basic information about the Cortex server.

func (*CortexPlugin) RegisterWithPocketBase

func (p *CortexPlugin) RegisterWithPocketBase(app interface{}) error

RegisterWithPocketBase registers the Cortex plugin with a PocketBase app. This method would be implemented when we have access to the PocketBase API.

type Option

type Option func(*CortexPlugin)

Option is a function that configures a CortexPlugin.

func WithBasePath

func WithBasePath(basePath string) Option

WithBasePath sets the base path for the Cortex server routes.

func WithLogger

func WithLogger(logger *log.Logger) Option

WithLogger sets the logger for the Cortex server.

func WithName

func WithName(name string) Option

WithName sets the name of the Cortex server.

func WithPort

func WithPort(port int) Option

WithPort sets the port for the Cortex server.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the version of the Cortex server.

type ToolCallRequest

type ToolCallRequest struct {
	Name       string
	Parameters map[string]interface{}
	Session    *types.ClientSession
}

ToolCallRequest represents a request to execute a tool.

Jump to

Keyboard shortcuts

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