Composio 移行
Composio スタイルツールから Twexapi MCP へ X/Twitter エージェントワークフローを移行する。
エージェントが既にパッケージ X/Twitter ツールを呼び、ワークフローを Twexapi MCP へ移したいときにこのガイドを使いましょう。
前提条件
- Twexapi API キー
- エージェントが使う既存 X/Twitter アクション一覧
https://api.twexapi.io/mcpに接続した MCP 対応ランタイム- 旧ワークフローのテストプロンプトと期待出力
MCP クライアントは x-api-key: YOUR_API_KEY、REST フォールバックは Authorization: Bearer YOUR_API_KEY。
移行マップ
| Existing behavior | Twexapi MCP pattern |
|---|---|
| Search tweets | explore(query="advanced search")、続けて twexapi_request |
| Read a profile | explore(category="users") または explore(category="accounts") |
| Get followers | explore(category="followers") |
| Read replies or quotes | explore(category="engagement") |
| Post or reply | read_only: false カタログエントリを使用し確認を要求 |
エージェント指示
Replace packaged X/Twitter tools with Twexapi MCP.
First call explore to find the closest Twexapi endpoint.
Then call twexapi_request with the exact method and relative path returned by explore.
Preserve tweet_id, user_id, route_used, has_more, and next_cursor.
Ask for confirmation before read_only: false actions.
ハンドオフ契約
下流ステップが消費する前に、移行後ツールすべてが安定ハンドオフオブジェクトを返すようにします。
{
"route_used": "/twitter/advanced_search/page",
"method": "POST",
"source_tool": "legacy_twitter_search",
"has_more": true,
"next_cursor": "cursor_123",
"rows": [
{
"tweet_id": "1803006263529541838",
"author_username": "openai",
"text": "Example tweet text",
"created_at": "2026-07-02T10:00:00Z",
"public_url": "https://x.com/i/web/status/1803006263529541838"
}
]
}
移行例
旧タスク:
Search Twitter for AI agent launch announcements and summarize the top posts.
Twexapi MCP タスク:
Use Twexapi MCP to search recent X posts about "AI agent launch".
Call explore first and choose the search endpoint.
Return JSON with route_used, tweets[{tweet_id,text,author_username,created_at,public_url}], has_more, next_cursor, and a short summary.
検証チェックリスト
- 移行前後の行数を比較。
- 下流ステップが URL 解析ではなく
tweet_idを使うことを確認。 - カーソルがエージェント会話外に保存されることを確認。
- 移行した書き込みアクションに人間承認を追加。
ツール呼び出し書き換え
旧エージェント指示を機械的に書き換えるとき:
| Old instruction | New instruction |
|---|---|
| “Call the Twitter search tool” | “Call explore(query=\"advanced search\"), then twexapi_request.” |
| “Fetch this profile” | “Call explore(category=\"users\") and preserve user_id.” |
| “Continue pagination” | “Use the returned next_cursor; do not parse it.” |
| “Post this tweet” | “Prepare a write plan and ask for approval before read_only: false.” |
回帰プロンプト
移行前後で実行:
Find recent posts about "AI agents" from the last 24 hours.
Return exactly 10 rows with tweet_id, author_username, text, created_at, public_url, route_used, has_more, and next_cursor.
Do not call write endpoints.
本番ロールアウト
- 読み取り専用タスクで新旧ワークフローを並行実行。
- 行数、必須フィールド、代表 URL を比較。
- スケジュールジョブを Twexapi MCP/REST ルートに切り替え。
- 承認プロンプトをテストした後のみ書き込みを再有効化。