Skip to main content
Glama

debug_token

Debug a Meta access token to verify its properties, permissions, expiration, and validity. Requires app ID and secret.

Instructions

Debug an access token to inspect its properties, permissions, expiration, and validity. Requires META_APP_ID and META_APP_SECRET.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_tokenYesAccess token to debug/inspect

Implementation Reference

  • Implementation of the debugToken method on AdsClient. Calls Meta's /debug_token endpoint with an app access token (appId|appSecret) to inspect the provided input_token. Returns the JSON response with token properties, permissions, expiration, and validity.
    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}`;
      const qs = new URLSearchParams({
        input_token: inputToken,
        access_token: appToken,
      });
      const url = `${this.baseUrl}/debug_token?${qs.toString()}`;
      const res = await fetch(url, { signal: AbortSignal.timeout(30_000) });
    
      if (!res.ok) {
        const text = await res.text().catch(() => "");
        throw new Error(`Token debug failed (${res.status}): ${text}`);
      }
    
      const data = await res.json();
      if (data.error) {
        throw new Error(this.formatError(data));
      }
      return { data };
    }
  • Zod schema for the debug_token tool: requires 'input_token' as a string. No additional validation or output schema defined.
    {
      input_token: z.string().describe("Access token to debug/inspect"),
    },
  • Registration of the 'debug_token' tool using server.tool() in the registerAuthTools function. The tool handler extracts input_token, calls client.debugToken(), and returns the data as formatted JSON text.
      // ─── debug_token ──────────────────────────────────────────────
      server.tool(
        "debug_token",
        "Debug an access token to inspect its properties, permissions, expiration, and validity. Requires META_APP_ID and META_APP_SECRET.",
        {
          input_token: z.string().describe("Access token to debug/inspect"),
        },
        async ({ input_token }) => {
          try {
            const { data } = await client.debugToken(input_token);
            return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    }
  • src/index.ts:93-93 (registration)
    Call to registerAuthTools(server, client) which wires up the debug_token tool into the MCP server.
    registerAuthTools(server, client);
Behavior4/5

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

No annotations are provided, so the description fully bears the burden. It discloses the tool performs inspection without modification, listing inspected attributes. However, it does not mention potential side effects or rate limits, though none are expected.

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

Conciseness5/5

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

Two sentences, front-loaded with purpose and quickly stating prerequisites. No redundant or unnecessary content.

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 single-parameter, no-output-schema tool with no annotations, the description adequately covers what the tool does and what it requires. It could mention return format but is sufficient.

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?

Schema coverage is 100% with one parameter described as 'Access token to debug/inspect.' The description adds minimal value beyond rephrasing the schema's purpose (inspect properties).

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 precisely states the tool debugs an access token to inspect properties, permissions, expiration, and validity. It clearly distinguishes from sibling CRUD or exchange tools.

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 mentions required credentials (META_APP_ID and META_APP_SECRET) but does not provide explicit when-to-use or when-not-to-use guidance relative to similar tools like exchange_token or refresh_token.

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-ads-mcp'

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