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 <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-22 10:59:28 +02:00
parent 7f47b6efb7
commit 5141478083
5 changed files with 42 additions and 35 deletions

View File

@@ -32,6 +32,7 @@ import (
"go.probo.inc/probo/pkg/iam" "go.probo.inc/probo/pkg/iam"
"go.probo.inc/probo/pkg/probo" "go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/prosemirror" "go.probo.inc/probo/pkg/prosemirror"
"go.probo.inc/probo/pkg/resourcealias"
"go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/riskmanagement"
"go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/server/api/authn"
"go.probo.inc/probo/pkg/thirdparty" "go.probo.inc/probo/pkg/thirdparty"
@@ -39,6 +40,7 @@ import (
type Resolver struct { type Resolver struct {
proboSvc *probo.Service proboSvc *probo.Service
resourceAlias *resourcealias.Service
thirdPartySvc *thirdparty.Service thirdPartySvc *thirdparty.Service
iamSvc *iam.Service iamSvc *iam.Service
accessReview *accessreview.Service accessReview *accessreview.Service

View File

@@ -21,6 +21,7 @@ import (
"go.probo.inc/probo/pkg/mail" "go.probo.inc/probo/pkg/mail"
"go.probo.inc/probo/pkg/page" "go.probo.inc/probo/pkg/page"
"go.probo.inc/probo/pkg/probo" "go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/resourcealias"
"go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/riskmanagement"
"go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/server/api/authn"
"go.probo.inc/probo/pkg/server/api/mcp/v1/types" "go.probo.inc/probo/pkg/server/api/mcp/v1/types"
@@ -7044,40 +7045,41 @@ func (r *Resolver) DeleteRiskAssessmentBoundaryTool(ctx context.Context, req *mc
}, nil }, nil
} }
func (r *Resolver) SetTrustCenterAliasTool(ctx context.Context, req *mcp.CallToolRequest, input *types.SetTrustCenterAliasInput) (*mcp.CallToolResult, types.SetTrustCenterAliasOutput, error) { 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, probo.ActionTrustCenterAliasSet) scope, err := r.Authorize(ctx, input.ResourceID, resourcealias.ActionAliasSet)
if err != nil { 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, ctx,
scope, scope,
probo.CreateTrustCenterAliasRequest{ resourcealias.CreateRequest{
ResourceID: input.ResourceID, ResourceID: input.ResourceID,
Alias: input.Alias, Alias: input.Alias,
}, },
) )
if err != nil { 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{ return nil, types.SetResourceAliasOutput{
TrustCenterAlias: types.NewTrustCenterAlias(input.ResourceID, alias), ResourceAlias: types.NewResourceAlias(input.ResourceID, alias),
}, nil }, 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 { 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 { 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, DeletedResourceID: input.ResourceID,
}, nil }, nil
} }

View File

