Skip to main content
Glama

meta_refresh_token

Refresh your Meta long-lived access token before it expires to obtain a new valid token, ensuring uninterrupted API access.

Instructions

Refresh a long-lived token before it expires. Returns a new long-lived token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
long_lived_tokenYesCurrent long-lived access token to refresh

Implementation Reference

  • The MCP tool handler for 'meta_refresh_token'. It accepts a 'long_lived_token' string, calls client.refreshToken(), and returns the result as JSON text content.
    // ─── meta_refresh_token ──────────────────────────────────────
    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 };
        }
      }
    );
  • Input schema for meta_refresh_token: requires a single string parameter 'long_lived_token' described as 'Current long-lived access token to refresh'.
    {
      long_lived_token: z.string().describe("Current long-lived access token to refresh"),
    },
  • Registration of the tool on the MCP server via server.tool('meta_refresh_token', ...).
    server.tool(
      "meta_refresh_token",
  • The MetaClient.refreshToken() helper method that performs the actual API call to refresh a long-lived token via GET /oauth/access_token with grant_type=fb_exchange_token.
    /** Refresh a long-lived token */
    async refreshToken(longToken: string): Promise<ClientResponse> {
      return this.request(IG_BASE, longToken, "GET", "/oauth/access_token", {
        grant_type: "fb_exchange_token",
      });
    }
  • src/index.ts:9-9 (registration)
    Import of registerMetaAuthTools which registers meta_refresh_token along with other Meta auth tools.
    import { registerMetaAuthTools } from "./tools/meta/auth.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description must disclose behavioral traits. It states 'Returns a new long-lived token' but does not mention whether the old token is invalidated, if permissions change, or any rate limits or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the action and result. However, it could be slightly more informative without losing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no output schema, the description covers the essential purpose and result. It could mention what happens to the old token or typical usage context to be fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The only parameter 'long_lived_token' is described in the schema as 'Current long-lived access token to refresh'. The description adds no additional semantic context beyond what the schema already provides. With 100% schema coverage, baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Refresh a long-lived token') and the resource ('long-lived token'). It distinguishes from sibling tools like meta_exchange_token (which exchanges short-lived for long-lived) and meta_debug_token (which debugs tokens).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage timing ('before it expires') but does not explicitly contrast with alternative token management tools (e.g., meta_exchange_token) or state when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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