Skip to main content
Glama

meta_debug_token

Inspect an access token to validate its structure, check expiration status, review granted permissions, and identify the associated user account.

Instructions

Debug/inspect an access token to check validity, expiration, scopes and associated user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_tokenYesAccess token to inspect

Implementation Reference

  • Tool handler for 'meta_debug_token' - calls client.debugToken() and returns result as JSON text, or an error message on failure.
    server.tool(
      "meta_debug_token",
      "Debug/inspect an access token to check validity, expiration, scopes and associated user.",
      {
        input_token: z.string().describe("Access token to inspect"),
      },
      async ({ input_token }) => {
        try {
          const { data, rateLimit } = await client.debugToken(input_token);
          return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Token debug failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Zod schema for the tool: requires 'input_token' (string) which is the access token to inspect.
    {
      input_token: z.string().describe("Access token to inspect"),
    },
  • The 'registerMetaAuthTools' function registers the tool via server.tool(). Called from src/index.ts line 41.
    export function registerMetaAuthTools(server: McpServer, client: MetaClient): void {
      // ─── meta_exchange_token ─────────────────────────────────────
      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 };
          }
        }
      );
    
      // ─── 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 };
          }
        }
      );
    
      // ─── meta_debug_token ────────────────────────────────────────
      server.tool(
  • MetaClient.debugToken() - calls the Meta Graph API /debug_token endpoint with an app access token to inspect the given input token.
    /** Debug a token */
    async debugToken(inputToken: string): Promise<ClientResponse> {
      if (!this.config.appId || !this.config.appSecret) {
        throw new Error("META_APP_ID and META_APP_SECRET are required for token debug.");
      }
      const appToken = `${this.config.appId}|${this.config.appSecret}`;
      return this.request(IG_BASE, appToken, "GET", "/debug_token", {
        input_token: inputToken,
      });
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses the tool inspects token info (validity, etc.) implying it is a read operation, but does not explicitly state it is non-destructive or safe, nor does it mention any required permissions or edge cases.

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 sentence that conveys the purpose effectively. It is concise and front-loaded, though the information could be structured slightly more clearly.

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 what to expect. It is likely sufficient for an agent to select and invoke the tool correctly, though details on output format are omitted.

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

Parameters4/5

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

The schema already describes the parameter as 'Access token to inspect'. The tool description adds context by specifying what will be checked (validity, expiration, scopes, user), adding meaningful semantics beyond the raw schema.

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 ('debug/inspect'), the resource ('access token'), and the specific checks performed ('validity, expiration, scopes and associated user'). This distinguishes it from sibling tools like meta_exchange_token or meta_refresh_token.

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 does not explicitly state when to use this tool versus alternatives. Usage context is implied by the tool name and sibling list, but no direct guidance on when to use or not use is provided.

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