Skip to main content
Glama
get_user_info.go1.16 kB
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 }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oschina/mcp-gitee'

If you have feedback or need assistance with the MCP directory API, please join our Discord server