mirror of
				https://gitea.com/gitea/gitea-mcp.git
				synced 2025-10-30 01:41:50 +00:00 
			
		
		
		
	Add debug mode and upgrade mcp-go to v0.14.1
This commit is contained in:
		
							
								
								
									
										24
									
								
								cmd/cmd.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								cmd/cmd.go
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ package cmd | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"flag" | 	"flag" | ||||||
|  | 	"os" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/operation" | 	"gitea.com/gitea/gitea-mcp/operation" | ||||||
| 	flagPkg "gitea.com/gitea/gitea-mcp/pkg/flag" | 	flagPkg "gitea.com/gitea/gitea-mcp/pkg/flag" | ||||||
| @@ -42,6 +43,12 @@ func init() { | |||||||
| 		"", | 		"", | ||||||
| 		"Your personal access token", | 		"Your personal access token", | ||||||
| 	) | 	) | ||||||
|  | 	flag.BoolVar( | ||||||
|  | 		&debug, | ||||||
|  | 		"d", | ||||||
|  | 		false, | ||||||
|  | 		"debug mode", | ||||||
|  | 	) | ||||||
| 	flag.BoolVar( | 	flag.BoolVar( | ||||||
| 		&debug, | 		&debug, | ||||||
| 		"debug", | 		"debug", | ||||||
| @@ -52,7 +59,24 @@ func init() { | |||||||
| 	flag.Parse() | 	flag.Parse() | ||||||
|  |  | ||||||
| 	flagPkg.Host = host | 	flagPkg.Host = host | ||||||
|  | 	if flagPkg.Host == "" { | ||||||
|  | 		flagPkg.Host = os.Getenv("GITEA_HOST") | ||||||
|  | 	} | ||||||
|  | 	if flagPkg.Host == "" { | ||||||
|  | 		flagPkg.Host = "https://gitea.com" | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	flagPkg.Token = token | 	flagPkg.Token = token | ||||||
|  | 	if flagPkg.Token == "" { | ||||||
|  | 		flagPkg.Token = os.Getenv("GITEA_TOKEN") | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if debug { | ||||||
|  | 		flagPkg.Debug = debug | ||||||
|  | 	} | ||||||
|  | 	if !debug { | ||||||
|  | 		flagPkg.Debug = os.Getenv("GITEA_DEBUG") == "true" | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| func Execute(version string) { | func Execute(version string) { | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ go 1.24.0 | |||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	code.gitea.io/sdk/gitea v0.20.0 | 	code.gitea.io/sdk/gitea v0.20.0 | ||||||
| 	github.com/mark3labs/mcp-go v0.14.0 | 	github.com/mark3labs/mcp-go v0.14.1 | ||||||
| 	go.uber.org/zap v1.27.0 | 	go.uber.org/zap v1.27.0 | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -12,8 +12,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= | |||||||
| github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||||||
| github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= | github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= | ||||||
| github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= | github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= | ||||||
| github.com/mark3labs/mcp-go v0.14.0 h1:/bASI77oZbDKTQoCIxxPFu+UKn0o6OeA9C3cBrbapxM= | github.com/mark3labs/mcp-go v0.14.1 h1:NsieyFbuWQaeZSWSHPvJ5TwJdQwu+1jmivAIVljeouY= | ||||||
| github.com/mark3labs/mcp-go v0.14.0/go.mod h1:xBB350hekQsJAK7gJAii8bcEoWemboLm2mRm5/+KBaU= | github.com/mark3labs/mcp-go v0.14.1/go.mod h1:xBB350hekQsJAK7gJAii8bcEoWemboLm2mRm5/+KBaU= | ||||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||||
| github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/to" | 	"gitea.com/gitea/gitea-mcp/pkg/to" | ||||||
|  |  | ||||||
| 	gitea_sdk "code.gitea.io/sdk/gitea" | 	gitea_sdk "code.gitea.io/sdk/gitea" | ||||||
| @@ -72,6 +73,7 @@ func RegisterTool(s *server.MCPServer) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func GetIssueByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func GetIssueByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called GetIssueByIndexFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	index := req.Params.Arguments["index"].(float64) | 	index := req.Params.Arguments["index"].(float64) | ||||||
| @@ -84,6 +86,7 @@ func GetIssueByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallT | |||||||
| } | } | ||||||
|  |  | ||||||
| func GetPullRequestByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func GetPullRequestByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called GetPullRequestByIndexFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	index := req.Params.Arguments["index"].(float64) | 	index := req.Params.Arguments["index"].(float64) | ||||||
| @@ -96,6 +99,7 @@ func GetPullRequestByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp | |||||||
| } | } | ||||||
|  |  | ||||||
| func CreateIssueFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func CreateIssueFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called CreateIssueFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	title := req.Params.Arguments["title"].(string) | 	title := req.Params.Arguments["title"].(string) | ||||||
| @@ -112,6 +116,7 @@ func CreateIssueFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolR | |||||||
| } | } | ||||||
|  |  | ||||||
| func CreateIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func CreateIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called CreateIssueCommentFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	index := req.Params.Arguments["index"].(float64) | 	index := req.Params.Arguments["index"].(float64) | ||||||
| @@ -127,6 +132,7 @@ func CreateIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.Ca | |||||||
| } | } | ||||||
|  |  | ||||||
| func CreatePullRequestFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func CreatePullRequestFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called CreatePullRequestFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	title := req.Params.Arguments["title"].(string) | 	title := req.Params.Arguments["title"].(string) | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"github.com/mark3labs/mcp-go/mcp" | 	"github.com/mark3labs/mcp-go/mcp" | ||||||
|  |  | ||||||
| 	gitea_sdk "code.gitea.io/sdk/gitea" | 	gitea_sdk "code.gitea.io/sdk/gitea" | ||||||
| @@ -25,6 +26,7 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func CreateBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func CreateBranchFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called CreateBranchFn") | ||||||
| 	owner := req.Params.Arguments["owner"].(string) | 	owner := req.Params.Arguments["owner"].(string) | ||||||
| 	repo := req.Params.Arguments["repo"].(string) | 	repo := req.Params.Arguments["repo"].(string) | ||||||
| 	branch := req.Params.Arguments["branch"].(string) | 	branch := req.Params.Arguments["branch"].(string) | ||||||
|   | |||||||
| @@ -3,8 +3,9 @@ package repo | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
|  |  | ||||||
| 	"code.gitea.io/sdk/gitea" | 	gitea_sdk "code.gitea.io/sdk/gitea" | ||||||
| 	giteaPkg "gitea.com/gitea/gitea-mcp/pkg/gitea" | 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/to" | 	"gitea.com/gitea/gitea-mcp/pkg/to" | ||||||
|  |  | ||||||
| 	"github.com/mark3labs/mcp-go/mcp" | 	"github.com/mark3labs/mcp-go/mcp" | ||||||
| @@ -49,6 +50,7 @@ func RegisterTool(s *server.MCPServer) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called CreateRepoFn") | ||||||
| 	name := req.Params.Arguments["name"].(string) | 	name := req.Params.Arguments["name"].(string) | ||||||
| 	description := req.Params.Arguments["description"].(string) | 	description := req.Params.Arguments["description"].(string) | ||||||
| 	private := req.Params.Arguments["private"].(bool) | 	private := req.Params.Arguments["private"].(bool) | ||||||
| @@ -60,7 +62,7 @@ func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolRe | |||||||
| 	readme := req.Params.Arguments["readme"].(string) | 	readme := req.Params.Arguments["readme"].(string) | ||||||
| 	defaultBranch := req.Params.Arguments["default_branch"].(string) | 	defaultBranch := req.Params.Arguments["default_branch"].(string) | ||||||
|  |  | ||||||
| 	opt := gitea.CreateRepoOption{ | 	opt := gitea_sdk.CreateRepoOption{ | ||||||
| 		Name:          name, | 		Name:          name, | ||||||
| 		Description:   description, | 		Description:   description, | ||||||
| 		Private:       private, | 		Private:       private, | ||||||
| @@ -72,7 +74,7 @@ func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolRe | |||||||
| 		Readme:        readme, | 		Readme:        readme, | ||||||
| 		DefaultBranch: defaultBranch, | 		DefaultBranch: defaultBranch, | ||||||
| 	} | 	} | ||||||
| 	repo, _, err := giteaPkg.Client().CreateRepo(opt) | 	repo, _, err := gitea.Client().CreateRepo(opt) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
| @@ -80,6 +82,7 @@ func CreateRepoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolRe | |||||||
| } | } | ||||||
|  |  | ||||||
| func ListMyReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func ListMyReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called ListMyReposFn") | ||||||
| 	page, ok := req.Params.Arguments["page"].(float64) | 	page, ok := req.Params.Arguments["page"].(float64) | ||||||
| 	if !ok { | 	if !ok { | ||||||
| 		return mcp.NewToolResultError("get page number error"), nil | 		return mcp.NewToolResultError("get page number error"), nil | ||||||
| @@ -88,13 +91,13 @@ func ListMyReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolR | |||||||
| 	if !ok { | 	if !ok { | ||||||
| 		return mcp.NewToolResultError("get page size number error"), nil | 		return mcp.NewToolResultError("get page size number error"), nil | ||||||
| 	} | 	} | ||||||
| 	opts := gitea.ListReposOptions{ | 	opt := gitea_sdk.ListReposOptions{ | ||||||
| 		ListOptions: gitea.ListOptions{ | 		ListOptions: gitea_sdk.ListOptions{ | ||||||
| 			Page:     int(page), | 			Page:     int(page), | ||||||
| 			PageSize: int(size), | 			PageSize: int(size), | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
| 	repos, _, err := giteaPkg.Client().ListMyRepos(opts) | 	repos, _, err := gitea.Client().ListMyRepos(opt) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return mcp.NewToolResultError("List my repositories error"), err | 		return mcp.NewToolResultError("List my repositories error"), err | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | 	"gitea.com/gitea/gitea-mcp/pkg/gitea" | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/to" | 	"gitea.com/gitea/gitea-mcp/pkg/to" | ||||||
|  |  | ||||||
| 	"github.com/mark3labs/mcp-go/mcp" | 	"github.com/mark3labs/mcp-go/mcp" | ||||||
| @@ -26,6 +27,7 @@ func RegisterTool(s *server.MCPServer) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func GetUserInfoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func GetUserInfoFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called GetUserInfoFn") | ||||||
| 	user, _, err := gitea.Client().GetMyUserInfo() | 	user, _, err := gitea.Client().GetMyUserInfo() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return mcp.NewToolResultError("Get My User Info Error"), err | 		return mcp.NewToolResultError("Get My User Info Error"), err | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/flag" | 	"gitea.com/gitea/gitea-mcp/pkg/flag" | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/to" | 	"gitea.com/gitea/gitea-mcp/pkg/to" | ||||||
|  |  | ||||||
| 	"github.com/mark3labs/mcp-go/mcp" | 	"github.com/mark3labs/mcp-go/mcp" | ||||||
| @@ -27,6 +28,7 @@ func RegisterTool(s *server.MCPServer) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func GetGiteaMCPServerVersionFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func GetGiteaMCPServerVersionFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
|  | 	log.Debugf("Called GetGiteaMCPServerVersionFn") | ||||||
| 	version := flag.Version | 	version := flag.Version | ||||||
| 	if version == "" { | 	if version == "" { | ||||||
| 		version = "dev" | 		version = "dev" | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| package gitea | package gitea | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"os" |  | ||||||
| 	"sync" | 	"sync" | ||||||
|  |  | ||||||
| 	"gitea.com/gitea/gitea-mcp/pkg/flag" | 	"gitea.com/gitea/gitea-mcp/pkg/flag" | ||||||
| @@ -18,18 +17,7 @@ var ( | |||||||
| func Client() *gitea.Client { | func Client() *gitea.Client { | ||||||
| 	clientOnce.Do(func() { | 	clientOnce.Do(func() { | ||||||
| 		if client == nil { | 		if client == nil { | ||||||
| 			host, token := flag.Host, flag.Token | 			c, err := gitea.NewClient(flag.Host, gitea.SetToken(flag.Token)) | ||||||
| 			if host == "" { |  | ||||||
| 				host = os.Getenv("GITEA_HOST") |  | ||||||
| 			} |  | ||||||
| 			if host == "" { |  | ||||||
| 				host = "https://gitea.com" |  | ||||||
| 			} |  | ||||||
| 			if token == "" { |  | ||||||
| 				token = os.Getenv("GITEA_TOKEN") |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			c, err := gitea.NewClient(host, gitea.SetToken(token)) |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				log.Fatalf("create gitea client err: %v", err) | 				log.Fatalf("create gitea client err: %v", err) | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import ( | |||||||
| 	"sync" | 	"sync" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/flag" | ||||||
| 	"go.uber.org/zap" | 	"go.uber.org/zap" | ||||||
| 	"go.uber.org/zap/zapcore" | 	"go.uber.org/zap/zapcore" | ||||||
| ) | ) | ||||||
| @@ -28,7 +29,13 @@ func Default() *zap.Logger { | |||||||
| 			ws = zapcore.NewMultiWriteSyncer(wss...) | 			ws = zapcore.NewMultiWriteSyncer(wss...) | ||||||
|  |  | ||||||
| 			enc := zapcore.NewConsoleEncoder(ec) | 			enc := zapcore.NewConsoleEncoder(ec) | ||||||
| 			core := zapcore.NewCore(enc, ws, zapcore.DebugLevel) | 			var level zapcore.Level | ||||||
|  | 			if flag.Debug { | ||||||
|  | 				level = zapcore.DebugLevel | ||||||
|  | 			} else { | ||||||
|  | 				level = zapcore.InfoLevel | ||||||
|  | 			} | ||||||
|  | 			core := zapcore.NewCore(enc, ws, level) | ||||||
| 			options := []zap.Option{ | 			options := []zap.Option{ | ||||||
| 				zap.AddStacktrace(zapcore.ErrorLevel), | 				zap.AddStacktrace(zapcore.ErrorLevel), | ||||||
| 				zap.AddCaller(), | 				zap.AddCaller(), | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ package to | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  |  | ||||||
|  | 	"gitea.com/gitea/gitea-mcp/pkg/log" | ||||||
| 	"github.com/mark3labs/mcp-go/mcp" | 	"github.com/mark3labs/mcp-go/mcp" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -11,5 +12,6 @@ func TextResult(v any) (*mcp.CallToolResult, error) { | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return mcp.NewToolResultError("marshal result error"), err | 		return mcp.NewToolResultError("marshal result error"), err | ||||||
| 	} | 	} | ||||||
|  | 	log.Debugf("Text Result: %s", string(result)) | ||||||
| 	return mcp.NewToolResultText(string(result)), nil | 	return mcp.NewToolResultText(string(result)), nil | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user