meta_exchange_token
Exchange a short-lived access token for a long-lived token valid for approximately 60 days using META_APP_ID and META_APP_SECRET credentials.
Instructions
Exchange a short-lived token for a long-lived token (valid ~60 days). Requires META_APP_ID and META_APP_SECRET.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| short_lived_token | Yes | Short-lived access token to exchange |
Implementation Reference
- src/tools/meta/auth.ts:7-21 (handler)Registration and handler logic for the meta_exchange_token tool. It takes a short_lived_token and calls client.exchangeToken.
server.tool( "meta_exchange_token", "Exchange a short-lived token for a long-lived token (valid ~60 days). Requires META_APP_ID and META_APP_SECRET.", { short_lived_token: z.string().describe("Short-lived access token to exchange"), }, async ({ short_lived_token }) => { try { const { data, rateLimit } = await client.exchangeToken(short_lived_token); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Token exchange failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );