GovTribe

Rerank Search Results MCP response

MCP tool response returned by the Rerank Search Results MCP tool.

Response Shape

The response returns a ranked subset of rehydrated GovTribe records plus any candidates that could not be ranked.

FieldTypeNotes
querystring or nullSource search query when the source is search_results_id; otherwise null.
ranking_goalstringThe relevance goal used for reranking.
rerank_appliedbooleantrue only when the Laravel AI SDK reranker returned a usable ranking.
rerank_statusstringRerank outcome. Values include applied, disabled, skipped_query_too_short, skipped_too_few_candidates, failed_open, and empty_reranker_response.
rerank_strategystring or nulllaravel_ai_sdk_reranking when reranking was applied; otherwise null.
sourceobjectSource metadata. type is search_results_id or candidates.
candidate_countintegerNumber of resolved candidates considered for ranking.
resultsobject arrayRanked GovTribe candidates.
not_rankedobject arrayCandidates skipped during source resolution.

Each results item includes rank, govtribe_type, govtribe_id, title, source_rank, source_score, source_tool, and resolver. When the SDK exposes a score for the ranked document, the item also includes rerank_score.

resolver is either a typed-search follow-up object or null. When present, it includes tool, filter, arguments, suggested_fields, and documentation_articles.

Each not_ranked item includes govtribe_type, govtribe_id, reason_code, reason, source_rank, and source_tool. Safe reason codes include:

Reason codeMeaning
not_foundNo GovTribe record matched the supplied type and ID.
unauthorizedThe current user is not allowed to view the record.
unsupported_typeThe supplied GovTribe type cannot be resolved.
unsupported_resourceThe record does not expose an LLM resource for reranking.

Follow-up Behavior

When rerank_status is failed_open, the reranker failed at runtime and the response falls back to source order. Do not treat failed_open as evidence that reranking happened.

Use results[].resolver to retrieve fuller typed records after the shortlist is ordered. If resolver is null, use the returned govtribe_type and govtribe_id as stable identifiers for other GovTribe workflows that support that record type.

Example

{
  "query": "cloud modernization",
  "ranking_goal": "prioritize active zero trust cloud opportunities",
  "rerank_applied": true,
  "rerank_status": "applied",
  "rerank_strategy": "laravel_ai_sdk_reranking",
  "source": {
    "type": "search_results_id",
    "search_results_id": "SEARCH_RESULTS_ID",
    "candidate_limit": 50,
    "scope": "FederalContractOpportunityModel",
    "is_only_semantic": false
  },
  "candidate_count": 12,
  "results": [
    {
      "rank": 1,
      "govtribe_type": "federal_contract_opportunity",
      "govtribe_id": "OPPORTUNITY_ID",
      "title": "Cloud modernization support",
      "source_rank": 4,
      "source_score": null,
      "source_tool": null,
      "rerank_score": 0.94,
      "resolver": {
        "tool": "Search_Federal_Contract_Opportunities",
        "filter": "govtribe_ids",
        "arguments": {
          "govtribe_ids": ["OPPORTUNITY_ID"],
          "fields_to_return": ["govtribe_id", "title", "govtribe_url"]
        },
        "suggested_fields": ["govtribe_id", "title", "govtribe_url"],
        "documentation_articles": []
      }
    }
  ],
  "not_ranked": [
    {
      "govtribe_type": "vendor",
      "govtribe_id": "MISSING_VENDOR_ID",
      "reason_code": "not_found",
      "reason": "No GovTribe record was found for this candidate.",
      "source_rank": 8,
      "source_tool": "Search_GovTribe"
    }
  ]
}