cd7c29271a
Fixes interoperability with vscode, Perplexity, Mistral and others.
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package version
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.com/gitea/gitea-mcp/pkg/annotation"
|
|
"gitea.com/gitea/gitea-mcp/pkg/flag"
|
|
"gitea.com/gitea/gitea-mcp/pkg/to"
|
|
"gitea.com/gitea/gitea-mcp/pkg/tool"
|
|
|
|
"github.com/mark3labs/mcp-go/mcp"
|
|
"github.com/mark3labs/mcp-go/server"
|
|
)
|
|
|
|
var Tool = tool.New()
|
|
|
|
const (
|
|
GetGiteaMCPServerVersion = "get_gitea_mcp_server_version"
|
|
)
|
|
|
|
var GetGiteaMCPServerVersionTool = mcp.NewTool(
|
|
GetGiteaMCPServerVersion,
|
|
mcp.WithDescription("Get the running version of the Gitea MCP Server itself (not the Gitea instance it connects to)."),
|
|
mcp.WithToolAnnotation(annotation.ReadOnly("Get server version")),
|
|
)
|
|
|
|
func init() {
|
|
Tool.RegisterRead(server.ServerTool{
|
|
Tool: GetGiteaMCPServerVersionTool,
|
|
Handler: GetGiteaMCPServerVersionFn,
|
|
})
|
|
}
|
|
|
|
func GetGiteaMCPServerVersionFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
version := flag.Version
|
|
if version == "" {
|
|
version = "dev"
|
|
}
|
|
return to.TextResult(fmt.Sprintf("Gitea MCP Server version: %v", version))
|
|
}
|