Skip to main content
Glama

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
NameRequiredDescriptionDefault
short_lived_tokenYesShort-lived access token to exchange

Implementation Reference

  • 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 };
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikusnuz/meta-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server