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,
},
MCPConfig: api.MCPConfig{
Version: "1.0.0",
Version: "0.0.1",
RequestTimeout: 30 * time.Second,
MaxRequestSize: 10 * 1024 * 1024, // 10MB
},

View File

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

View File

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

View File

@@ -14,11 +14,8 @@
package types
// ListOrganizationsInput defines the input parameters for listOrganizations tool
// Empty struct since no arguments are required
type ListOrganizationsInput struct{}
// ListOrganizationsOutput defines the output structure for listOrganizations tool
type ListOrganizationsOutput struct {
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"
// Organization represents a single organization in MCP responses
type Organization struct {
Name string `json:"name" jsonschema:"the organization name"`
ID string `json:"id" jsonschema:"the organization ID"`
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 {
return Organization{
Name: o.Name,

View File

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