@@ -9160,7 +9160,7 @@ components:
$ref: "#/components/schemas/GID" $ref: "#/components/schemas/GID"
description: Deleted trust center reference ID description: Deleted trust center reference ID
TrustCenterAlias: ResourceAlias:
type: object type: object
required: required:
- resource_id - resource_id
@@ -9173,7 +9173,7 @@ components:
type: string type: string
description: Human-readable alias slug description: Human-readable alias slug
SetTrustCenterAliasInput: SetResourceAliasInput:
type: object type: object
required: required:
- resource_id - resource_id
@@ -9181,29 +9181,29 @@ components:
properties: properties:
resource_id: resource_id:
$ref: "#/components/schemas/GID" $ref: "#/components/schemas/GID"
description: Document, trust center file, or audit ID description: ID of the resource to alias
alias: alias:
type: string type: string
description: Human-readable alias slug description: Human-readable alias slug
SetTrustCenterAliasOutput: SetResourceAliasOutput:
type: object type: object
required: required:
- trust_center_alias - resource_alias
properties: properties:
trust_center_alias: resource_alias:
$ref: "#/components/schemas/TrustCenterAlias" $ref: "#/components/schemas/ResourceAlias"
RemoveTrustCenterAliasInput: RemoveResourceAliasInput:
type: object type: object
required: required:
- resource_id - resource_id
properties: properties:
resource_id: resource_id:
$ref: "#/components/schemas/GID" $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 type: object
required: required:
- deleted_resource_id - deleted_resource_id
@@ -13676,23 +13676,23 @@ tools:
$ref: "#/components/schemas/DeleteTrustCenterReferenceInput" $ref: "#/components/schemas/DeleteTrustCenterReferenceInput"
outputSchema: outputSchema:
$ref: "#/components/schemas/DeleteTrustCenterReferenceOutput" $ref: "#/components/schemas/DeleteTrustCenterReferenceOutput"
- name: setTrustCenterAlias - name: setResourceAlias
description: Set a trust center alias for a document, file, or audit description: Set a resource alias for a resource
hints: hints:
readonly: false readonly: false
inputSchema: inputSchema:
$ref: "#/components/schemas/SetTrustCenterAliasInput" $ref: "#/components/schemas/SetResourceAliasInput"
outputSchema: outputSchema:
$ref: "#/components/schemas/SetTrustCenterAliasOutput" $ref: "#/components/schemas/SetResourceAliasOutput"
- name: removeTrustCenterAlias - name: removeResourceAlias
description: Remove a trust center alias from a resource description: Remove a resource alias from a resource
hints: hints:
readonly: false readonly: false
destructive: true destructive: true
inputSchema: inputSchema:
$ref: "#/components/schemas/RemoveTrustCenterAliasInput" $ref: "#/components/schemas/RemoveResourceAliasInput"
outputSchema: outputSchema:
$ref: "#/components/schemas/RemoveTrustCenterAliasOutput" $ref: "#/components/schemas/RemoveResourceAliasOutput"
- name: listTrustCenterFiles - name: listTrustCenterFiles
description: List all files for the trust center description: List all files for the trust center
hints: hints:

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>. // Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
@@ -19,8 +19,8 @@ import (
"go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/gid"
) )
func NewTrustCenterAlias(resourceID gid.GID, alias *coredata.TrustCenterAlias) *TrustCenterAlias { func NewResourceAlias(resourceID gid.GID, alias *coredata.ResourceAlias) *ResourceAlias {
return &TrustCenterAlias{ return &ResourceAlias{
ResourceID: resourceID, ResourceID: resourceID,
Alias: alias.Alias, Alias: alias.Alias,
} }

View File

@@ -27,6 +27,7 @@ import (
"go.probo.inc/probo/pkg/filemanager" "go.probo.inc/probo/pkg/filemanager"
"go.probo.inc/probo/pkg/iam" "go.probo.inc/probo/pkg/iam"
"go.probo.inc/probo/pkg/probo" "go.probo.inc/probo/pkg/probo"
"go.probo.inc/probo/pkg/resourcealias"
"go.probo.inc/probo/pkg/riskmanagement" "go.probo.inc/probo/pkg/riskmanagement"
"go.probo.inc/probo/pkg/server/api/authn" "go.probo.inc/probo/pkg/server/api/authn"
"go.probo.inc/probo/pkg/server/api/mcp/mcputils" "go.probo.inc/probo/pkg/server/api/mcp/mcputils"
@@ -37,6 +38,7 @@ import (
func NewMux( func NewMux(
logger *log.Logger, logger *log.Logger,
proboSvc *probo.Service, proboSvc *probo.Service,
resourceAliasSvc *resourcealias.Service,
thirdPartySvc *thirdparty.Service, thirdPartySvc *thirdparty.Service,
iamSvc *iam.Service, iamSvc *iam.Service,
accessReviewSvc *accessreview.Service, accessReviewSvc *accessreview.Service,
@@ -52,6 +54,7 @@ func NewMux(
resolver := &Resolver{ resolver := &Resolver{
proboSvc: proboSvc, proboSvc: proboSvc,
resourceAlias: resourceAliasSvc,
thirdPartySvc: thirdPartySvc, thirdPartySvc: thirdPartySvc,
iamSvc: iamSvc, iamSvc: iamSvc,
accessReview: accessReviewSvc, accessReview: accessReviewSvc,