mirror of
				https://gitea.com/gitea/gitea-mcp.git
				synced 2025-10-30 01:41:50 +00:00 
			
		
		
		
	style: refactor code formatting for clarity and conciseness
- Remove extra blank lines for cleaner code formatting - Combine variable declaration of GetGiteaMCPServerVersionTool into a single line for clarity Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
		| @@ -18,14 +18,13 @@ import ( | |||||||
| var Tool = tool.New() | var Tool = tool.New() | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	GetIssueByIndexToolName    = "get_issue_by_index" | 	GetIssueByIndexToolName         = "get_issue_by_index" | ||||||
| 	ListRepoIssuesToolName     = "list_repo_issues" | 	ListRepoIssuesToolName          = "list_repo_issues" | ||||||
| 	CreateIssueToolName        = "create_issue" | 	CreateIssueToolName             = "create_issue" | ||||||
| 	CreateIssueCommentToolName = "create_issue_comment" | 	CreateIssueCommentToolName      = "create_issue_comment" | ||||||
| 	EditIssueToolName          = "edit_issue" | 	EditIssueToolName               = "edit_issue" | ||||||
| 	EditIssueCommentToolName   = "edit_issue_comment" | 	EditIssueCommentToolName        = "edit_issue_comment" | ||||||
| 	GetIssueCommentsByIndexToolName    = "get_issue_comments_by_index" | 	GetIssueCommentsByIndexToolName = "get_issue_comments_by_index" | ||||||
|  |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| @@ -55,7 +54,7 @@ var ( | |||||||
| 		mcp.WithString("title", mcp.Required(), mcp.Description("issue title")), | 		mcp.WithString("title", mcp.Required(), mcp.Description("issue title")), | ||||||
| 		mcp.WithString("body", mcp.Required(), mcp.Description("issue body")), | 		mcp.WithString("body", mcp.Required(), mcp.Description("issue body")), | ||||||
| 	) | 	) | ||||||
| 	 |  | ||||||
| 	CreateIssueCommentTool = mcp.NewTool( | 	CreateIssueCommentTool = mcp.NewTool( | ||||||
| 		CreateIssueCommentToolName, | 		CreateIssueCommentToolName, | ||||||
| 		mcp.WithDescription("create issue comment"), | 		mcp.WithDescription("create issue comment"), | ||||||
| @@ -64,7 +63,7 @@ var ( | |||||||
| 		mcp.WithNumber("index", mcp.Required(), mcp.Description("repository issue index")), | 		mcp.WithNumber("index", mcp.Required(), mcp.Description("repository issue index")), | ||||||
| 		mcp.WithString("body", mcp.Required(), mcp.Description("issue comment body")), | 		mcp.WithString("body", mcp.Required(), mcp.Description("issue comment body")), | ||||||
| 	) | 	) | ||||||
| 	 |  | ||||||
| 	EditIssueTool = mcp.NewTool( | 	EditIssueTool = mcp.NewTool( | ||||||
| 		EditIssueToolName, | 		EditIssueToolName, | ||||||
| 		mcp.WithDescription("edit issue"), | 		mcp.WithDescription("edit issue"), | ||||||
| @@ -77,7 +76,7 @@ var ( | |||||||
| 		mcp.WithNumber("milestone", mcp.Description("milestone number")), | 		mcp.WithNumber("milestone", mcp.Description("milestone number")), | ||||||
| 		mcp.WithString("state", mcp.Description("issue state, one of open, closed, all")), | 		mcp.WithString("state", mcp.Description("issue state, one of open, closed, all")), | ||||||
| 	) | 	) | ||||||
| 	 |  | ||||||
| 	EditIssueCommentTool = mcp.NewTool( | 	EditIssueCommentTool = mcp.NewTool( | ||||||
| 		EditIssueCommentToolName, | 		EditIssueCommentToolName, | ||||||
| 		mcp.WithDescription("edit issue comment"), | 		mcp.WithDescription("edit issue comment"), | ||||||
| @@ -118,11 +117,11 @@ func init() { | |||||||
| 		Handler: EditIssueFn, | 		Handler: EditIssueFn, | ||||||
| 	}) | 	}) | ||||||
| 	Tool.RegisterWrite(server.ServerTool{ | 	Tool.RegisterWrite(server.ServerTool{ | ||||||
| 		Tool: 	 EditIssueCommentTool, | 		Tool:    EditIssueCommentTool, | ||||||
| 		Handler: EditIssueCommentFn, | 		Handler: EditIssueCommentFn, | ||||||
| 	}) | 	}) | ||||||
| 	Tool.RegisterRead(server.ServerTool{ | 	Tool.RegisterRead(server.ServerTool{ | ||||||
| 		Tool: 	 GetIssueCommentsByIndexTool, | 		Tool:    GetIssueCommentsByIndexTool, | ||||||
| 		Handler: GetIssueCommentsByIndexFn, | 		Handler: GetIssueCommentsByIndexFn, | ||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| @@ -289,7 +288,6 @@ func EditIssueFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolRes | |||||||
| 	return to.TextResult(issue) | 	return to.TextResult(issue) | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| func EditIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func EditIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
| 	log.Debugf("Called EditIssueCommentFn") | 	log.Debugf("Called EditIssueCommentFn") | ||||||
| 	owner, ok := req.GetArguments()["owner"].(string) | 	owner, ok := req.GetArguments()["owner"].(string) | ||||||
| @@ -317,7 +315,6 @@ func EditIssueCommentFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.Call | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return to.TextResult(issueComment) | 	return to.TextResult(issueComment) | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func GetIssueCommentsByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | func GetIssueCommentsByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||||
| @@ -341,4 +338,4 @@ func GetIssueCommentsByIndexFn(ctx context.Context, req mcp.CallToolRequest) (*m | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return to.TextResult(issue) | 	return to.TextResult(issue) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,11 +19,9 @@ const ( | |||||||
| 	GetGiteaMCPServerVersion = "get_gitea_mcp_server_version" | 	GetGiteaMCPServerVersion = "get_gitea_mcp_server_version" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | var GetGiteaMCPServerVersionTool = mcp.NewTool( | ||||||
| 	GetGiteaMCPServerVersionTool = mcp.NewTool( | 	GetGiteaMCPServerVersion, | ||||||
| 		GetGiteaMCPServerVersion, | 	mcp.WithDescription("Get Gitea MCP Server Version"), | ||||||
| 		mcp.WithDescription("Get Gitea MCP Server Version"), |  | ||||||
| 	) |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user