From 51414780838b8b3bc0b83f5cc6eb36252a96aa56 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 22 Jun 2026 10:59:28 +0200 Subject: [PATCH] Replace trust center alias MCP tools with resource alias Rename the setTrustCenterAlias and removeTrustCenterAlias MCP tools to setResourceAlias and removeResourceAlias, backed by the resourcealias service. Signed-off-by: Bryan Frimin --- pkg/server/api/mcp/v1/resolver.go | 2 ++ pkg/server/api/mcp/v1/schema.resolvers.go | 30 ++++++++-------- pkg/server/api/mcp/v1/specification.yaml | 36 +++++++++---------- ...rust_center_alias.go => resource_alias.go} | 6 ++-- pkg/server/api/mcp/v1/v1_handler.go | 3 ++ 5 files changed, 42 insertions(+), 35 deletions(-) rename pkg/server/api/mcp/v1/types/{trust_center_alias.go => resource_alias.go} (83%) diff --git a/pkg/server/api/mcp/v1/resolver.go b/pkg/server/api/mcp/v1/resolver.go index 333ccd22e..60c28ed8a 100644 --- a/pkg/server/api/mcp/v1/resolver.go +++ b/pkg/server/api/mcp/v1/resolver.go @@ -32,6 +32,7 @@ import ( "go.probo.inc/probo/pkg/iam" "go.probo.inc/probo/pkg/probo" "go.probo.inc/probo/pkg/prosemirror" + "go.probo.inc/probo/pkg/resourcealias" "go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/thirdparty" @@ -39,6 +40,7 @@ import ( type Resolver struct { proboSvc *probo.Service + resourceAlias *resourcealias.Service thirdPartySvc *thirdparty.Service iamSvc *iam.Service accessReview *accessreview.Service diff --git a/pkg/server/api/mcp/v1/schema.resolvers.go b/pkg/server/api/mcp/v1/schema.resolvers.go index 73fba3d2f..a5ba91885 100644 --- a/pkg/server/api/mcp/v1/schema.resolvers.go +++ b/pkg/server/api/mcp/v1/schema.resolvers.go @@ -21,6 +21,7 @@ import ( "go.probo.inc/probo/pkg/mail" "go.probo.inc/probo/pkg/page" "go.probo.inc/probo/pkg/probo" + "go.probo.inc/probo/pkg/resourcealias" "go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/server/api/mcp/v1/types" @@ -7044,40 +7045,41 @@ func (r *Resolver) DeleteRiskAssessmentBoundaryTool(ctx context.Context, req *mc }, nil } -func (r *Resolver) SetTrustCenterAliasTool(ctx context.Context, req *mcp.CallToolRequest, input *types.SetTrustCenterAliasInput) (*mcp.CallToolResult, types.SetTrustCenterAliasOutput, error) { - scope, err := r.Authorize(ctx, input.ResourceID, probo.ActionTrustCenterAliasSet) +func (r *Resolver) SetResourceAliasTool(ctx context.Context, req *mcp.CallToolRequest, input *types.SetResourceAliasInput) (*mcp.CallToolResult, types.SetResourceAliasOutput, error) { + scope, err := r.Authorize(ctx, input.ResourceID, resourcealias.ActionAliasSet) if err != nil { - return nil, types.SetTrustCenterAliasOutput{}, err + return nil, types.SetResourceAliasOutput{}, err } - alias, err := r.proboSvc.TrustCenterAliases.Create( + alias, err := r.resourceAlias.Create( ctx, scope, - probo.CreateTrustCenterAliasRequest{ + resourcealias.CreateRequest{ ResourceID: input.ResourceID, Alias: input.Alias, }, ) if err != nil { - return nil, types.SetTrustCenterAliasOutput{}, fmt.Errorf("cannot set trust center alias: %w", err) + return nil, types.SetResourceAliasOutput{}, fmt.Errorf("cannot set resource alias: %w", err) } - return nil, types.SetTrustCenterAliasOutput{ - TrustCenterAlias: types.NewTrustCenterAlias(input.ResourceID, alias), + return nil, types.SetResourceAliasOutput{ + ResourceAlias: types.NewResourceAlias(input.ResourceID, alias), }, nil } -func (r *Resolver) RemoveTrustCenterAliasTool(ctx context.Context, req *mcp.CallToolRequest, input *types.RemoveTrustCenterAliasInput) (*mcp.CallToolResult, types.RemoveTrustCenterAliasOutput, error) { - scope, err := r.Authorize(ctx, input.ResourceID, probo.ActionTrustCenterAliasRemove) + +func (r *Resolver) RemoveResourceAliasTool(ctx context.Context, req *mcp.CallToolRequest, input *types.RemoveResourceAliasInput) (*mcp.CallToolResult, types.RemoveResourceAliasOutput, error) { + scope, err := r.Authorize(ctx, input.ResourceID, resourcealias.ActionAliasRemove) if err != nil { - return nil, types.RemoveTrustCenterAliasOutput{}, err + return nil, types.RemoveResourceAliasOutput{}, err } - _, err = r.proboSvc.TrustCenterAliases.Remove(ctx, scope, input.ResourceID) + err = r.resourceAlias.Remove(ctx, scope, input.ResourceID) if err != nil { - return nil, types.RemoveTrustCenterAliasOutput{}, fmt.Errorf("cannot remove trust center alias: %w", err) + return nil, types.RemoveResourceAliasOutput{}, fmt.Errorf("cannot remove resource alias: %w", err) } - return nil, types.RemoveTrustCenterAliasOutput{ + return nil, types.RemoveResourceAliasOutput{ DeletedResourceID: input.ResourceID, }, nil } diff --git a/pkg/server/api/mcp/v1/specification.yaml b/pkg/server/api/mcp/v1/specification.yaml index c7bb1017f..a1054cc1b 100644 --- a/pkg/server/api/mcp/v1/specification.yaml +++ b/pkg/server/api/mcp/v1/specification.yaml @@ -9160,7 +9160,7 @@ components: $ref: "#/components/schemas/GID" description: Deleted trust center reference ID - TrustCenterAlias: + ResourceAlias: type: object required: - resource_id @@ -9173,7 +9173,7 @@ components: type: string description: Human-readable alias slug - SetTrustCenterAliasInput: + SetResourceAliasInput: type: object required: - resource_id @@ -9181,29 +9181,29 @@ components: properties: resource_id: $ref: "#/components/schemas/GID" - description: Document, trust center file, or audit ID + description: ID of the resource to alias alias: type: string description: Human-readable alias slug - SetTrustCenterAliasOutput: + SetResourceAliasOutput: type: object required: - - trust_center_alias + - resource_alias properties: - trust_center_alias: - $ref: "#/components/schemas/TrustCenterAlias" + resource_alias: + $ref: "#/components/schemas/ResourceAlias" - RemoveTrustCenterAliasInput: + RemoveResourceAliasInput: type: object required: - resource_id properties: resource_id: $ref: "#/components/schemas/GID" - description: Document, trust center file, or audit ID + description: ID of the resource whose alias to remove - RemoveTrustCenterAliasOutput: + RemoveResourceAliasOutput: type: object required: - deleted_resource_id @@ -13676,23 +13676,23 @@ tools: $ref: "#/components/schemas/DeleteTrustCenterReferenceInput" outputSchema: $ref: "#/components/schemas/DeleteTrustCenterReferenceOutput" - - name: setTrustCenterAlias - description: Set a trust center alias for a document, file, or audit + - name: setResourceAlias + description: Set a resource alias for a resource hints: readonly: false inputSchema: - $ref: "#/components/schemas/SetTrustCenterAliasInput" + $ref: "#/components/schemas/SetResourceAliasInput" outputSchema: - $ref: "#/components/schemas/SetTrustCenterAliasOutput" - - name: removeTrustCenterAlias - description: Remove a trust center alias from a resource + $ref: "#/components/schemas/SetResourceAliasOutput" + - name: removeResourceAlias + description: Remove a resource alias from a resource hints: readonly: false destructive: true inputSchema: - $ref: "#/components/schemas/RemoveTrustCenterAliasInput" + $ref: "#/components/schemas/RemoveResourceAliasInput" outputSchema: - $ref: "#/components/schemas/RemoveTrustCenterAliasOutput" + $ref: "#/components/schemas/RemoveResourceAliasOutput" - name: listTrustCenterFiles description: List all files for the trust center hints: diff --git a/pkg/server/api/mcp/v1/types/trust_center_alias.go b/pkg/server/api/mcp/v1/types/resource_alias.go similarity index 83% rename from pkg/server/api/mcp/v1/types/trust_center_alias.go rename to pkg/server/api/mcp/v1/types/resource_alias.go index 49dfdf6e9..e8ec73386 100644 --- a/pkg/server/api/mcp/v1/types/trust_center_alias.go +++ b/pkg/server/api/mcp/v1/types/resource_alias.go @@ -1,4 +1,4 @@ -// Copyright (c) 2026 Probo Inc . +// Copyright (c) 2025-2026 Probo Inc . // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,8 +19,8 @@ import ( "go.probo.inc/probo/pkg/gid" ) -func NewTrustCenterAlias(resourceID gid.GID, alias *coredata.TrustCenterAlias) *TrustCenterAlias { - return &TrustCenterAlias{ +func NewResourceAlias(resourceID gid.GID, alias *coredata.ResourceAlias) *ResourceAlias { + return &ResourceAlias{ ResourceID: resourceID, Alias: alias.Alias, } diff --git a/pkg/server/api/mcp/v1/v1_handler.go b/pkg/server/api/mcp/v1/v1_handler.go index 69fd798df..c4cc6b2de 100644 --- a/pkg/server/api/mcp/v1/v1_handler.go +++ b/pkg/server/api/mcp/v1/v1_handler.go @@ -27,6 +27,7 @@ import ( "go.probo.inc/probo/pkg/filemanager" "go.probo.inc/probo/pkg/iam" "go.probo.inc/probo/pkg/probo" + "go.probo.inc/probo/pkg/resourcealias" "go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/server/api/mcp/mcputils" @@ -37,6 +38,7 @@ import ( func NewMux( logger *log.Logger, proboSvc *probo.Service, + resourceAliasSvc *resourcealias.Service, thirdPartySvc *thirdparty.Service, iamSvc *iam.Service, accessReviewSvc *accessreview.Service, @@ -52,6 +54,7 @@ func NewMux( resolver := &Resolver{ proboSvc: proboSvc, + resourceAlias: resourceAliasSvc, thirdPartySvc: thirdPartySvc, iamSvc: iamSvc, accessReview: accessReviewSvc,