Skip to main content
Glama
evidai

LemonCake — AI Agent Wallet & USDC Pay-per-call

call_service

Invokes an upstream API through LemonCake's pay-per-call proxy, automatically charging USDC from your Pay Token for each successful call.

Instructions

Invoke an upstream API service through LemonCake's pay-per-call proxy. Each successful call automatically charges USDC against your configured Pay Token.

PRECONDITIONS: • LEMON_CAKE_PAY_TOKEN env var must be set for real services. If missing, the tool returns a structured CREDENTIAL_MISSING error with how-to-fix steps. • DEMO MODE: serviceId values starting with demo_ (demo_search / demo_echo / demo_fx) work WITHOUT any auth and return canned responses — useful for Glama Inspector or new-user trial. They are clearly marked with mode: "demo" and incur no charge. • serviceId must come from list_services.

BEHAVIOR: • Returns the upstream response body verbatim (JSON or text), plus the X-Charge-Id and X-Amount-Usdc headers reported by the proxy. • HTTP 402 Payment Required is returned as a normal result (NOT thrown) so the agent can autonomously stop spending when the Pay Token's limitUsdc is exhausted. • Pass the same idempotencyKey to retry safely without double-charging. • This tool spends real money and contacts an external service — it is non-idempotent by default and has external side effects.

x402-COMPATIBLE INTERFACE (since v0.5.1): • Successful calls include an x402Receipt field with { scheme, chain, asset, amount, recipient, paymentIntentId, settledAt }. Same shape as on-chain x402 receipts so the agent's payment-handling logic is portable. • If upstream returns an x402 challenge (WWW-Authenticate: x402, X-402-* headers, or body.x402), it's parsed into x402Challenge for the agent to reason about. On-chain auto-pay from Pay Token is gated (see issue #4); for now the agent should escalate. • If upstream returns 202 + Retry-After + X-Payment-Status: pending, the result is { status: "PAYMENT_PENDING", paymentIntentId, retryAfterMs, retryContract }. Re-call with the same idempotencyKey to resume — no double-charge.

Returns: { status, chargeId, amountUsdc, response, x402Receipt?, x402Challenge?, hint? }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceIdYesID of the service to call (obtain from list_services).
pathNoSub-path on the service (e.g. "/search", "/v1/completions"). Defaults to "/"./
methodNoHTTP method to use against the service. Defaults to GET.GET
bodyNoJSON request body (only used for POST/PUT/PATCH).
idempotencyKeyNoOptional idempotency key (UUID recommended). Identical keys within the proxy's retention window return the cached result without re-charging.
Behavior5/5

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

The description fully discloses behavioral traits beyond annotations: it charges USDC, contacts external services, is non-idempotent, handles credential missing errors, and returns 402 normally. No contradictions with annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true are consistent).

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 well-structured with headings (PRECONDITIONS, BEHAVIOR, x402-COMPATIBLE) and front-loads the core purpose. While lengthy, each section adds value. A slight trim could improve conciseness, but it remains efficient given the tool's complexity.

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

Completeness5/5

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

Given the tool's complexity (charged service, demo mode, x402 interface, error handling) and no output schema, the description thoroughly explains preconditions, behavior, return fields, and error states. It covers all necessary context for an agent to use the tool correctly.

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?

Input schema covers all 5 parameters (100% coverage). The description adds meaningful context for idempotencyKey (retry without double-charge), explains body only for certain methods, and clarifies path defaults. This enhances understanding beyond the schema alone.

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 invokes an upstream API service via a pay-per-call proxy, distinguishing it from sibling tools like list_services (which provides service IDs) and check_balance. It uses specific verbs and resources, making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description includes detailed preconditions (env var, demo mode) and explains when to use (to call a paid service) and how to handle errors (e.g., 402 as normal result). It implicitly distinguishes from siblings but could explicitly state 'use this when you need to call a service from list_services'.

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/evidai/lemon-cake'

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