32 Star 310 Fork 86

开源中国/mcp-gitee

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
get_user_info.go 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
JJ-H 提交于 2025-06-16 16:10 +08:00 . feat: Support streamable http
package users
import (
"context"
"gitee.com/oschina/mcp-gitee/operations/types"
"gitee.com/oschina/mcp-gitee/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)
const (
// GetUserInfoToolName is the instruction to get authenticated user information
GetUserInfoToolName = "get_user_info"
)
// GetUserInfoTool defines the tool for getting authorized user information
var GetUserInfoTool = mcp.NewTool(
GetUserInfoToolName,
mcp.WithDescription("This is a tool from the gitee MCP server.\nGet information about the authenticated user"),
// No parameters needed for this endpoint as it uses the authenticated user's token
)
// GetUserInfoHandler handles the request to get authorized user information
func GetUserInfoHandler(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
client := utils.NewGiteeClient("GET", "/user", utils.WithContext(ctx))
var user types.BasicUser
return client.HandleMCPResult(&user)
}
// GetUserInfoHandleFunc returns a server.ToolHandlerFunc for handling get user info requests
func GetUserInfoHandleFunc() server.ToolHandlerFunc {
return GetUserInfoHandler
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/oschina/mcp-gitee.git
git@gitee.com:oschina/mcp-gitee.git
oschina
mcp-gitee
mcp-gitee
v0.1.14

搜索帮助