get_comments
Retrieve comments for a specific Gelbooru post by providing the post ID to access user discussions and feedback.
Instructions
Retrieve comments for a specific Gelbooru post.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_id | Yes | The post ID whose comments you want to retrieve. |
Implementation Reference
- gelbooru_mcp.py:539-541 (handler)The handler function for get_comments tool. It constructs API parameters (page='dapi', s='comment', q='index', post_id from arguments) and calls the _get helper function to fetch comments from Gelbooru API.
elif name == "get_comments": params = {"page": "dapi", "s": "comment", "q": "index", "post_id": arguments["post_id"]} result = await loop.run_in_executor(None, _get, params) - gelbooru_mcp.py:413-426 (registration)Tool registration for get_comments. Defines the tool schema with a required post_id parameter (integer) describing which post's comments to retrieve.
Tool( name="get_comments", description="Retrieve comments for a specific Gelbooru post.", inputSchema={ "type": "object", "properties": { "post_id": { "type": "integer", "description": "The post ID whose comments you want to retrieve.", }, }, "required": ["post_id"], }, ), - gelbooru_mcp.py:44-59 (helper)The _get helper function that performs synchronous HTTP GET requests to the Gelbooru API, handles authentication via environment variables, and returns parsed JSON responses.
def _get(params: dict) -> Any: """Perform a synchronous HTTP GET and return parsed JSON.""" params = {**params, "json": "1"} # copy — never mutate the caller's dict _build_auth(params) url = f"{BASE_URL}?{urlencode(params)}" req = Request(url, headers={"User-Agent": "GelbooruMCP/1.0"}) try: with urlopen(req, timeout=15) as resp: raw = resp.read().decode("utf-8") except URLError as exc: return {"error": str(exc)} try: return json.loads(raw) except json.JSONDecodeError: # Some endpoints return XML/empty on error; surface the raw text return {"raw": raw}