{
  "id": "corpus-bm25-search",
  "name": "Search a supplied text corpus",
  "description": "Rank supplied documents with fixed-parameter lexical BM25 and exact original UTF-16 token spans. Scores are binary64 logarithm approximations ordered at 12 decimal places, with exact ID ties. No embeddings, persistent index, web search or semantic relevance guarantee.",
  "category": "text",
  "priceUsd": "0.005",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.005",
    "sixDecimalTokenBaseUnits": "5000",
    "subscription": false,
    "includesPayerWalletOrNetworkFees": false,
    "liveQuoteVerified": false,
    "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
  },
  "intents": [
    "Rank my supplied documents by lexical BM25",
    "Retrieve matching passages from caller-supplied text with exact token offsets"
  ],
  "whenToUse": [
    "Rank my supplied documents by lexical BM25",
    "Retrieve matching passages from caller-supplied text with exact token offsets"
  ],
  "whenNotToUse": [
    "Web search, semantic/vector search, linguistic segmentation, relevance certification or verifying whether a passage supports a claim",
    "Network calls, external actions, supplied-evidence authenticity or factual correctness certification"
  ],
  "capabilities": [
    "128 supplied documents and 16 queries; k1=1.2, b=0.75; distinct sorted query terms",
    "Unicode Letter/Number followed by Letter/Mark/Number runs, locale-independent lowercase, no normalization",
    "12-decimal approximate scores, exact ID tie-breaks, omitted-candidate and omitted-span evidence",
    "Networkless bounded computation; advisoryOnly=true; externalRequests=0"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 400000,
    "jsonNodes": 12000,
    "depth": 20,
    "documents": 128,
    "queries": 16,
    "corpusBytes": 60000,
    "documentBytes": 20000,
    "corpusTokens": 12000,
    "corpusTerms": 4096,
    "queryTerms": 64,
    "queryCodePoints": 512,
    "tokenCodePoints": 128,
    "topK": 20,
    "hitSpans": 20,
    "contributionChecks": 131072
  },
  "errorCodes": [
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "DUPLICATE_ID",
    "TEXT_LIMIT",
    "TOKEN_LIMIT",
    "TERM_LIMIT",
    "TOKEN_LENGTH_LIMIT"
  ],
  "related": [
    "text-chunk",
    "ranking-evaluate",
    "context-budget-pack"
  ],
  "requirementsProfile": {
    "format": "declared-requirements-v1",
    "facts": {
      "execution.suppliedCode": false,
      "execution.remoteMutation": false,
      "execution.llmInference": false,
      "execution.paidMcp": false,
      "verification.semanticTruth": false,
      "verification.sourceAuthenticity": false,
      "verification.liveVulnerabilities": false,
      "numbers.arbitraryPrecisionJson": false,
      "numbers.model": "ieee754-binary64",
      "privacy.requestBodyPersisted": false,
      "execution.deterministic": true,
      "execution.networkAccess": false,
      "privacy.resultBodyPersisted": false,
      "payment.x402": true,
      "payment.mpp": true,
      "operation.id": "corpus-bm25-search",
      "operation.category": "text",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 400000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 12000,
      "corpusSearch.profile": "supplied-unicode-word-bm25-v1",
      "corpusSearch.maxDocuments": 128,
      "corpusSearch.maxQueries": 16,
      "corpusSearch.maxCorpusBytes": 60000,
      "corpusSearch.maxDocumentBytes": 20000,
      "corpusSearch.maxTokens": 12000,
      "corpusSearch.maxCorpusTerms": 4096,
      "corpusSearch.maxQueryTerms": 64,
      "corpusSearch.maxQueryCodePoints": 512,
      "corpusSearch.maxTokenCodePoints": 128,
      "corpusSearch.maxHitSpans": 20,
      "corpusSearch.maxTopK": 20,
      "corpusSearch.offsets": "utf16-half-open",
      "corpusSearch.scoreArithmetic": "binary64-rounded-to-12-decimal-places",
      "corpusSearch.semanticRelevanceVerified": false,
      "corpusSearch.embeddings": false,
      "corpusSearch.networkRetrieval": false,
      "corpusSearch.persistentIndex": false,
      "corpusSearch.fullLinguisticSegmentation": false,
      "input.documents.maxItems": 128,
      "input.documents.minItems": 1,
      "input.queries.maxItems": 16,
      "input.queries.minItems": 1
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/corpus-bm25-search.md",
  "serviceContract": "/reference/services/corpus-bm25-search.json",
  "errors": [
    {
      "status": 400,
      "meaning": "Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch",
      "retry": "Correct the request before payment"
    },
    {
      "status": 402,
      "meaning": "Payment challenge or rejected payment",
      "retry": "Use official protocol SDK; inspect payment outcome before another payment"
    },
    {
      "status": 409,
      "meaning": "Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN",
      "retry": "Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay"
    },
    {
      "status": 413,
      "meaning": "Input or generated output too large",
      "retry": "Reduce input; no payment attempted for validation failure"
    },
    {
      "status": 415,
      "meaning": "Unsupported media type or compression",
      "retry": "Send uncompressed application/json"
    },
    {
      "status": 422,
      "meaning": "Schema or service-specific semantic validation failure",
      "retry": "Correct input using returned error code; no payment attempted"
    },
    {
      "status": 429,
      "meaning": "Request/payment-attempt rate exceeded",
      "retry": "Wait for rate limit window; preserve existing payment identity"
    },
    {
      "status": 503,
      "meaning": "Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement",
      "retry": "Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation"
    }
  ],
  "numericPrecision": "JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.",
  "paymentWorkflow": {
    "discoveryOnly": false,
    "supportedProtocols": [
      "x402",
      "mpp"
    ],
    "x402": {
      "credentialHeader": "PAYMENT-SIGNATURE",
      "challengeHeader": "PAYMENT-REQUIRED",
      "receiptHeader": "PAYMENT-RESPONSE",
      "version": 2,
      "scheme": "exact",
      "paymentIdentifier": "payment-identifier extension MUST equal the HTTP Idempotency-Key",
      "sdk": "@x402/core with @x402/evm"
    },
    "mpp": {
      "supported": true,
      "credentialHeader": "Authorization",
      "challengeHeader": "WWW-Authenticate",
      "receiptHeader": "Payment-Receipt",
      "method": "tempo",
      "intent": "charge",
      "sdk": "mppx",
      "tokenDecimals": 6
    },
    "steps": [
      "Check configured readiness and the exact service schema",
      "Generate a fresh random Idempotency-Key for this operation; never use a discovery probe fixture for purchases",
      "Send valid input without a credential to obtain the official protocol challenge",
      "Use the official SDK and authorized wallet to fulfill the challenge",
      "Retry only with identical key, body, protocol and credential",
      "On PAYMENT_UNCERTAIN stop and request operator reconciliation; never blindly pay again"
    ],
    "versionedRetries": "Request fingerprint includes service release version. Retries across a version upgrade can conflict; coordinate upgrades outside the 24-hour replay window and reconcile pending attempts.",
    "docs": "/llms.txt"
  },
  "method": "POST",
  "paths": {
    "x402": "/v1/x402/corpus-bm25-search",
    "mpp": "/v1/mpp/corpus-bm25-search"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "documents": {
        "minItems": 1,
        "maxItems": 128,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "text": {
              "type": "string",
              "maxLength": 20000
            }
          },
          "required": [
            "id",
            "text"
          ],
          "additionalProperties": false
        }
      },
      "queries": {
        "minItems": 1,
        "maxItems": 16,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "text": {
              "type": "string",
              "maxLength": 1024
            },
            "topK": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          },
          "required": [
            "id",
            "text",
            "topK"
          ],
          "additionalProperties": false
        }
      }
    },
    "required": [
      "documents",
      "queries"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "corpus-bm25-search",
        "type": "string"
      },
      "version": {
        "const": "0.29.0",
        "type": "string"
      },
      "result": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "advisoryOnly": {
            "type": "boolean",
            "const": true
          },
          "externalRequests": {
            "type": "number",
            "const": 0
          },
          "profile": {
            "type": "string",
            "const": "supplied-unicode-word-bm25-v1"
          },
          "documentCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "tokenCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "queries": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ranked",
                    "empty-query"
                  ]
                },
                "terms": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 512
                  }
                },
                "candidateCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "omittedCandidates": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "hits": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "sourceIndex": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "score": {
                        "type": "string",
                        "pattern": "^\\d+\\.\\d{12}$"
                      },
                      "matchedTerms": {
                        "maxItems": 64,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 512
                        }
                      },
                      "spans": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "term": {
                              "type": "string",
                              "maxLength": 512
                            },
                            "start": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "end": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "term",
                            "start",
                            "end"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "omittedSpans": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "id",
                      "sourceIndex",
                      "score",
                      "matchedTerms",
                      "spans",
                      "omittedSpans"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "id",
                "status",
                "terms",
                "candidateCount",
                "omittedCandidates",
                "hits"
              ],
              "additionalProperties": false
            }
          },
          "semanticRelevanceVerified": {
            "type": "boolean",
            "const": false
          },
          "scoreArithmetic": {
            "type": "string",
            "const": "binary64-logarithm-approximation"
          },
          "scoreOrdering": {
            "type": "string",
            "const": "fixed-12-decimal-score-descending-then-UTF16-id"
          },
          "offsetUnits": {
            "type": "string",
            "const": "UTF-16 code units; zero-based, end-exclusive"
          }
        },
        "required": [
          "advisoryOnly",
          "externalRequests",
          "profile",
          "documentCount",
          "tokenCount",
          "queries",
          "semanticRelevanceVerified",
          "scoreArithmetic",
          "scoreOrdering",
          "offsetUnits"
        ],
        "additionalProperties": false
      },
      "provenance": {
        "type": "object",
        "required": [
          "inputSha256",
          "outputSha256",
          "deterministic",
          "externalRequests"
        ],
        "properties": {
          "inputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "outputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "deterministic": {
            "const": true
          },
          "externalRequests": {
            "const": 0
          }
        }
      }
    },
    "additionalProperties": false
  },
  "exampleInput": {
    "documents": [
      {
        "id": "d1",
        "text": "red fox"
      },
      {
        "id": "d2",
        "text": "blue dog"
      }
    ],
    "queries": [
      {
        "id": "q1",
        "text": "red",
        "topK": 2
      }
    ]
  },
  "exampleResponse": {
    "operation": "corpus-bm25-search",
    "version": "0.29.0",
    "result": {
      "advisoryOnly": true,
      "externalRequests": 0,
      "profile": "supplied-unicode-word-bm25-v1",
      "documentCount": 2,
      "tokenCount": 4,
      "queries": [
        {
          "id": "q1",
          "status": "ranked",
          "terms": [
            "red"
          ],
          "candidateCount": 1,
          "omittedCandidates": 0,
          "hits": [
            {
              "id": "d1",
              "sourceIndex": 0,
              "score": "0.693147180560",
              "matchedTerms": [
                "red"
              ],
              "spans": [
                {
                  "term": "red",
                  "start": 0,
                  "end": 3
                }
              ],
              "omittedSpans": 0
            }
          ]
        }
      ],
      "semanticRelevanceVerified": false,
      "scoreArithmetic": "binary64-logarithm-approximation",
      "scoreOrdering": "fixed-12-decimal-score-descending-then-UTF16-id",
      "offsetUnits": "UTF-16 code units; zero-based, end-exclusive"
    },
    "provenance": {
      "inputSha256": "b0875c7142d0bbaaced040f155f697415bc61a604d6f69e4dda2ab57deae1de9",
      "outputSha256": "39eac80fbdd9d2318a7ab087a0a3fe92145f6ddb0ebfa26619059e4e5ffaa7d2",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/corpus-bm25-search.json",
  "execution": {
    "deterministic": true,
    "externalRequests": 0,
    "maxExternalRequests": 0,
    "resultSnapshotPersisted": false,
    "fixedExampleIsIllustrativeSnapshot": false,
    "requiresPayment": true,
    "supportsMcpExecution": false
  },
  "releaseSnapshot": {
    "format": "static-release-reference-v1",
    "sourceVersion": "0.29.0",
    "sourceRegistrySha256": "a2b5ec09bf6c38b9d2879d746a4fded374f5928b445377b0270ef6aa8e6cac65",
    "generatedAt": "2026-10-06T15:38:00Z",
    "releaseAcceptance": "not-verified-by-generator",
    "runtimeReadiness": "not-evaluated",
    "livePaymentsVerified": false,
    "indexingVerified": false,
    "apiOrigin": null,
    "notice": "Build-time release reference. Runtime readiness, deployment, payment settlement and external indexing are not evaluated here. Prices are proposed; this file cannot authorize execution or payment."
  }
}
