meta_refresh_token
Refresh long-lived access tokens before expiration to maintain continuous API access for Instagram Graph, Threads, and Meta platform operations.
Instructions
Refresh a long-lived token before it expires. Returns a new long-lived token.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| long_lived_token | Yes | Current long-lived access token to refresh |
Implementation Reference
- src/tools/meta/auth.ts:24-38 (handler)The implementation of the meta_refresh_token MCP tool, which registers the tool handler using server.tool and calls client.refreshToken to process the request.
server.tool( "meta_refresh_token", "Refresh a long-lived token before it expires. Returns a new long-lived token.", { long_lived_token: z.string().describe("Current long-lived access token to refresh"), }, async ({ long_lived_token }) => { try { const { data, rateLimit } = await client.refreshToken(long_lived_token); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Token refresh failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );