Add Xquik X/Twitter research tools#5784
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
✅ Files skipped from review due to trivial changes (7)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds a new Xquik X/Twitter tools integration: five REST-backed tools, Pydantic schemas, a shared authenticated base client, package exports, tests, READMEs, localized MDX docs and overview cards, and updates docs manifest and repo README. ChangesXquik X/Twitter Tool Integration
Sequence DiagramsequenceDiagram
autonumber
participant Agent as Agent (caller)
participant Tool as XquikTool (in-process)
participant Env as Env / Config
participant Xquik as Xquik API (external)
Agent->>Tool: Instantiate (api_key? / uses Env)
Env-->>Tool: Provide XQUIK_API_KEY (if not explicit)
Agent->>Tool: .run(args)
Tool->>Xquik: HTTP GET /x/... with headers (x-api-key, xquik-api-contract) and query/path params
Xquik-->>Tool: 200 + JSON OR non-2xx/error body
Tool->>Agent: return JSON or raise RuntimeError (includes HTTP status and body)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
lib/crewai-tools/README.md (1)
29-29: ⚡ Quick winExpand the API integrations list to include all new Xquik tools.
Only
XquikSearchTweetsToolis listed, while this PR ships five Xquik tools. Updating this line improves discoverability.💡 Suggested update
-- **API Integrations**: `SerperApiTool`, `ExaSearchTool`, `XquikSearchTweetsTool` +- **API Integrations**: `SerperApiTool`, `ExaSearchTool`, `XquikSearchTweetsTool`, `XquikGetTweetTool`, `XquikGetUserTool`, `XquikGetUserTweetsTool`, `XquikGetTrendsTool`🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/README.md` at line 29, Update the README line that lists API integrations to include all five Xquik tool class names (not just XquikSearchTweetsTool); locate the entry in lib/crewai-tools/README.md where "API Integrations" mentions `XquikSearchTweetsTool` and add the other four Xquik tool symbols (use the exact exported class names as defined in the diff) so the line enumerates all Xquik tools alongside `SerperApiTool` and `ExaSearchTool`, preserving the same inline code formatting and comma-separated style.lib/crewai-tools/tests/tools/xquik_tool_test.py (1)
87-95: ⚡ Quick winStrengthen encoding assertions with non-safe identifiers.
Line 87 and Line 98 claim path encoding behavior, but current inputs (
"123","crew_ai") don’t require encoding. Add at least one case with reserved characters (e.g., spaces,/,?,%) to verify actual percent-encoding and avoid false confidence in these tests.Also applies to: 98-106
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/tests/tools/xquik_tool_test.py` around lines 87 - 95, The test test_get_tweet_encodes_tweet_id currently uses safe identifiers ("123") so it doesn't verify URL percent-encoding; update this test (and the analogous one around lines 98-106 that checks user id encoding) to include at least one case with reserved characters (e.g., a tweet_id/user_id containing space, "/", "?", "%") and assert the HTTP GET URL built by XquikGetTweetTool.run (and the user-id test's tool) contains the percent-encoded form (and not the raw reserved characters); locate the code that inspects mock_get.call_args.args[0] and add assertions for the encoded substring (and/or absence of the raw substring) to prove real percent-encoding is applied.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/crewai-tools/src/crewai_tools/tools/xquik_tool/xquik_tool.py`:
- Around line 183-186: The woeid Field is unbounded and can be 0/negative; add
input validation so callers get a clear error before the API call. Update the
woeid Field declaration(s) (the woeid in the model around the shown block and
the similar Field at the later block) to require a minimum of 1 (e.g.,
Field(..., ge=1, description=...)) or add a pydantic `@validator`("woeid") that
raises ValueError if value < 1, and include a clear message like "woeid must be
>= 1 (use 1 for worldwide)". Ensure both occurrences use the same validation
approach.
- Around line 30-35: The function _normalize_path_identifier currently allows
values like "@" because cleaned.lstrip("@") can become empty; update the
validation to reject identifiers that become empty after stripping leading "@"
by computing stripped = cleaned.lstrip("@") and raising ValueError(f"{name} is
required") if not stripped before calling quote, so the function returns
quote(stripped, safe="") only for non-empty identifiers.
---
Nitpick comments:
In `@lib/crewai-tools/README.md`:
- Line 29: Update the README line that lists API integrations to include all
five Xquik tool class names (not just XquikSearchTweetsTool); locate the entry
in lib/crewai-tools/README.md where "API Integrations" mentions
`XquikSearchTweetsTool` and add the other four Xquik tool symbols (use the exact
exported class names as defined in the diff) so the line enumerates all Xquik
tools alongside `SerperApiTool` and `ExaSearchTool`, preserving the same inline
code formatting and comma-separated style.
In `@lib/crewai-tools/tests/tools/xquik_tool_test.py`:
- Around line 87-95: The test test_get_tweet_encodes_tweet_id currently uses
safe identifiers ("123") so it doesn't verify URL percent-encoding; update this
test (and the analogous one around lines 98-106 that checks user id encoding) to
include at least one case with reserved characters (e.g., a tweet_id/user_id
containing space, "/", "?", "%") and assert the HTTP GET URL built by
XquikGetTweetTool.run (and the user-id test's tool) contains the percent-encoded
form (and not the raw reserved characters); locate the code that inspects
mock_get.call_args.args[0] and add assertions for the encoded substring (and/or
absence of the raw substring) to prove real percent-encoding is applied.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b7366df4-4d6d-45b9-9aa7-36644bf15b67
📒 Files selected for processing (16)
docs/ar/tools/search-research/overview.mdxdocs/ar/tools/search-research/xquiktool.mdxdocs/docs.jsondocs/en/tools/search-research/overview.mdxdocs/en/tools/search-research/xquiktool.mdxdocs/ko/tools/search-research/overview.mdxdocs/ko/tools/search-research/xquiktool.mdxdocs/pt-BR/tools/search-research/overview.mdxdocs/pt-BR/tools/search-research/xquiktool.mdxlib/crewai-tools/README.mdlib/crewai-tools/src/crewai_tools/__init__.pylib/crewai-tools/src/crewai_tools/tools/__init__.pylib/crewai-tools/src/crewai_tools/tools/xquik_tool/README.mdlib/crewai-tools/src/crewai_tools/tools/xquik_tool/__init__.pylib/crewai-tools/src/crewai_tools/tools/xquik_tool/xquik_tool.pylib/crewai-tools/tests/tools/xquik_tool_test.py
0f5c31d to
fdda792
Compare
|
Maintenance update after the branch fell behind main. I rebased the PR on current Focused local validation passed: Ruff format check, Ruff lint, Xquik tool pytest (11 passed), docs JSON parse, and Git diff whitespace check. |
Summary
XquikSearchTweetsToolXquikGetTweetToolXquikGetUserToolXquikGetUserTweetsToolXquikGetTrendsToolcrewai_toolsandcrewai_tools.tools.Duplicate and policy checks
Xquik,x-twitter-scraper,Xquik-dev,xquik.com, andTweetClawentries.Validation
uv run ruff check lib/uv run ruff format --check lib/cd lib/crewai-tools && uv run pytest tests/tools/xquik_tool_test.py -qruby -e 'require "json"; JSON.parse(File.read("docs/docs.json"))'npx -y -p node@22 -p mintlify sh -c 'yes "" | mintlify broken-links || test $? -eq 141'git diff --cached --checkSummary by CodeRabbit
New Features
Documentation
Tests