get_user_info
Retrieve detailed information about the authenticated user to enable personalized interactions within the HackMD platform.
Instructions
Get information about the authenticated user
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_user_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/profile.ts:15-32 (handler)The handler function for the 'get_user_info' tool. It fetches the authenticated user's information using the HackMD API client, formats it as pretty-printed JSON text, and returns it in MCP content format. Includes error handling to return an error message if the API call fails.
async () => { try { const userInfo = await client.getMe(); return { content: [ { type: "text", text: JSON.stringify(userInfo, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, - tools/profile.ts:7-33 (registration)Registers the 'get_user_info' tool on the MCP server using server.tool(). Specifies the tool name, description, empty input schema ({}), metadata hints, and attaches the inline handler function.
"get_user_info", "Get information about the authenticated user", {}, { title: "Get user information", readOnlyHint: true, openWorldHint: true, }, async () => { try { const userInfo = await client.getMe(); return { content: [ { type: "text", text: JSON.stringify(userInfo, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );