diff --git a/pkg/server/api/mcp/v1/schema.resolvers.go b/pkg/server/api/mcp/v1/schema.resolvers.go index e6399d180..73fba3d2f 100644 --- a/pkg/server/api/mcp/v1/schema.resolvers.go +++ b/pkg/server/api/mcp/v1/schema.resolvers.go @@ -7043,3 +7043,41 @@ func (r *Resolver) DeleteRiskAssessmentBoundaryTool(ctx context.Context, req *mc DeletedRiskAssessmentBoundaryID: input.ID, }, 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 +} diff --git a/pkg/server/api/mcp/v1/specification.yaml b/pkg/server/api/mcp/v1/specification.yaml index a925e9629..c7bb1017f 100644 --- a/pkg/server/api/mcp/v1/specification.yaml +++ b/pkg/server/api/mcp/v1/specification.yaml @@ -9160,6 +9160,58 @@ components: $ref: "#/components/schemas/GID" 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: type: object required: @@ -13624,6 +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 + 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 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/trust_center_alias.go new file mode 100644 index 000000000..49dfdf6e9 --- /dev/null +++ b/pkg/server/api/mcp/v1/types/trust_center_alias.go @@ -0,0 +1,27 @@ +// Copyright (c) 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 +// 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, + } +}