Facebook MCP server for automating posts, comment moderation, insights, and sentiment filtering.
Python
fix: normalize docstrings, add missing docstring, fix permalink error handling
hagai_hen94835a2b55cc
diff --git a/facebook_api.py b/facebook_api.pyindex cbf79ea..3bfcfa7 100644--- a/facebook_api.py+++ b/facebook_api.py@@ -81,9 +81,8 @@ class FacebookAPI:def get_comment_replies(self, comment_id: str) -> dict[str, Any]:return self._request("GET", f"{comment_id}/comments", {"fields": "id,message,from,created_time"})- def get_post_permalink(self, post_id: str) -> str:- data = self._request("GET", f"{post_id}", {"fields": "permalink_url"})- return data.get("permalink_url", "")+ def get_post_permalink(self, post_id: str) -> dict[str, Any]:+ return self._request("GET", f"{post_id}", {"fields": "permalink_url"})def get_scheduled_posts(self) -> dict[str, Any]:return self._request("GET", f"{PAGE_ID}/scheduled_posts", {"fields": "id,message,scheduled_publish_time"})diff --git a/manager.py b/manager.pyindex 7b4e474..5274450 100644--- a/manager.py+++ b/manager.py@@ -150,6 +150,7 @@ class Manager:return resultsdef bulk_unhide_comments(self, comment_ids: list[str]) -> list[dict[str, Any]]:+ """Unhide multiple comments and return their results."""results = []for cid in comment_ids:res = self.api.unhide_comment(cid)@@ -159,7 +160,7 @@ class Manager:def get_comment_replies(self, comment_id: str) -> dict[str, Any]:return self.api.get_comment_replies(comment_id)- def get_post_permalink(self, post_id: str) -> str:+ def get_post_permalink(self, post_id: str) -> dict[str, Any]:return self.api.get_post_permalink(post_id)def get_scheduled_posts(self) -> dict[str, Any]:diff --git a/server.py b/server.pyindex e9b855a..595af4f 100644--- a/server.py+++ b/server.py@@ -277,45 +277,30 @@ def bulk_hide_comments(comment_ids: list[str]) -> list[dict[str, Any]]:@mcp.tool()def bulk_unhide_comments(comment_ids: list[str]) -> list[dict[str, Any]]:- """Unhide multiple comments by ID.- Input: comment_ids (list[str])- Output: list of dicts with comment_id and result- """+ """Unhide multiple comments by ID."""return manager.bulk_unhide_comments(comment_ids)@mcp.tool()def get_comment_replies(comment_id: str) -> dict[str, Any]:- """Get all replies to a specific comment.- Input: comment_id (str)- Output: dict with reply objects- """+ """Get all replies to a specific comment."""return manager.get_comment_replies(comment_id)@mcp.tool()-def get_post_permalink(post_id: str) -> str:- """Get the permalink URL of a post.- Input: post_id (str)- Output: permalink URL string- """+def get_post_permalink(post_id: str) -> dict[str, Any]:+ """Get the permalink URL of a post."""return manager.get_post_permalink(post_id)@mcp.tool()def get_scheduled_posts() -> dict[str, Any]:- """List all scheduled (unpublished) posts on the Page.- Input: None- Output: dict with scheduled post objects including id, message, and scheduled_publish_time- """+ """List all scheduled (unpublished) posts on the Page."""return manager.get_scheduled_posts()@mcp.tool()def get_page_info() -> dict[str, Any]:- """Get extended information about the Facebook Page.- Input: None- Output: dict with name, about, category, website, emails, phone, description, and location- """+ """Get extended information about the Facebook Page."""return manager.get_page_info()