|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | + |
| 3 | +package tools |
| 4 | + |
| 5 | +import ( |
| 6 | + "context" |
| 7 | + "fmt" |
| 8 | + |
| 9 | + "github.com/modelcontextprotocol/go-sdk/mcp" |
| 10 | +) |
| 11 | + |
| 12 | +type ChecklistInput struct { |
| 13 | + Project string `json:"project" jsonschema:"description of the project being evaluated"` |
| 14 | +} |
| 15 | + |
| 16 | +type ChecklistItem struct { |
| 17 | + Category string `json:"category"` |
| 18 | + Question string `json:"question"` |
| 19 | + Description string `json:"description"` |
| 20 | +} |
| 21 | + |
| 22 | +type ChecklistOutput struct { |
| 23 | + Items []ChecklistItem `json:"items"` |
| 24 | + Guidance string `json:"guidance"` |
| 25 | +} |
| 26 | + |
| 27 | +func HandleChecklist(ctx context.Context, req *mcp.CallToolRequest, input ChecklistInput) (*mcp.CallToolResult, ChecklistOutput, error) { |
| 28 | + if input.Project == "" { |
| 29 | + return ErrResult[ChecklistOutput]("project is required") |
| 30 | + } |
| 31 | + |
| 32 | + items := []ChecklistItem{ |
| 33 | + { |
| 34 | + Category: "Automated tests / CI", |
| 35 | + Question: "When new features are added or new bugs are fixed is there a way to prevent regressions?", |
| 36 | + Description: "Are standards enforced when code is checked in?", |
| 37 | + }, |
| 38 | + { |
| 39 | + Category: "Monitoring", |
| 40 | + Question: "How can we know if this project is working as expected?", |
| 41 | + Description: "Are there health checks, metrics, or alerts that tell you when something is wrong before users report it?", |
| 42 | + }, |
| 43 | + { |
| 44 | + Category: "On-call coverage / SLAs", |
| 45 | + Question: "When it stops working do we need to immediately notify someone to get it fixed?", |
| 46 | + Description: "Is there an on-call rotation or SLA that defines response time expectations?", |
| 47 | + }, |
| 48 | + { |
| 49 | + Category: "Security audit / automated scans", |
| 50 | + Question: "When a vulnerability is discovered in this tool or a dependency how can we know?", |
| 51 | + Description: "Necessity depends on how sensitive the information in this project is and what a compromise could mean — is this project isolated from other projects?", |
| 52 | + }, |
| 53 | + { |
| 54 | + Category: "Deployment pipeline / CD", |
| 55 | + Question: "How much work is it to promote these changes to a test or production environment?", |
| 56 | + Description: "Is there an automated pipeline, or does deployment require manual steps that could be error-prone?", |
| 57 | + }, |
| 58 | + { |
| 59 | + Category: "Documentation / runbooks", |
| 60 | + Question: "Can others who use this project quickly learn how it works and how to extend it and maintain it?", |
| 61 | + Description: "Are there runbooks for common operational tasks like deployments, rollbacks, and incident response?", |
| 62 | + }, |
| 63 | + } |
| 64 | + |
| 65 | + guidance := fmt.Sprintf("IMPORTANT: Present each checklist item below to the user for project %q and wait for their answers. "+ |
| 66 | + "Do NOT skip items or assume answers. The goal is to identify operational gaps before they become incidents. "+ |
| 67 | + "For each item, ask the user whether it is addressed, partially addressed, or not addressed, "+ |
| 68 | + "and discuss what concrete next steps would close the gap.", input.Project) |
| 69 | + |
| 70 | + output := ChecklistOutput{ |
| 71 | + Items: items, |
| 72 | + Guidance: guidance, |
| 73 | + } |
| 74 | + |
| 75 | + summary := fmt.Sprintf("Operational readiness checklist for: %q\nGenerated %d items to evaluate.", input.Project, len(items)) |
| 76 | + |
| 77 | + return &mcp.CallToolResult{ |
| 78 | + Content: []mcp.Content{&mcp.TextContent{Text: summary}}, |
| 79 | + }, output, nil |
| 80 | +} |
0 commit comments