Use enum values

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-11-12 12:04:18 +01:00
parent 944f61da15
commit 6d1760ce9b
6 changed files with 24 additions and 38 deletions

View File

@@ -417,7 +417,7 @@ func (impl *Implm) Run(
CookieSecure: impl.cfg.Auth.Cookie.Secure, CookieSecure: impl.cfg.Auth.Cookie.Secure,
}, },
MCPConfig: api.MCPConfig{ MCPConfig: api.MCPConfig{
Version: "1.0.0", Version: "0.0.1",
RequestTimeout: 30 * time.Second, RequestTimeout: 30 * time.Second,
MaxRequestSize: 10 * 1024 * 1024, // 10MB MaxRequestSize: 10 * 1024 * 1024, // 10MB
}, },

View File

@@ -72,7 +72,6 @@ type (
Logger *log.Logger Logger *log.Logger
} }
// MCPConfig holds configuration for MCP
MCPConfig struct { MCPConfig struct {
Version string Version string
RequestTimeout time.Duration RequestTimeout time.Duration

View File

@@ -22,17 +22,12 @@ import (
) )
type ( type (
// Config holds configuration for the MCP server
Config struct { Config struct {
// Version is the MCP server version
Version string Version string
// RequestTimeout is the maximum duration for a request
RequestTimeout time.Duration RequestTimeout time.Duration
// MaxRequestSize is the maximum size of a request body in bytes
MaxRequestSize int64 MaxRequestSize int64
} }
// MCPContext holds the authenticated context for MCP requests
MCPContext struct { MCPContext struct {
UserID gid.GID UserID gid.GID
TenantIDs []gid.TenantID TenantIDs []gid.TenantID
@@ -45,18 +40,15 @@ var (
mcpContextKey = &ctxKey{name: "mcp_context"} mcpContextKey = &ctxKey{name: "mcp_context"}
) )
// MCPContextFromContext extracts the MCP context from the request context
func MCPContextFromContext(ctx context.Context) *MCPContext { func MCPContextFromContext(ctx context.Context) *MCPContext {
mcpCtx, _ := ctx.Value(mcpContextKey).(*MCPContext) mcpCtx, _ := ctx.Value(mcpContextKey).(*MCPContext)
return mcpCtx return mcpCtx
} }
// ContextWithMCPContext adds the MCP context to the request context
func ContextWithMCPContext(ctx context.Context, mcpCtx *MCPContext) context.Context { func ContextWithMCPContext(ctx context.Context, mcpCtx *MCPContext) context.Context {
return context.WithValue(ctx, mcpContextKey, mcpCtx) return context.WithValue(ctx, mcpContextKey, mcpCtx)
} }
// DefaultConfig returns a default MCP configuration
func DefaultConfig() Config { func DefaultConfig() Config {
return Config{ return Config{
Version: "1.0.0", Version: "1.0.0",

View File

@@ -14,11 +14,8 @@
package types package types
// ListOrganizationsInput defines the input parameters for listOrganizations tool
// Empty struct since no arguments are required
type ListOrganizationsInput struct{} type ListOrganizationsInput struct{}
// ListOrganizationsOutput defines the output structure for listOrganizations tool
type ListOrganizationsOutput struct { type ListOrganizationsOutput struct {
Organizations []Organization `json:"organizations" jsonschema:"list of organizations the user has access to"` Organizations []Organization `json:"organizations" jsonschema:"list of organizations the user has access to"`
} }

View File

@@ -16,14 +16,12 @@ package types
import "go.probo.inc/probo/pkg/coredata" import "go.probo.inc/probo/pkg/coredata"
// Organization represents a single organization in MCP responses
type Organization struct { type Organization struct {
Name string `json:"name" jsonschema:"the organization name"` Name string `json:"name" jsonschema:"the organization name"`
ID string `json:"id" jsonschema:"the organization ID"` ID string `json:"id" jsonschema:"the organization ID"`
TenantID string `json:"tenantID" jsonschema:"the tenant ID this organization belongs to"` TenantID string `json:"tenantID" jsonschema:"the tenant ID this organization belongs to"`
} }
// NewOrganization converts a coredata.Organization to an MCP Organization
func NewOrganization(o *coredata.Organization) Organization { func NewOrganization(o *coredata.Organization) Organization {
return Organization{ return Organization{
Name: o.Name, Name: o.Name,

View File

@@ -136,28 +136,28 @@ var (
VendorCategorySchema = &jsonschema.Schema{ VendorCategorySchema = &jsonschema.Schema{
Type: "string", Type: "string",
Enum: []any{ Enum: []any{
"ANALYTICS", coredata.VendorCategoryAnalytics.String(),
"CLOUD_MONITORING", coredata.VendorCategoryCloudMonitoring.String(),
"CLOUD_PROVIDER", coredata.VendorCategoryCloudProvider.String(),
"COLLABORATION", coredata.VendorCategoryCollaboration.String(),
"CUSTOMER_SUPPORT", coredata.VendorCategoryCustomerSupport.String(),
"DATA_STORAGE_AND_PROCESSING", coredata.VendorCategoryDataStorageAndProcessing.String(),
"DOCUMENT_MANAGEMENT", coredata.VendorCategoryDocumentManagement.String(),
"EMPLOYEE_MANAGEMENT", coredata.VendorCategoryEmployeeManagement.String(),
"ENGINEERING", coredata.VendorCategoryEngineering.String(),
"FINANCE", coredata.VendorCategoryFinance.String(),
"IDENTITY_PROVIDER", coredata.VendorCategoryIdentityProvider.String(),
"IT", coredata.VendorCategoryIT.String(),
"MARKETING", coredata.VendorCategoryMarketing.String(),
"OFFICE_OPERATIONS", coredata.VendorCategoryOfficeOperations.String(),
"OTHER", coredata.VendorCategoryOther.String(),
"PASSWORD_MANAGEMENT", coredata.VendorCategoryPasswordManagement.String(),
"PRODUCT_AND_DESIGN", coredata.VendorCategoryProductAndDesign.String(),
"PROFESSIONAL_SERVICES", coredata.VendorCategoryProfessionalServices.String(),
"RECRUITING", coredata.VendorCategoryRecruiting.String(),
"SALES", coredata.VendorCategorySales.String(),
"SECURITY", coredata.VendorCategorySecurity.String(),
"VERSION_CONTROL", coredata.VendorCategoryVersionControl.String(),
}, },
} }