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
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
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, }; } }, );