get_tasks
Retrieve a list of tasks from Habitica, with optional type filters for habits, dailies, todos, rewards, or completed todos, helping you manage your game-based productivity.
Instructions
List tasks. Optionally filter by type.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Optional task-type filter. |
Implementation Reference
- index.js:70-82 (schema)Tool schema definition for get_tasks, declaring an optional 'type' parameter to filter tasks.
name: "get_tasks", description: "List tasks. Optionally filter by type.", inputSchema: { type: "object", properties: { type: { type: "string", enum: ["habits", "dailys", "todos", "rewards", "completedTodos"], description: "Optional task-type filter.", }, }, }, }, - index.js:374-377 (handler)Handler function for get_tasks: calls Habitica GET /tasks/user with optional type query param and returns JSON response.
get_tasks: async ({ type } = {}) => { const path = type ? `/tasks/user?type=${encodeURIComponent(type)}` : "/tasks/user"; return json((await api("GET", path)).data); }, - index.js:480-480 (registration)Registration via ListToolsRequestSchema: the tools array (including get_tasks definition) is returned to the client.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools })); - index.js:482-492 (registration)Registration via CallToolRequestSchema: dispatches incoming tool calls to handlers[name], connecting 'get_tasks' to the handler.
server.setRequestHandler(CallToolRequestSchema, async (req) => { const { name, arguments: args = {} } = req.params; const fn = handlers[name]; if (!fn) throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); try { return await fn(args); } catch (err) { if (err instanceof McpError) throw err; throw new McpError(ErrorCode.InternalError, err?.message ?? String(err)); } });