-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest-CapabilityGeneration.ps1
More file actions
122 lines (115 loc) · 4.28 KB
/
Test-CapabilityGeneration.ps1
File metadata and controls
122 lines (115 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Test Capability Generation Offline
# Visar hur CapabilityGenerator fungerar utan att starta servern
Write-Host "🧪 Testing Capability Generation" -ForegroundColor Cyan
Write-Host ""
$projectPath = "src\ApiFirst.LlmOrchestration"
$testSwagger = @"
{
"openapi": "3.0.1",
"info": { "title": "Test API", "version": "1.0" },
"paths": {
"/api/team/members": {
"get": {
"tags": ["Team"],
"summary": "Get all team members",
"operationId": "GetTeamMembers",
"responses": { "200": { "description": "Success" } }
}
},
"/api/team/members/{id}": {
"get": {
"tags": ["Team"],
"summary": "Get team member by ID",
"operationId": "GetTeamMember",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": { "200": { "description": "Success" } }
},
"put": {
"tags": ["Team"],
"summary": "Update team member",
"operationId": "UpdateTeamMember",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"requestBody": { "required": true },
"responses": { "200": { "description": "Success" } }
},
"delete": {
"tags": ["Team"],
"summary": "Delete team member",
"operationId": "DeleteTeamMember",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": { "type": "string" }
}
],
"responses": { "204": { "description": "Success" } }
}
},
"/api/courses": {
"get": {
"tags": ["Courses"],
"summary": "Get all courses",
"operationId": "GetCourses",
"responses": { "200": { "description": "Success" } }
},
"post": {
"tags": ["Courses"],
"summary": "Create course",
"operationId": "CreateCourse",
"requestBody": { "required": true },
"responses": { "201": { "description": "Created" } }
}
}
}
}
"@
# Spara test-swagger
$testSwaggerPath = Join-Path $env:TEMP "test-swagger.json"
$testSwagger | Out-File -FilePath $testSwaggerPath -Encoding UTF8
Write-Host "📄 Created test Swagger document with:" -ForegroundColor Yellow
Write-Host " - 3 Team endpoints (GetTeamMembers, GetTeamMember, UpdateTeamMember, DeleteTeamMember)" -ForegroundColor Gray
Write-Host " - 2 Courses endpoints (GetCourses, CreateCourse)" -ForegroundColor Gray
Write-Host ""
Write-Host "🔧 Expected capabilities to be generated:" -ForegroundColor Yellow
Write-Host ""
Write-Host " Individual capabilities (5):" -ForegroundColor Cyan
Write-Host " - getteammembers [Team] GET /api/team/members" -ForegroundColor Gray
Write-Host " - getteammember [Team] GET /api/team/members/{id}" -ForegroundColor Gray
Write-Host " - updateteammember [Team] PUT /api/team/members/{id}" -ForegroundColor Gray
Write-Host " - deleteteammember [Team] DELETE /api/team/members/{id}" -ForegroundColor Gray
Write-Host " - getcourses [Courses] GET /api/courses" -ForegroundColor Gray
Write-Host " - createcourse [Courses] POST /api/courses" -ForegroundColor Gray
Write-Host ""
Write-Host " Grouped capabilities (2):" -ForegroundColor Cyan
Write-Host " - team-management [Team] All team operations" -ForegroundColor Gray
Write-Host " - courses-management [Courses] All courses operations" -ForegroundColor Gray
Write-Host ""
Write-Host "📊 Total expected: 8 capabilities" -ForegroundColor Green
Write-Host ""
Write-Host "✨ This demonstrates:" -ForegroundColor Yellow
Write-Host " 1. ✅ Each endpoint becomes a capability" -ForegroundColor Gray
Write-Host " 2. ✅ Related endpoints are grouped by tag" -ForegroundColor Gray
Write-Host " 3. ✅ No manual configuration needed" -ForegroundColor Gray
Write-Host " 4. ✅ Automatic updates when Swagger changes" -ForegroundColor Gray
Write-Host ""
Write-Host "🚀 To test with real API, run:" -ForegroundColor Cyan
Write-Host " .\Start-McpServer.ps1" -ForegroundColor White
Write-Host ""
# Cleanup
Remove-Item $testSwaggerPath -ErrorAction SilentlyContinue