Types
The 15 meta-tool definitions, what every Session method takes and returns, and where each wire type lives.
Types
@codespar/sdk re-exports everything in @codespar/types (export * from "@codespar/types"), so every wire type below imports from either package. The SDK adds its own configuration and loop types on top.
import type { ChargeArgs, ChargeResult, SessionConfig, LoopConfig } from "@codespar/sdk";Where each type lives
| Area | Types | Source |
|---|---|---|
| Client and session config | CodeSparConfig, SessionConfig, CallOptions, Tool | packages/core/src/types.ts |
| Complete Loop | LoopConfig, LoopStep, LoopResult | same file |
| Session contract | Session, SessionBase, ToolResult, SendResult, StreamEvent, ToolCallRecord, ServerConnection, ProxyRequest, ProxyResult, AuthConfig, AuthResult, CreateSessionRequest, MockObject, MockValue | packages/types/src/types.ts |
| Meta-tool wrappers | ChargeArgs/ChargeResult, PayArgs/PayResult, KycArgs/KycResult, ShipArgs/ShipResult, LedgerArgs/LedgerResult, LedgerReceiptResult, LedgerReceiptsResult, AgenticReceipt, IssueArgs/IssueResult, ShopArgs/ShopResult (and the ShopSearch*, ShopCheckout*, ShopStatus* members of those unions) | same file |
| Status polling and streams | PaymentStatus, PaymentStatusResult, PaymentStatusEvent, PaymentStatusStreamOptions, VerificationStatus, VerificationStatusResult, VerificationStatusEvent, VerificationStatusStreamOptions | same file |
| Discovery and connections | DiscoverOptions, DiscoverResult, DiscoverToolMatch, DiscoverPlanStep, ConnectionWizardOptions, ConnectionWizardResult, ConnectionStatusRow, ConnectionWizardInstructions | same file |
| Tool-result codes | ToolResultCode, ToolResultOutcome, PolicyDeniedOutput, ApprovalRequiredOutput, MocksExhaustedOutput, MocksEngineErrorOutput, ToolNotMockedOutput and the *ToolCall narrowings | packages/core/src/tool-result-codes.ts |
| Meta-tool definitions | SharedMetaToolDefinition, MetaToolInputSchema, MetaToolInputProperty, MetaToolConformanceContract, SharedMetaToolName, MetaToolHook, MetaToolDefinition, MetaToolResult, MetaToolExecutionContext | packages/types/src/meta-tool-definitions.ts |
| REST client (from 0.12.0) | ApiClientConfig, ApiPaths, ApiPath, ApiMethod, ApiOperation, ApiRequestOptions, ApiRequestBody, ApiResponse, ApiSuccess, ApiComponents | packages/core/src/api/types.ts |
The shapes on the method pages are copied from those files at the commit the surface snapshot names. When a field here and a field there disagree, the file wins; the pages are corrected, not the code.
Two unit conventions worth reading twice: ChargeArgs.amount is in major units (R$ 125.00 is 125) while PayArgs.amount, LedgerLeg.amount and every *_minor field are in minor units (R$ 1.25 is 125); and every timeout in this SDK is in milliseconds, where the Python package takes seconds.
Meta-tool definitions
The 15 tools the hosted server lists, from the same tools/list snapshot the meta-tool pages are checked against. @codespar/types publishes each one as a SharedMetaToolDefinition constant (re-exported by @codespar/sdk), and SHARED_META_TOOL_DEFINITIONS keys them by wire name. "Typed wrapper" is the Session method that calls the tool with a typed argument and result; the rest go through session.execute(name, input).
| Tool | Definition constant | Required input | Typed wrapper |
|---|---|---|---|
codespar_discover | DISCOVER_DEFINITION | use_case | session.discover() |
codespar_get_started | GET_STARTED_DEFINITION | none | session.execute("codespar_get_started", input) |
codespar_manage_connections | MANAGE_CONNECTIONS_DEFINITION | none | session.connectionWizard() |
codespar_checkout | CHECKOUT_DEFINITION | items | session.execute("codespar_checkout", input) |
codespar_pay | PAY_DEFINITION | action | session.execute("codespar_pay", input) |
codespar_wallet | WALLET_DEFINITION | action | session.execute("codespar_wallet", input) |
codespar_shop | SHOP_DEFINITION | action | session.shop() |
codespar_charge | CHARGE_DEFINITION | none | session.charge() |
codespar_invoice | INVOICE_DEFINITION | type | session.execute("codespar_invoice", input) |
codespar_ship | SHIP_DEFINITION | action | session.ship() |
codespar_notify | NOTIFY_DEFINITION | channel, to | session.execute("codespar_notify", input) |
codespar_crypto_pay | CRYPTO_PAY_DEFINITION | amount, currency, direction | session.execute("codespar_crypto_pay", input) |
codespar_kyc | KYC_DEFINITION | buyer, check_type | session.execute("codespar_kyc", input) |
codespar_ledger | LEDGER_DEFINITION | action | session.ledger() |
codespar_issue | ISSUE_DEFINITION | action | session.issue() |
What each method takes and returns
Read from session.ts on the core's main branch (0.12.0). CallOptions is the per-call { timeout, signal } bag every method takes as a trailing opts; in @codespar/sdk since 0.12.0 (npm: 0.12.0). The method pages document it once, on the client page, rather than in every table.
| Method | Parameters | Returns |
|---|---|---|
tools | none | Promise<Tool[]> |
findTools | intent: string | Promise<Tool[]> |
execute | toolName: string, params: Record<string, unknown>, opts?: CallOptions | Promise<ToolResult> |
proxyExecute | request: ProxyRequest, opts?: CallOptions | Promise<ProxyResult> |
send | message: string, opts?: CallOptions | Promise<SendResult> |
sendStream | message: string, opts?: CallOptions | AsyncIterable<StreamEvent> |
discover | useCase: string, options?: DiscoverOptions, opts?: CallOptions | Promise<DiscoverResult> |
connectionWizard | options: ConnectionWizardOptions, opts?: CallOptions | Promise<ConnectionWizardResult> |
charge | args: ChargeArgs, opts?: CallOptions | Promise<ChargeResult> |
ship | args: ShipArgs, opts?: CallOptions | Promise<ShipResult> |
ledger | args: LedgerArgs, opts?: CallOptions | Promise<LedgerResult> |
issue | args: IssueArgs, opts?: CallOptions | Promise<IssueResult> |
shop | args: ShopArgs, opts?: CallOptions | Promise<ShopResult> |
paymentStatus | toolCallId: string, opts?: CallOptions | Promise<PaymentStatusResult> |
verificationStatus | toolCallId: string, opts?: CallOptions | Promise<VerificationStatusResult> |
paymentStatusStream | toolCallId: string, options?: PaymentStatusStreamOptions | Promise<PaymentStatusResult> |
verificationStatusStream | toolCallId: string, options?: VerificationStatusStreamOptions | Promise<VerificationStatusResult> |
authorize | serverId: string, config: AuthConfig, opts?: CallOptions | Promise<AuthResult> |
connections | opts?: CallOptions | Promise<ServerConnection[]> |
close | opts?: CallOptions | Promise<void> |