{"uid":"cap_2_D9T55jFylX_BQ4zzLmI","slug":"writerslogic-enum-canonicalization-f79d452e","name":"WritersLogic Enum Canonicalization","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/enum-canonicalize?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"values":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":200,"minItems":1,"description":"Strings to canonicalize."},"aliases":{"type":"array","items":{"type":"object","required":["alias","canonical"],"properties":{"alias":{"type":"string","maxLength":100},"canonical":{"type":"string","maxLength":100}},"additionalProperties":false},"maxItems":500,"description":"Caller synonyms; each canonical must be in allowed."},"allowed":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":500,"minItems":1,"description":"The closed set of canonical values."},"maxDistance":{"type":"integer","maximum":5,"minimum":0,"description":"Largest edit distance accepted (default 2). The effective limit is also capped at one third of the normalized input length."},"caseSensitive":{"type":"boolean","description":"Skip case, accent and punctuation folding (only NFKC and whitespace collapse). Default false."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_8z_EyjRLHX4WnIuOE-VFg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Maps arbitrary input strings to their canonical form within a caller-defined closed set using exact match, aliases, normalization, and bounded edit distance — abstaining rather than guessing on ambiguous or out-of-range inputs.","exampleAgentPrompt":"Canonicalize these status strings — ['Activ', 'CLOSED', 'pendin', 'Suspended'] — against the allowed set ['Active','Closed','Pending','Suspended'] using a max edit distance of 2, so I can safely write them to a typed status column.","exampleUseCases":[{"title":"Cleaning country name fields before DB insert","prompt":"I have a list of country names entered by users — things like 'Unted States', 'uk', 'Deutschland', 'FR' — and I need to map them to official ISO country names like 'United States', 'United Kingdom', 'Germany', 'France'. Can you canonicalize them against that allowed set with a max edit distance of 2 and use my aliases for 'uk'→'United Kingdom'?"},{"title":"Normalizing product category taxonomy","prompt":"Before I write product category tags to our database, I need to snap these incoming strings — ['electrnics', 'Home & Garden', 'CLOTHING', 'Toys & Games'] — to our official taxonomy values ['Electronics','Home and Garden','Clothing','Toys and Games']. Please canonicalize them with max distance 2 and tell me which ones couldn't be matched."},{"title":"Standardizing unit labels in sensor data","prompt":"My sensor data has unit strings like 'Kg', 'kilograms', 'KG', 'celsius', 'C', 'degC' and I need to map them to canonical units ['kg','Celsius','Fahrenheit','m/s'] before storing. Use my aliases list where degC maps to Celsius, and set max edit distance to 1 so it doesn't over-match."}],"resultDescription":"For each input string, returns the matched canonical value (or null if no match within threshold or if there's a tie), the method used to match (exact, alias, normalized, edit-distance), the edit distance computed, and the nearest candidate values considered. The response is deterministic and never infers meaning beyond what is supplied.","failureModes":["Abstains (returns null) when no allowed value is within the specified maxDistance threshold","Abstains (returns null) when two allowed values tie at the same minimum edit distance","Returns error if 'allowed' set is empty or missing","Returns error if any alias canonical value is not present in the allowed set","Returns error if input values array is empty or exceeds 200 items","Returns error if aliases array exceeds 500 entries","May fail to match highly abbreviated or acronym inputs if no alias is supplied, since it does not use synonyms or semantic inference"],"whenToPreferThis":"Choose this endpoint when you need deterministic, verifiable string-to-enum canonicalization with no guessing or semantic inference — ideal for ETL pipelines, database column cleaning, and agent workflows that must write to typed columns. Prefer it over LLM-based normalization when auditability, consistency, and abstention on ambiguity are required. It is not suitable when you need translation, synonym expansion beyond your alias list, or fuzzy semantic matching.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:38:04.599Z","isFirstParty":false,"canonicalSlug":"writerslogic-enum-canonicalization-f79d452e"}