{"uid":"cap_-Z--gjrR3IsQ24_zHErxN","slug":"writerslogic-join-cardinality-analyzer-186b0c01","name":"WritersLogic Join Cardinality Analyzer","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/join-cardinality?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"left":{"type":"object","properties":{"keys":{"type":"array","items":{"description":"One row's join key: a string, number or boolean, null for SQL NULL, or an array of those for a composite key."},"maxItems":20000,"description":"Join key of every row, in table order."},"counts":{"type":"array","items":{"type":"object","required":["key","count"],"properties":{"key":{"description":"A join key (scalar, null, or array for composite)."},"count":{"type":"integer","maximum":1000000,"minimum":1}},"additionalProperties":false},"maxItems":5000,"description":"Key summary: how many rows carry each distinct key."},"nullRows":{"type":"integer","maximum":1000000,"minimum":0,"description":"With counts: rows whose key is NULL."}},"additionalProperties":false},"right":{"type":"object","properties":{"keys":{"type":"array","items":{"description":"One row's join key: a string, number or boolean, null for SQL NULL, or an array of those for a composite key."},"maxItems":20000,"description":"Join key of every row, in table order."},"counts":{"type":"array","items":{"type":"object","required":["key","count"],"properties":{"key":{"description":"A join key (scalar, null, or array for composite)."},"count":{"type":"integer","maximum":1000000,"minimum":1}},"additionalProperties":false},"maxItems":5000,"description":"Key summary: how many rows carry each distinct key."},"nullRows":{"type":"integer","maximum":1000000,"minimum":0,"description":"With counts: rows whose key is NULL."}},"additionalProperties":false},"expect":{"type":"object","properties":{"leftUnique":{"type":"boolean","description":"Left keys (non-NULL) must be distinct."},"rightUnique":{"type":"boolean","description":"Right keys (non-NULL) must be distinct."},"maxOutputRows":{"type":"integer","maximum":9000000000000000,"minimum":0},"everyLeftMatched":{"type":"boolean"},"everyRightMatched":{"type":"boolean"},"noRowMultiplication":{"type":"boolean","description":"The output must not have more rows than the preserved side."}},"additionalProperties":false},"joinType":{"enum":["inner","left","right","full"],"type":"string"},"normalize":{"type":"object","properties":{"trim":{"type":"boolean"},"caseFold":{"type":"boolean"}},"description":"Normalization your pipeline applies to string keys before joining.","additionalProperties":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_4TFLj7cdiEDCqDfRdXXxU","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":"Computes exact join output row counts, cardinality type, unmatched keys, and type-coercion hazards for two tables given their join keys.","exampleAgentPrompt":"Before I merge my orders table with my customers table on customer_id, can you check the join cardinality? Here are the left keys: [101, 102, 103, 102] and right keys: [101, 102, 104] — I expect left unique and every left row matched, using an inner join.","exampleUseCases":[{"title":"Pre-merge row explosion check","prompt":"I'm about to join a transactions table to a products table on product_id — here are all the product_id values from both sides. Tell me how many output rows I'd get from an inner join, whether any keys multiply rows, and flag any type mismatches like '7' vs 7."},{"title":"Referential integrity audit before enrichment","prompt":"Can you check if every row in my left table has a matching key in the right table? I'll give you the distinct keys and counts for both sides. I need to know which left keys have no match and which right keys are unused — using left join semantics."},{"title":"Deduplication uniqueness validation","prompt":"I'm assuming my user_id column is unique on both sides before I do a one-to-one join. Here are the keys from each table — please confirm both sides are truly unique, tell me the cardinality, and show me the first duplicate if either side isn't."}],"resultDescription":"Returns the exact output row count for the requested join type (inner, left, right, full), the observed cardinality label (one-to-one, one-to-many, many-to-one, many-to-many), the keys contributing the most row multiplication, lists of unmatched keys on each side, any violated expectations (uniqueness, full match coverage, row count ceiling), and a list of key pairs that match only under loose coercion (type, case, whitespace) but would silently fail in a strictly typed SQL engine.","failureModes":["Exceeds key array limit (20,000 rows or 5,000 distinct counts) — request rejected","Both keys and counts supplied simultaneously for same side — ambiguous input error","Composite key arrays contain mismatched component counts across rows — schema error","maxOutputRows expectation violated — returns violation detail rather than silent pass","Null keys in keys array handled as SQL NULLs (never match) — may surprise caller expecting null equality","Cannot detect incomplete composite keys — caller must ensure all key components are included"],"whenToPreferThis":"Use this endpoint when an AI agent needs to predict or validate the output of an equi-join before executing it, especially when row explosion, referential integrity, or type coercion bugs are a concern. It is preferable over running the actual join when the data volume is large, the join is expensive, or the agent needs to surface issues (unmatched keys, duplicate keys, coercion hazards) to a human before proceeding. It is not a substitute for a SQL engine and cannot read actual table data — only key distributions supplied by the caller.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:36:23.606Z","isFirstParty":false,"canonicalSlug":"writerslogic-join-cardinality-analyzer-186b0c01"}