Skip to main content
Glama

build_approve_token

Create unsigned token approval transactions for the CSPR.trade DEX router to enable token swaps on the Casper Network.

Instructions

Build an unsigned token approval transaction. Spender defaults to the CSPR.trade router.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesToken contract package hash to approve
amountYesRaw amount to approve (in smallest unit / motes)
sender_public_keyYesSender hex public key
spenderNoSpender contract package hash (defaults to CSPR.trade router)

Implementation Reference

  • The 'build_approve_token' tool is defined here. It accepts token details, amount, sender, and optional spender, then calls client.buildApproval and saves the result to a deploy file.
    server.tool(
      'build_approve_token',
      'Build an unsigned token approval transaction. Spender defaults to the CSPR.trade router.',
      {
        token: z.string().describe('Token contract package hash to approve'),
        amount: z.string().describe('Raw amount to approve (in smallest unit / motes)'),
        sender_public_key: z.string().describe('Sender hex public key'),
        spender: z.string().optional().describe('Spender contract package hash (defaults to CSPR.trade router)'),
      },
      async (args) => {
        const bundle = await client.buildApproval({
          tokenContractPackageHash: args.token,
          spenderPackageHash: args.spender ?? '',
          amount: args.amount,
          senderPublicKey: args.sender_public_key,
        });
        const deployPath = await writeDeployFile(bundle.transactionJson);
        return { content: [{ type: 'text' as const, text: bundle.summary + `\n\nUnsigned transaction saved to: ${deployPath}` }] };
      },
    );
Behavior3/5

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

No annotations provided, so description carries full burden. Mentions 'unsigned' which is critical behavioral info (transaction requires signing before submission), and notes the spender default. Missing: gas costs, that this is a write operation, whether approval is additive or replacement, and the prerequisite relationship to swapping.

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 with zero waste. Front-loaded action ('Build an unsigned...') followed by default parameter context. Every word earns its place.

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

Completeness3/5

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

With 100% schema coverage and no output schema, description adequately explains the operation. However, given this is a transaction builder with no annotations, it should mention the output is a transaction to be signed/submitted via submit_transaction sibling, or explain the 'unsigned' nature in workflow context.

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?

Schema has 100% coverage with clear descriptions. Description adds valuable semantic context beyond schema by specifying the spender 'defaults to the CSPR.trade router'—default values and domain context not present in the schema itself.

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

Purpose4/5

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

Clear specific verb ('Build') and resource ('unsigned token approval transaction'). The 'token approval' specificity distinguishes it from sibling build_swap/build_add_liquidity tools. CSPR.trade router reference provides domain context, though it could explicitly state this is for ERC-20/Casper token standards.

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?

Provides implied usage context by mentioning 'CSPR.trade router' as the default spender, suggesting this is for DEX interactions. However, lacks explicit guidance on when to use (e.g., 'call before build_swap if token lacks allowance') or when not to use (e.g., if already approved).

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/make-software/cspr-trade-mcp'

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