Add setTrustCenterAlias and removeTrustCenterAlias MCP tools
Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -7043,3 +7043,41 @@ func (r *Resolver) DeleteRiskAssessmentBoundaryTool(ctx context.Context, req *mc
|
|||||||
DeletedRiskAssessmentBoundaryID: input.ID,
|
DeletedRiskAssessmentBoundaryID: input.ID,
|
||||||
}, nil
|
}, 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)
|
||||||
|
if err != nil {
|
||||||
|
return nil, types.SetTrustCenterAliasOutput{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
alias, err := r.proboSvc.TrustCenterAliases.Create(
|
||||||
|
ctx,
|
||||||
|
scope,
|
||||||
|
probo.CreateTrustCenterAliasRequest{
|
||||||
|
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.SetTrustCenterAliasOutput{
|
||||||
|
TrustCenterAlias: types.NewTrustCenterAlias(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)
|
||||||
|
if err != nil {
|
||||||
|
return nil, types.RemoveTrustCenterAliasOutput{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = r.proboSvc.TrustCenterAliases.Remove(ctx, scope, input.ResourceID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, types.RemoveTrustCenterAliasOutput{}, fmt.Errorf("cannot remove trust center alias: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, types.RemoveTrustCenterAliasOutput{
|
||||||
|
DeletedResourceID: input.ResourceID,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -9160,6 +9160,58 @@ components:
|
|||||||
$ref: "#/components/schemas/GID"
|
$ref: "#/components/schemas/GID"
|
||||||
description: Deleted trust center reference ID
|
description: Deleted trust center reference ID
|
||||||
|
|
||||||
|
TrustCenterAlias:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- resource_id
|
||||||
|
- alias
|
||||||
|
properties:
|
||||||
|
resource_id:
|
||||||
|
$ref: "#/components/schemas/GID"
|
||||||
|
description: Document, trust center file, or audit ID
|
||||||
|
alias:
|
||||||
|
type: string
|
||||||
|
description: Human-readable alias slug
|
||||||
|
|
||||||
|
SetTrustCenterAliasInput:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- resource_id
|
||||||
|
- alias
|
||||||
|
properties:
|
||||||
|
resource_id:
|
||||||
|
$ref: "#/components/schemas/GID"
|
||||||
|
description: Document, trust center file, or audit ID
|
||||||
|
alias:
|
||||||
|
type: string
|
||||||
|
description: Human-readable alias slug
|
||||||
|
|
||||||
|
SetTrustCenterAliasOutput:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- trust_center_alias
|
||||||
|
properties:
|
||||||
|
trust_center_alias:
|
||||||
|
$ref: "#/components/schemas/TrustCenterAlias"
|
||||||
|
|
||||||
|
RemoveTrustCenterAliasInput:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- resource_id
|
||||||
|
properties:
|
||||||
|
resource_id:
|
||||||
|
$ref: "#/components/schemas/GID"
|
||||||
|
description: Document, trust center file, or audit ID
|
||||||
|
|
||||||
|
RemoveTrustCenterAliasOutput:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- deleted_resource_id
|
||||||
|
properties:
|
||||||
|
deleted_resource_id:
|
||||||
|
$ref: "#/components/schemas/GID"
|
||||||
|
description: Resource ID whose alias was removed
|
||||||
|
|
||||||
ListTrustCenterFilesInput:
|
ListTrustCenterFilesInput:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
@@ -13624,6 +13676,23 @@ tools:
|
|||||||
$ref: "#/components/schemas/DeleteTrustCenterReferenceInput"
|
$ref: "#/components/schemas/DeleteTrustCenterReferenceInput"
|
||||||
outputSchema:
|
outputSchema:
|
||||||
$ref: "#/components/schemas/DeleteTrustCenterReferenceOutput"
|
$ref: "#/components/schemas/DeleteTrustCenterReferenceOutput"
|
||||||
|
- name: setTrustCenterAlias
|
||||||
|
description: Set a trust center alias for a document, file, or audit
|
||||||
|
hints:
|
||||||
|
readonly: false
|
||||||
|
inputSchema:
|
||||||
|
$ref: "#/components/schemas/SetTrustCenterAliasInput"
|
||||||
|
outputSchema:
|
||||||
|
$ref: "#/components/schemas/SetTrustCenterAliasOutput"
|
||||||
|
- name: removeTrustCenterAlias
|
||||||
|
description: Remove a trust center alias from a resource
|
||||||
|
hints:
|
||||||
|
readonly: false
|
||||||
|
destructive: true
|
||||||
|
inputSchema:
|
||||||
|
$ref: "#/components/schemas/RemoveTrustCenterAliasInput"
|
||||||
|
outputSchema:
|
||||||
|
$ref: "#/components/schemas/RemoveTrustCenterAliasOutput"
|
||||||
- name: listTrustCenterFiles
|
- name: listTrustCenterFiles
|
||||||
description: List all files for the trust center
|
description: List all files for the trust center
|
||||||
hints:
|
hints:
|
||||||
|
|||||||
27
pkg/server/api/mcp/v1/types/trust_center_alias.go
Normal file
27
pkg/server/api/mcp/v1/types/trust_center_alias.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 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
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
package types
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.probo.inc/probo/pkg/coredata"
|
||||||
|
"go.probo.inc/probo/pkg/gid"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewTrustCenterAlias(resourceID gid.GID, alias *coredata.TrustCenterAlias) *TrustCenterAlias {
|
||||||
|
return &TrustCenterAlias{
|
||||||
|
ResourceID: resourceID,
|
||||||
|
Alias: alias.Alias,
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user