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/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

View File

@@ -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
}

View File

@@ -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:

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
// 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,
}

View File

@@ -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,