/** * mcpc argument encoder — converts classifier output into mcpc CLI argv shape. * * @remarks * mcpc (Apify's MCP CLI) accepts tool arguments in two forms: * * - `key=value` — literal string. Used for `string` schemas and enums. * - `key:=value` — JSON-typed. Used for `number`/`integer`/`boolean` and * for arrays/objects passed as JSON literals. * * For Tier 3 fallback (anything we couldn't safely flatten), we emit a * single `--json ''` argument. The payload is a placeholder — * this encoder is for documentation rendering, not runtime invocation, so * actual values are substituted by the consumer at call time. * * @module args */ import type { ParameterPlan } from '@to-skills/mcp'; /** Encoder result — separated into normal flags vs Tier 3 fallback. */ export interface EncodedArgs { /** * Encoded arguments for Tier 1 + Tier 2 plans, one string per CLI token. * Order matches insertion order of the input plan map (which itself * preserves classifier walk order). */ tier12: string[]; /** * When ANY plan in the input has `tier === 3`, this is the single * `--json ''` token string. Otherwise `null`. mcpc accepts * one `--json` per call carrying the structural arguments that couldn't * be flattened into typed flags. */ tier3Fallback: string | null; } /** * Encode a classifier plan map as mcpc argv tokens (documentation form). * * Encoding rules per tier: * * - Tier 1 + `type === 'scalar'` + scalarType `string` → `=`. * - Tier 1 + `type === 'scalar'` + scalarType `number`/`integer` → `:=`. * - Tier 1 + `type === 'scalar'` + scalarType `boolean` → `:=`. * - Tier 1 + `type === 'enum'` → `=`. * - Tier 1 + `type === 'string-array'` → `:=`. * - Tier 2 → same as the leaf's Tier 1 form, with `` joined by `.`. * - Tier 3 → contributes nothing to `tier12`; sets `tier3Fallback`. * * Path is always joined with `.` (mcpc convention). * * @param plan - classifier output (`Map`) * @returns split encoding result — Tier 1/2 tokens + optional Tier 3 fallback string */ export declare function encodeMcpcArgs(plan: Map): EncodedArgs; //# sourceMappingURL=args.d.ts.map