Skip to content

fix(social): correct search_social_posts response parsing - #21

Open
appressman wants to merge 3 commits into
mastanley13:mainfrom
appressman:main
Open

fix(social): correct search_social_posts response parsing#21
appressman wants to merge 3 commits into
mastanley13:mainfrom
appressman:main

Conversation

@appressman

@appressman appressman commented Jun 17, 2026

Copy link
Copy Markdown

Problem

search_social_posts always returns an empty list (count: 0, posts: []) regardless of what's in the Social Planner.

Root Cause

The POST /social-media-posting/{locationId}/posts/list endpoint wraps its response under a results key:

{ "results": { "posts": [...], "total": 99 } }

The tool was reading response.data?.posts directly, which is always undefined — so every search silently returns nothing.

Fix

  • src/tools/social-media-tools.ts — reads response.data?.results?.posts with fallback to response.data?.posts for backwards compatibility
  • src/types/ghl-types.ts — added results?: { posts, total } to GHLSearchPostsResponse to match the actual API shape

Tested against a live GHL location — confirmed 99 published posts returned correctly after the fix.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Improvements

    • Enhanced social media search reliability across different response formats.
    • Improved result counts and empty-result handling for more consistent search feedback.
  • Security

    • Added safeguards to help prevent credential, secret, certificate, and private-key files from being included in the project.
  • Chores

    • Added server configuration support for future integrations.

Eve (PAI Digital Assistant) and others added 2 commits March 16, 2026 17:16
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The /posts/list API returns results nested under a `results` key
({ results: { posts, total } }) but the tool was reading response.data.posts
directly, always resolving to undefined and returning an empty list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 88d6dd95-f253-40fa-8a40-073c97d48702

📥 Commits

Reviewing files that changed from the base of the PR and between f1fcaf8 and 63cfc68.

📒 Files selected for processing (1)
  • .gitignore

📝 Walkthrough

Walkthrough

GHLSearchPostsResponse now supports nested and top-level response fields. searchSocialPosts normalizes both shapes. The repository also adds an empty .mcp.json file and ignores credential, secret, certificate, and private key files.

Changes

Social Search Response Normalization

Layer / File(s) Summary
Response type and normalization logic
src/types/ghl-types.ts, src/tools/social-media-tools.ts
GHLSearchPostsResponse adds an optional results field and makes posts and count optional. searchSocialPosts resolves posts and count from nested or top-level fields with fallbacks.

Repository Configuration

Layer / File(s) Summary
MCP and sensitive-file configuration
.mcp.json, .gitignore
.mcp.json defines an empty mcpServers object. .gitignore excludes credential, secret, PEM certificate, and private key files.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: correcting social post response parsing in search_social_posts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This repo's remote is appressman/GoHighLevel-MCP, a public fork, and
CREDENTIALS.md sat untracked but unignored. A `git add -A` here would have
published it. Verified against full history on all branches that it was
never committed, so this is a guard, not a cleanup, and no rotation is
needed.

Also covers the obvious neighbours: *.pem, *.key, secrets*, and
*credentials*.json.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fg1zzArGn8eJFKEWoXg3Bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant