feat(mcp): add post detail retrieval tool

This commit is contained in:
Tim
2025-10-27 20:19:17 +08:00
parent 26ca9fc916
commit 62edc75735
3 changed files with 89 additions and 1 deletions

View File

@@ -84,6 +84,18 @@ class SearchClient:
)
return [self._ensure_dict(entry) for entry in payload]
async def get_post(self, post_id: int, token: str | None = None) -> dict[str, Any]:
"""Retrieve the detailed payload for a single post."""
client = self._get_client()
headers = {"Accept": "application/json"}
if token:
headers["Authorization"] = f"Bearer {token}"
response = await client.get(f"/api/posts/{post_id}", headers=headers)
response.raise_for_status()
return self._ensure_dict(response.json())
async def aclose(self) -> None:
"""Dispose of the underlying HTTP client."""