get_history
Retrieve user's reading history from HackMD to track accessed notes and improve content management.
Instructions
Get user's reading history
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_history"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/history.ts:15-32 (handler)The handler function for the "get_history" tool. It fetches the user's reading history from the HackMD API client, stringifies it as JSON, and returns it as text content. Handles errors by returning an error message.
async () => { try { const history = await client.getHistory(); return { content: [ { type: "text", text: JSON.stringify(history, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, - tools/history.ts:6-33 (registration)Registers the "get_history" MCP tool using server.tool(), specifying the name, description, empty input schema, output hints (title, readOnlyHint, openWorldHint), and the handler function.
server.tool( "get_history", "Get user's reading history", {}, { title: "Get a history of read notes", readOnlyHint: true, openWorldHint: true, }, async () => { try { const history = await client.getHistory(); return { content: [ { type: "text", text: JSON.stringify(history, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, ); - tools/index.ts:19-19 (registration)Invokes registerHistoryApiTools within registerAllTools to perform the tool registration for get_history (and other tools).
registerHistoryApiTools(server, client);