Add delete risks to mcp
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -1941,3 +1941,18 @@ func (r *Resolver) DeleteMeetingTool(ctx context.Context, req *mcp.CallToolReque
|
||||
DeletedMeetingID: input.ID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *Resolver) DeleteRiskTool(ctx context.Context, req *mcp.CallToolRequest, input *types.DeleteRiskInput) (*mcp.CallToolResult, types.DeleteRiskOutput, error) {
|
||||
r.MustAuthorize(ctx, input.ID, probo.ActionRiskDelete)
|
||||
|
||||
svc := r.ProboService(ctx, input.ID)
|
||||
|
||||
err := svc.Risks.Delete(ctx, input.ID)
|
||||
if err != nil {
|
||||
return nil, types.DeleteRiskOutput{}, fmt.Errorf("failed to delete risk: %w", err)
|
||||
}
|
||||
|
||||
return nil, types.DeleteRiskOutput{
|
||||
DeletedRiskID: input.ID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ type ResolverInterface interface {
|
||||
GetRiskTool(ctx context.Context, req *mcp.CallToolRequest, input *types.GetRiskInput) (*mcp.CallToolResult, types.GetRiskOutput, error)
|
||||
AddRiskTool(ctx context.Context, req *mcp.CallToolRequest, input *types.AddRiskInput) (*mcp.CallToolResult, types.AddRiskOutput, error)
|
||||
UpdateRiskTool(ctx context.Context, req *mcp.CallToolRequest, input *types.UpdateRiskInput) (*mcp.CallToolResult, types.UpdateRiskOutput, error)
|
||||
DeleteRiskTool(ctx context.Context, req *mcp.CallToolRequest, input *types.DeleteRiskInput) (*mcp.CallToolResult, types.DeleteRiskOutput, error)
|
||||
ListMeasuresTool(ctx context.Context, req *mcp.CallToolRequest, input *types.ListMeasuresInput) (*mcp.CallToolResult, types.ListMeasuresOutput, error)
|
||||
GetMeasureTool(ctx context.Context, req *mcp.CallToolRequest, input *types.GetMeasureInput) (*mcp.CallToolResult, types.GetMeasureOutput, error)
|
||||
AddMeasureTool(ctx context.Context, req *mcp.CallToolRequest, input *types.AddMeasureInput) (*mcp.CallToolResult, types.AddMeasureOutput, error)
|
||||
@@ -247,6 +248,19 @@ func registerToolHandlers(server *mcp.Server, resolver ResolverInterface) {
|
||||
},
|
||||
resolver.UpdateRiskTool,
|
||||
)
|
||||
mcp.AddTool(
|
||||
server,
|
||||
&mcp.Tool{
|
||||
Name: "deleteRisk",
|
||||
Description: "Delete a risk",
|
||||
InputSchema: types.DeleteRiskToolInputSchema,
|
||||
OutputSchema: types.DeleteRiskToolOutputSchema,
|
||||
Annotations: &mcp.ToolAnnotations{
|
||||
DestructiveHint: boolPtr(true),
|
||||
},
|
||||
},
|
||||
resolver.DeleteRiskTool,
|
||||
)
|
||||
mcp.AddTool(
|
||||
server,
|
||||
&mcp.Tool{
|
||||
|
||||
@@ -939,6 +939,24 @@ components:
|
||||
risk:
|
||||
$ref: "#/components/schemas/Risk"
|
||||
|
||||
DeleteRiskInput:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Risk ID
|
||||
|
||||
DeleteRiskOutput:
|
||||
type: object
|
||||
required:
|
||||
- deleted_risk_id
|
||||
properties:
|
||||
deleted_risk_id:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Deleted risk ID
|
||||
|
||||
MeasureState:
|
||||
type: string
|
||||
enum:
|
||||
@@ -4431,6 +4449,15 @@ tools:
|
||||
$ref: "#/components/schemas/UpdateRiskInput"
|
||||
outputSchema:
|
||||
$ref: "#/components/schemas/UpdateRiskOutput"
|
||||
- name: deleteRisk
|
||||
description: Delete a risk
|
||||
hints:
|
||||
readonly: false
|
||||
destructive: true
|
||||
inputSchema:
|
||||
$ref: "#/components/schemas/DeleteRiskInput"
|
||||
outputSchema:
|
||||
$ref: "#/components/schemas/DeleteRiskOutput"
|
||||
- name: listMeasures
|
||||
description: List all measures for the organization
|
||||
hints:
|
||||
|
||||
@@ -55,6 +55,8 @@ var (
|
||||
DeleteDraftDocumentVersionToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_document_version_id":{"type":"string","format":"string"}},"required":["deleted_document_version_id"]}`)
|
||||
DeleteMeetingToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
|
||||
DeleteMeetingToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_meeting_id":{"type":"string","format":"string"}},"required":["deleted_meeting_id"]}`)
|
||||
DeleteRiskToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
|
||||
DeleteRiskToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_risk_id":{"type":"string","format":"string"}},"required":["deleted_risk_id"]}`)
|
||||
GetAssetToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
|
||||
GetAssetToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"asset":{"type":"object","properties":{"amount":{"type":"integer","description":"Asset amount"},"asset_type":{"type":"string","enum":["PHYSICAL","VIRTUAL"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_types_stored":{"type":"string","description":"Data types stored"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Asset name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","amount","owner_id","asset_type","data_types_stored","created_at","updated_at"]}},"required":["asset"]}`)
|
||||
GetAuditToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
|
||||
@@ -1070,6 +1072,18 @@ type DeleteMeetingOutput struct {
|
||||
DeletedMeetingID gid.GID `json:"deleted_meeting_id"`
|
||||
}
|
||||
|
||||
// DeleteRiskInput represents the schema
|
||||
type DeleteRiskInput struct {
|
||||
// Risk ID
|
||||
ID gid.GID `json:"id"`
|
||||
}
|
||||
|
||||
// DeleteRiskOutput represents the schema
|
||||
type DeleteRiskOutput struct {
|
||||
// Deleted risk ID
|
||||
DeletedRiskID gid.GID `json:"deleted_risk_id"`
|
||||
}
|
||||
|
||||
// Document represents the schema
|
||||
type Document struct {
|
||||
// Document classification
|
||||
|
||||
Reference in New Issue
Block a user