Skip to content

[Improve]: Group for Swagger generator #52

@kargnas

Description

@kargnas

What happened?

Currrently:

➜  laravel-mcp-test git:(feat/swagger-generator) ✗ php artisan make:swagger-mcp-tool https://petstore3.swagger.io/api/v3/openapi.json
🚀 Swagger/OpenAPI to MCP Generator
=========================================
📄 Loading spec from: https://petstore3.swagger.io/api/v3/openapi.json
✅ Spec loaded successfully!
+-----------------+--------------------------------+
| Property        | Value                          |
+-----------------+--------------------------------+
| Title           | Swagger Petstore - OpenAPI 3.0 |
| Version         | openapi-3.0.4                  |
| Base URL        | /api/v3                        |
| Total Endpoints | 19                             |
| Tags            | pet, store, user               |
| Security        | petstore_auth, api_key         |
+-----------------+--------------------------------+

 Would you like to modify the base URL? Current: /api/v3 (yes/no) [no]:
 > 

📋 Select endpoints and choose their generation type:

Tip: GET endpoints are typically Resources, while POST/PUT/DELETE are Tools

 Include tag: pet (8 endpoints)? (yes/no) [yes]:
 > 

PUT /pet - Update an existing pet.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

POST /pet - Add a new pet to the store.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /pet/findByStatus - Finds Pets by status.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /pet/findByTags - Finds Pets by tags.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /pet/{petId} - Find pet by ID.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

POST /pet/{petId} - Updates a pet in the store with form data.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

DELETE /pet/{petId} - Deletes a pet.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

POST /pet/{petId}/uploadImage - Uploads an image.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

 Include tag: store (4 endpoints)? (yes/no) [yes]:
 > 

GET /store/inventory - Returns pet inventories by status.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

POST /store/order - Place an order for a pet.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /store/order/{orderId} - Find purchase order by ID.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

DELETE /store/order/{orderId} - Delete purchase order by identifier.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

 Include tag: user (7 endpoints)? (yes/no) [yes]:
 > 

POST /user - Create user.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

POST /user/createWithList - Creates list of users with given input array.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /user/login - Logs user into the system.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /user/logout - Logs out current logged in user session.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

GET /user/{username} - Get user by user name.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

PUT /user/{username} - Update user resource.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

DELETE /user/{username} - Delete user resource.

 Generate as [Tool]:
  [0] Tool
  [1] Resource
  [2] Skip
 > 

Selected 19 tools and 0 resources.
🔐 Configure authentication:
Security scheme: petstore_auth (type: oauth2)
OAuth2 authentication detected. Manual configuration will be needed in generated tools.
Security scheme: api_key (type: apiKey)

 Configure API Key authentication? (yes/no) [yes]:
 > 

API Key will be read from config('services.api.key')
Add to your .env: API_KEY=your-key-here
🛠️ Generating MCP components...
Generating Tool: UpdatePetTool
  ✅ Generated Tool: UpdatePetTool
Generating Tool: AddPetTool
  ✅ Generated Tool: AddPetTool
Generating Tool: FindPetsByStatusTool
  ✅ Generated Tool: FindPetsByStatusTool
Generating Tool: FindPetsByTagsTool
  ✅ Generated Tool: FindPetsByTagsTool
Generating Tool: GetPetByIdTool
  ✅ Generated Tool: GetPetByIdTool
Generating Tool: UpdatePetWithFormTool
  ✅ Generated Tool: UpdatePetWithFormTool
Generating Tool: DeletePetTool
  ✅ Generated Tool: DeletePetTool
Generating Tool: UploadFileTool
  ✅ Generated Tool: UploadFileTool
Generating Tool: GetInventoryTool
  ✅ Generated Tool: GetInventoryTool
Generating Tool: PlaceOrderTool
  ✅ Generated Tool: PlaceOrderTool
Generating Tool: GetOrderByIdTool
  ✅ Generated Tool: GetOrderByIdTool
Generating Tool: DeleteOrderTool
  ✅ Generated Tool: DeleteOrderTool
Generating Tool: CreateUserTool
  ✅ Generated Tool: CreateUserTool
Generating Tool: CreateUsersWithListInputTool
  ✅ Generated Tool: CreateUsersWithListInputTool
Generating Tool: LoginUserTool
  ✅ Generated Tool: LoginUserTool
Generating Tool: LogoutUserTool
  ✅ Generated Tool: LogoutUserTool
Generating Tool: GetUserByNameTool
  ✅ Generated Tool: GetUserByNameTool
Generating Tool: UpdateUserTool
  ✅ Generated Tool: UpdateUserTool
Generating Tool: DeleteUserTool
  ✅ Generated Tool: DeleteUserTool

📦 Generated 19 MCP tools:
  - UpdatePetTool
  - AddPetTool
  - FindPetsByStatusTool
  - FindPetsByTagsTool
  - GetPetByIdTool
  - UpdatePetWithFormTool
  - DeletePetTool
  - UploadFileTool
  - GetInventoryTool
  - PlaceOrderTool
  - GetOrderByIdTool
  - DeleteOrderTool
  - CreateUserTool
  - CreateUsersWithListInputTool
  - LoginUserTool
  - LogoutUserTool
  - GetUserByNameTool
  - UpdateUserTool
  - DeleteUserTool

✅ MCP components generated successfully!

Next steps:
1. Review generated tools in app/MCP/Tools/
2. Test tools with: php artisan mcp:test-tool <ToolName>
3. All components have been automatically registered in config/mcp-server.php
4. Update authentication configuration if needed

I want to group by the tags (pet, store, user for the above example), and make a directory in Tools or Resources. @claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions