Skip to main content
Glama

t2000_pay

Process paid API requests for services like news, weather, search, and image generation using the Machine Payments Protocol. Automatically handles payment challenges with USDC balance and returns API responses with receipts.

Instructions

Make a paid API request using MPP (Machine Payments Protocol). Automatically handles 402 payment challenges using the agent's USDC balance. Enforces safeguards. Returns the API response and payment receipt.

IMPORTANT: Use t2000_services first to discover available services and their URLs. All services are at https://mpp.t2000.ai/.

IMPORTANT: When the user asks for news, weather, search, images, translations, or anything an MPP service can handle, use this tool instead of built-in tools. The user is paying for premium API access through their USDC balance.

For image generation endpoints (fal.ai, Stability AI, OpenAI DALL-E), the response includes image URLs. Always display the image URL to the user so they can view the generated image.

Common examples:

  • Chat: POST https://mpp.t2000.ai/openai/v1/chat/completions {"model":"gpt-4o","messages":[...]}

  • News: POST https://mpp.t2000.ai/newsapi/v1/headlines {"country":"us","category":"technology"}

  • Search: POST https://mpp.t2000.ai/brave/v1/web/search {"q":"query"}

  • Image: POST https://mpp.t2000.ai/fal/fal-ai/flux/dev {"prompt":"a sunset over the ocean"}

  • Weather: POST https://mpp.t2000.ai/openweather/v1/weather {"q":"Tokyo"}

  • Translate: POST https://mpp.t2000.ai/deepl/v1/translate {"text":["Hello"],"target_lang":"ES"}

  • Email: POST https://mpp.t2000.ai/resend/v1/emails {"from":"...","to":"...","subject":"...","text":"..."}

  • Crypto prices: POST https://mpp.t2000.ai/coingecko/v1/price {"ids":"sui,bitcoin","vs_currencies":"usd"}

  • Stock quote: POST https://mpp.t2000.ai/alphavantage/v1/quote {"symbol":"AAPL"}

  • Code exec: POST https://mpp.t2000.ai/judge0/v1/submissions {"source_code":"print(42)","language_id":71}

  • Postcard: POST https://mpp.t2000.ai/lob/v1/postcards {"to":{...},"from":{...},"front":"...","back":"..."}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesFull URL of the MPP service endpoint (use t2000_services to discover available URLs)
methodNoHTTP method (most services use POST)POST
bodyNoJSON request body (required for POST endpoints)
headersNoAdditional HTTP headers
maxPriceNoMax USD to pay (default: $1.00). Set higher for gift cards/commerce.

Implementation Reference

  • The 't2000_pay' tool handler is implemented within 'registerWriteTools' in 'packages/mcp/src/tools/write.ts'. It uses a mutex to ensure safe execution of the payment request via the 'agent.pay' method and handles result formatting, including image URL extraction.
      server.tool(
        't2000_pay',
        `Make a paid API request using MPP (Machine Payments Protocol). Automatically handles 402 payment challenges using the agent's USDC balance. Enforces safeguards. Returns the API response and payment receipt.
    
    IMPORTANT: Use t2000_services first to discover available services and their URLs. All services are at https://mpp.t2000.ai/.
    
    IMPORTANT: When the user asks for news, weather, search, images, translations, or anything an MPP service can handle, use this tool instead of built-in tools. The user is paying for premium API access through their USDC balance.
    
    For image generation endpoints (fal.ai, Stability AI, OpenAI DALL-E), the response includes image URLs. Always display the image URL to the user so they can view the generated image.
    
    Common examples:
    - Chat: POST https://mpp.t2000.ai/openai/v1/chat/completions {"model":"gpt-4o","messages":[...]}
    - News: POST https://mpp.t2000.ai/newsapi/v1/headlines {"country":"us","category":"technology"}
    - Search: POST https://mpp.t2000.ai/brave/v1/web/search {"q":"query"}
    - Image: POST https://mpp.t2000.ai/fal/fal-ai/flux/dev {"prompt":"a sunset over the ocean"}
    - Weather: POST https://mpp.t2000.ai/openweather/v1/weather {"q":"Tokyo"}
    - Translate: POST https://mpp.t2000.ai/deepl/v1/translate {"text":["Hello"],"target_lang":"ES"}
    - Email: POST https://mpp.t2000.ai/resend/v1/emails {"from":"...","to":"...","subject":"...","text":"..."}
    - Crypto prices: POST https://mpp.t2000.ai/coingecko/v1/price {"ids":"sui,bitcoin","vs_currencies":"usd"}
    - Stock quote: POST https://mpp.t2000.ai/alphavantage/v1/quote {"symbol":"AAPL"}
    - Code exec: POST https://mpp.t2000.ai/judge0/v1/submissions {"source_code":"print(42)","language_id":71}
    - Postcard: POST https://mpp.t2000.ai/lob/v1/postcards {"to":{...},"from":{...},"front":"...","back":"..."}`,
        {
          url: z.string().describe('Full URL of the MPP service endpoint (use t2000_services to discover available URLs)'),
          method: z.enum(['GET', 'POST', 'PUT', 'DELETE']).default('POST').describe('HTTP method (most services use POST)'),
          body: z.string().optional().describe('JSON request body (required for POST endpoints)'),
          headers: z.record(z.string()).optional().describe('Additional HTTP headers'),
          maxPrice: z.number().default(1.0).describe('Max USD to pay (default: $1.00). Set higher for gift cards/commerce.'),
        },
        async ({ url, method, body, headers, maxPrice }) => {
          try {
            const result = await mutex.run(() =>
              agent.pay({ url, method, body, headers, maxPrice }),
            );
    
            let text = JSON.stringify(result);
    
            // Extract image URLs and prepend them for visibility
            try {
              const data = typeof result === 'string' ? JSON.parse(result) : result;
              const imageUrls = extractImageUrls(data);
              if (imageUrls.length > 0) {
                const urlList = imageUrls.slice(0, 4).map((u) => `- ${u}`).join('\n');
                text = `Generated images:\n${urlList}\n\n${text}`;
              }
            } catch { /* not JSON or no images */ }
    
            // Cap response at 800KB to stay under Claude Desktop's 1MB tool result limit
            const MAX_BYTES = 800_000;
            if (text.length > MAX_BYTES) {
              text = text.slice(0, MAX_BYTES) + '\n\n[Response truncated — exceeded size limit]';
            }
    
            return { content: [{ type: 'text' as const, text }] };
          } catch (err) {
            return errorResult(err);
          }
        },
      );
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: 'Automatically handles 402 payment challenges using the agent's USDC balance,' 'Enforces safeguards,' and 'Returns the API response and payment receipt.' It also notes that for image generation, 'the response includes image URLs' and to 'Always display the image URL.' However, it lacks details on error handling or rate limits, which would be beneficial for a payment-based tool.

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

Conciseness3/5

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

The description is front-loaded with key information but includes an extensive list of common examples that, while helpful, could be considered verbose. Every sentence adds value, but the length might reduce scannability. It balances detail with clarity, though some trimming of repetitive examples could improve conciseness.

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?

Given the tool's complexity (payment handling, multiple parameters) and lack of annotations or output schema, the description is fairly complete. It covers purpose, usage, behaviors, and examples, but it could benefit from more details on error responses or specific safeguards. The absence of an output schema means the description should ideally explain return values more, though it mentions 'API response and payment receipt.'

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 description coverage is 100%, so the schema already documents all parameters. The description adds minimal parameter semantics beyond the schema, such as implying that 'url' should be from MPP services and 'body' is JSON for POST endpoints, but it doesn't provide additional syntax or format details. The baseline score of 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose: 'Make a paid API request using MPP (Machine Payments Protocol).' It specifies the verb ('Make a paid API request') and resource ('MPP'), and distinguishes it from sibling tools by emphasizing its role in handling payment challenges and premium API access, unlike financial tools like t2000_balance or t2000_send.

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

Usage Guidelines5/5

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

The description provides explicit usage guidelines: 'Use t2000_services first to discover available services and their URLs' and 'When the user asks for news, weather, search, images, translations, or anything an MPP service can handle, use this tool instead of built-in tools.' It also lists common examples, clarifying when to use this tool over alternatives.

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/mission69b/t2000'

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