mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
27 lines
649 B
Go
27 lines
649 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
|
"github.com/mark3labs/mcp-go/mcp"
|
|
)
|
|
|
|
const nginxConfigBasePathToolName = "nginx_config_base_path"
|
|
|
|
var nginxConfigBasePathTool = mcp.NewTool(
|
|
nginxConfigBasePathToolName,
|
|
mcp.WithDescription("Get the base path of Nginx configurations"),
|
|
)
|
|
|
|
func handleNginxConfigBasePath(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
basePath := nginx.GetConfPath()
|
|
|
|
result := map[string]interface{}{
|
|
"base_path": basePath,
|
|
}
|
|
|
|
jsonResult, _ := json.Marshal(result)
|
|
return mcp.NewToolResultText(string(jsonResult)), nil
|
|
}
|