Skip to main content
Glama
aibtcdev
by aibtcdev

call_contract

Signs and broadcasts a Stacks smart contract function call with typed arguments and post conditions, constraining asset movement and enforcing wallet spending limits.

Instructions

Call a function on a Stacks smart contract. Signs and broadcasts the transaction.

For typed arguments, use objects like {type: 'uint', value: 100} or {type: 'principal', value: 'SP...'}

Post conditions constrain what assets the transaction can move. Each condition is an object:

  • STX: {type: 'stx', principal: 'SP...', conditionCode: 'eq'|'gt'|'gte'|'lt'|'lte', amount: '1000000'}

  • FT: {type: 'ft', principal: 'SP...', asset: 'SP...contract', assetName: 'token-name', conditionCode: 'eq', amount: '1000'}

  • NFT: {type: 'nft', principal: 'SP...', asset: 'SP...contract', assetName: 'nft-name', tokenId: '1', notSend?: boolean}

Spending limit: STX and sBTC leaving this wallet are metered against the wallet's spending cap. In 'deny' mode that is read from eq/lt/lte post conditions on this wallet ('gt'/'gte' on this wallet's own STX or sBTC are refused: they set no upper bound). In 'allow' mode, set maxStxSpend / maxSbtcSpend: they are added as on-chain post conditions on this wallet and metered.

Tip: call earning_opportunities to see how to put your assets to work.

Input Schema

NameRequiredDescriptionDefault
feeNoOptional fee: 'low' | 'medium' | 'high' preset or micro-STX amount. Clamped to 50,000 uSTX max for contract calls. If omitted, medium-priority fee is auto-resolved. Ignored when sponsored=true.
sponsoredNoUse sponsored transaction relay so a relay service pays fees instead of your wallet. Requires SPONSOR_API_KEY env var or wallet-level sponsorApiKey.
maxStxSpendNo'allow' mode only: most micro-STX this call may take from this wallet (on-chain post condition, metered). Default 0.0
contractNameYesThe contract name (e.g., 'my-token')
functionArgsNoFunction arguments. For explicit types: {type: 'uint'|'int'|'principal'|..., value: ...}
functionNameYesThe function to call (e.g., 'transfer')
maxSbtcSpendNo'allow' mode only: most sBTC sats this call may take from this wallet (on-chain post condition, metered). Default 0.0
postConditionsNoOptional post conditions to constrain asset movements. See description for format.
contractAddressYesThe contract deployer's address (e.g., SP2...)
postConditionModeNo'deny' (default): Blocks unexpected transfers. 'allow': Permits transfers not covered by a post condition, except this wallet's STX/sBTC, which maxStxSpend/maxSbtcSpend bound.deny

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.77.0

TDQS

A4/5.0
Behavior4/5

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

With zero annotations the description carries the full burden, and it does substantial work: it discloses that the tool signs and broadcasts (an irreversible on-chain mutation), that spending is metered against a wallet cap, and that 'gt'/'gte' on the wallet's own STX/sBTC are refused because they set no upper bound. Gaps remain — no mention that the wallet must be unlocked, that gas is consumed on failure, or whether the call returns a txid versus waiting for confirmation.

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?

Purpose is front-loaded in the first sentence, then the payload formats follow in scannable bullets with a clear progression from args to post conditions to spend limits. The closing 'Tip' promoting `earning_opportunities` is promotional and does not help the caller invoke this tool correctly, which is the main wasted line.

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 10-parameter mutation tool with no annotations and no output schema, the description covers the hard parts well: argument encoding, post-condition construction, and the spending-cap interaction with postConditionMode. It stops short of stating the preconditions (unlocked wallet, funded balance) and what the call returns, which an agent still has to discover elsewhere.

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

Parameters5/5

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

Schema coverage is 100%, but the two untyped array parameters (`functionArgs` and especially `postConditions`, whose item schema is empty `{}`) are only usable because the description supplies their full object shapes for STX, FT and NFT conditions and the typed-argument form. This is genuine meaning added beyond the schema, not restatement.

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?

States a specific verb and resource — 'Call a function on a Stacks smart contract' — plus the key consequence, 'Signs and broadcasts the transaction.' This distinguishes it implicitly from read-only siblings, but it never names `call_read_only_function` or simple-transfer tools like `transfer_stx`/`transfer_token` as the alternative paths for those cases.

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?

There is real conditional guidance inside the parameter discussion: when to use 'deny' vs 'allow' post-condition mode and when maxStxSpend/maxSbtcSpend apply. However, there is no explicit 'use this when / use X instead' routing against the many sibling tools that also write to chain; an agent must infer that this is the escape hatch for arbitrary contract calls.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools