Skip to main content
Glama
7robots

Micro.blog Books MCP Server

by 7robots

update_reading_goal

Modify an existing reading goal by adjusting the target number of books and optionally updating current progress to track reading achievements.

Instructions

Update reading goal.

Args: goal_id: The ID of the reading goal value: The target number of books for the goal progress: The current progress (number of books read, optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goal_idYes
valueYes
progressNo

Implementation Reference

  • Core handler logic in MicroBooksClient that performs HTTP POST to `/books/goals/${goalId}` with value and optional progress parameters to update the reading goal on Micro.blog.
    async updateReadingGoal(goalId, value, progress = null) { if (!Number.isInteger(goalId) || goalId <= 0) { throw new Error("Goal ID must be a positive integer"); } if (!Number.isInteger(value) || value <= 0) { throw new Error("Goal value must be a positive integer"); } const data = { value: value.toString() }; if (progress !== null) { if (!Number.isInteger(progress) || progress < 0) { throw new Error("Progress must be a non-negative integer"); } data.progress = progress.toString(); } await this.makeRequest(`/books/goals/${goalId}`, { method: "POST", body: new URLSearchParams(data), }); return { success: true, message: "Reading goal updated successfully" }; }
  • Tool registration including name, description, and input schema for 'update_reading_goal'.
    { name: "update_reading_goal", description: "Update a reading goal's target or progress", inputSchema: { type: "object", properties: { goal_id: { type: "integer", description: "The ID of the reading goal", minimum: 1, }, value: { type: "integer", description: "The target number of books for the goal", minimum: 1, }, progress: { type: "integer", description: "The current progress (number of books read, optional)", minimum: 0, }, }, required: ["goal_id", "value"], }, }, ];
  • Dispatch handler in MCP server that calls the client method for update_reading_goal tool.
    case "update_reading_goal": { const { goal_id, value, progress } = args; const result = await client.updateReadingGoal(goal_id, value, progress); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • MCP tool handler decorated with @mcp.tool() that executes the update_reading_goal logic by calling the client.
    async def update_reading_goal(goal_id: int, value: int, progress: Optional[int] = None) -> str: """Update reading goal. Args: goal_id: The ID of the reading goal value: The target number of books for the goal progress: The current progress (number of books read, optional) """ try: result = await client.update_reading_goal(goal_id, value, progress) return json.dumps(result, indent=2) except Exception: logger.exception("Failed to update reading goal") raise
  • Supporting client method that performs the actual HTTP request to update the reading goal.
    async def update_reading_goal(self, goal_id: int, value: int, progress: Optional[int] = None) -> dict: """Update reading goal.""" data = {"value": str(value)} if progress is not None: data["progress"] = str(progress) async with httpx.AsyncClient() as client: response = await client.post( urljoin(BASE_URL, f"/books/goals/{goal_id}"), headers=self.headers, data=data, ) response.raise_for_status() return {"success": True, "message": "Reading goal updated successfully"}

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/7robots/micro-mcp-server'

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