Add delete measure to mcp
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -2040,3 +2040,18 @@ func (r *Resolver) ListMeetingAttendeesTool(ctx context.Context, req *mcp.CallTo
|
||||
Attendees: profiles,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *Resolver) DeleteMeasureTool(ctx context.Context, req *mcp.CallToolRequest, input *types.DeleteMeasureInput) (*mcp.CallToolResult, types.DeleteMeasureOutput, error) {
|
||||
r.MustAuthorize(ctx, input.ID, probo.ActionMeasureDelete)
|
||||
|
||||
svc := r.ProboService(ctx, input.ID)
|
||||
|
||||
err := svc.Measures.Delete(ctx, input.ID)
|
||||
if err != nil {
|
||||
return nil, types.DeleteMeasureOutput{}, fmt.Errorf("failed to delete measure: %w", err)
|
||||
}
|
||||
|
||||
return nil, types.DeleteMeasureOutput{
|
||||
DeletedMeasureID: input.ID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ type ResolverInterface interface {
|
||||
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)
|
||||
UpdateMeasureTool(ctx context.Context, req *mcp.CallToolRequest, input *types.UpdateMeasureInput) (*mcp.CallToolResult, types.UpdateMeasureOutput, error)
|
||||
DeleteMeasureTool(ctx context.Context, req *mcp.CallToolRequest, input *types.DeleteMeasureInput) (*mcp.CallToolResult, types.DeleteMeasureOutput, error)
|
||||
ListFrameworksTool(ctx context.Context, req *mcp.CallToolRequest, input *types.ListFrameworksInput) (*mcp.CallToolResult, types.ListFrameworksOutput, error)
|
||||
GetFrameworkTool(ctx context.Context, req *mcp.CallToolRequest, input *types.GetFrameworkInput) (*mcp.CallToolResult, types.GetFrameworkOutput, error)
|
||||
AddFrameworkTool(ctx context.Context, req *mcp.CallToolRequest, input *types.AddFrameworkInput) (*mcp.CallToolResult, types.AddFrameworkOutput, error)
|
||||
@@ -311,6 +312,19 @@ func registerToolHandlers(server *mcp.Server, resolver ResolverInterface) {
|
||||
},
|
||||
resolver.UpdateMeasureTool,
|
||||
)
|
||||
mcp.AddTool(
|
||||
server,
|
||||
&mcp.Tool{
|
||||
Name: "deleteMeasure",
|
||||
Description: "Delete a measure",
|
||||
InputSchema: types.DeleteMeasureToolInputSchema,
|
||||
OutputSchema: types.DeleteMeasureToolOutputSchema,
|
||||
Annotations: &mcp.ToolAnnotations{
|
||||
DestructiveHint: boolPtr(true),
|
||||
},
|
||||
},
|
||||
resolver.DeleteMeasureTool,
|
||||
)
|
||||
mcp.AddTool(
|
||||
server,
|
||||
&mcp.Tool{
|
||||
|
||||
@@ -1137,6 +1137,24 @@ components:
|
||||
measure:
|
||||
$ref: "#/components/schemas/Measure"
|
||||
|
||||
DeleteMeasureInput:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Measure ID
|
||||
|
||||
DeleteMeasureOutput:
|
||||
type: object
|
||||
required:
|
||||
- deleted_measure_id
|
||||
properties:
|
||||
deleted_measure_id:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Deleted measure ID
|
||||
|
||||
FrameworkOrderField:
|
||||
type: string
|
||||
enum:
|
||||
@@ -4506,6 +4524,15 @@ tools:
|
||||
$ref: "#/components/schemas/UpdateMeasureInput"
|
||||
outputSchema:
|
||||
$ref: "#/components/schemas/UpdateMeasureOutput"
|
||||
- name: deleteMeasure
|
||||
description: Delete a measure
|
||||
hints:
|
||||
readonly: false
|
||||
destructive: true
|
||||
inputSchema:
|
||||
$ref: "#/components/schemas/DeleteMeasureInput"
|
||||
outputSchema:
|
||||
$ref: "#/components/schemas/DeleteMeasureOutput"
|
||||
- name: listFrameworks
|
||||
description: List all frameworks for the organization
|
||||
hints:
|
||||
|
||||
@@ -53,6 +53,8 @@ var (
|
||||
DeleteDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_document_id":{"type":"string","format":"string"}},"required":["deleted_document_id"]}`)
|
||||
DeleteDraftDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_id":{"type":"string","format":"string"}},"required":["document_version_id"]}`)
|
||||
DeleteDraftDocumentVersionToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_document_version_id":{"type":"string","format":"string"}},"required":["deleted_document_version_id"]}`)
|
||||
DeleteMeasureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
|
||||
DeleteMeasureToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"deleted_measure_id":{"type":"string","format":"string"}},"required":["deleted_measure_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"]}`)
|
||||
@@ -1056,6 +1058,18 @@ type DeleteDraftDocumentVersionOutput struct {
|
||||
DeletedDocumentVersionID gid.GID `json:"deleted_document_version_id"`
|
||||
}
|
||||
|
||||
// DeleteMeasureInput represents the schema
|
||||
type DeleteMeasureInput struct {
|
||||
// Measure ID
|
||||
ID gid.GID `json:"id"`
|
||||
}
|
||||
|
||||
// DeleteMeasureOutput represents the schema
|
||||
type DeleteMeasureOutput struct {
|
||||
// Deleted measure ID
|
||||
DeletedMeasureID gid.GID `json:"deleted_measure_id"`
|
||||
}
|
||||
|
||||
// DeleteMeetingInput represents the schema
|
||||
type DeleteMeetingInput struct {
|
||||
// Meeting ID
|
||||
|
||||
Reference in New Issue
Block a user