Skip to main content
Glama

Sam Search Opportunities

sam_search_opportunities
Read-onlyIdempotent

Search active federal contract opportunities by keyword, NAICS code (e.g., "541512"), set-aside type, posting date range, and procurement type. Searches SAM.gov's public Contract Opportunities extract, refreshed daily, without spending an API key — ranking matches by relevance with the opportunity TITLE weighted well above its description, so a genuine title hit outranks a notice whose boilerplate contract-clause text happens to mention the term. Returns titles, solicitation numbers, deadlines, and agencies, plus a mirror field reporting how fresh that snapshot is. SAM.gov requires a posting date range — if you omit posted_from/posted_to, we default to the last 30 days. Accepts query / q / keywords as aliases for keyword.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNoAlias for keyword.
limitNoNumber of results to return (1-100, default 10)
naicsNoNAICS code to filter by (e.g., "541512" for computer systems design)
ptypeNoProcurement type filter: p (presolicitation), o (solicitation), k (combined synopsis/solicitation), a (award notice)
queryNoAlias for keyword.
offsetNoResult offset for pagination (default 0)
_apiKeyNoOptional — omit it. This search answers keyless from the local snapshot of SAM.gov's public Contract Opportunities extract; a key is needed only to reach postings newer than that snapshot.
keywordYesSearch term for opportunity title or description. query, q, keywords accepted as aliases.
keywordsNoAlias for keyword.
posted_toNoEnd of posting date range in MM/dd/yyyy format. Defaults to today if omitted.
set_asideNoSmall business set-aside type: SBA (Small Business), SDVOSB (Service-Disabled Veteran), HUBZone, 8AN (8(a)), WOSB (Women-Owned), EDWOSB (Economically Disadvantaged Women-Owned)
posted_fromNoStart of posting date range in MM/dd/yyyy format. Defaults to 30 days ago if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitYesNumber of results returned in this request
offsetYesOffset used for pagination
opportunitiesYes
total_recordsYesTotal number of matching opportunities in SAM.gov

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "_apiKey": "your-samgov-api-key",
      -    "keyword": "software development",
      -    "limit": 20,
      -    "naics": "541512",
      -    "posted_from": "01/01/2024",
      -    "posted_to": "12/31/2024"
      -  },
      -  {
      -    "_apiKey": "your-samgov-api-key",
      -    "keyword": "cybersecurity",
      -    "ptype": "o",
      -    "set_aside": "SBA"
      -  }
      -]New value: +[
      +  {
      +    "keyword": "software development",
      +    "limit": 20,
      +    "naics": "541512",
      +    "posted_from": "01/01/2024",
      +    "posted_to": "12/31/2024"
      +  },
      +  {
      +    "keyword": "cybersecurity",
      +    "ptype": "o",
      +    "set_aside": "SBA"
      +  }
      +]
    • changedInput schema / properties / _apiKey / description
      Previous value: -"SAM.gov API key"New value: +"Optional — omit it. This search answers keyless from the local snapshot of SAM.gov's public Contract Opportunities extract; a key is needed only to reach postings newer than that snapshot."
    • changedInput schema / required
      Previous value: -[
      -  "keyword",
      -  "_apiKey"
      -]New value: +[
      +  "keyword"
      +]
  2. Changed1 schema field changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "_apiKey": "your-samgov-api-key",
      -    "keyword": "software development",
      -    "limit": 20,
      -    "naics": "541512",
      -    "posted_from": "01/01/2024",
      -    "posted_to": "12/31/2024"
      -  },
      -  {
      -    "_apiKey": "your-samgov-api-key",
      -    "keyword": "IT services",
      -    "ptype": "o",
      -    "set_aside": "WOSB"
      -  }
      -]New value: +[
      +  {
      +    "_apiKey": "your-samgov-api-key",
      +    "keyword": "software development",
      +    "limit": 20,
      +    "naics": "541512",
      +    "posted_from": "01/01/2024",
      +    "posted_to": "12/31/2024"
      +  },
      +  {
      +    "_apiKey": "your-samgov-api-key",
      +    "keyword": "cybersecurity",
      +    "ptype": "o",
      +    "set_aside": "SBA"
      +  }
      +]
  3. Changed6 schema fields changed
    • changedInput schema / properties / keyword / description
      Previous value: -"Search term for opportunity title or description"New value: +"Search term for opportunity title or description. query, q, keywords accepted as aliases."
    • addedInput schema / properties / keywords
      Added value: +{
      +  "description": "Alias for keyword.",
      +  "type": "string"
      +}
    • changedInput schema / properties / posted_from / description
      Previous value: -"Start of posting date range in MM/dd/yyyy format"New value: +"Start of posting date range in MM/dd/yyyy format. Defaults to 30 days ago if omitted."
    • changedInput schema / properties / posted_to / description
      Previous value: -"End of posting date range in MM/dd/yyyy format"New value: +"End of posting date range in MM/dd/yyyy format. Defaults to today if omitted."
    • addedInput schema / properties / q
      Added value: +{
      +  "description": "Alias for keyword.",
      +  "type": "string"
      +}
    • addedInput schema / properties / query
      Added value: +{
      +  "description": "Alias for keyword.",
      +  "type": "string"
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "limit": {
      +      "description": "Number of results returned in this request",
      +      "type": "number"
      +    },
      +    "offset": {
      +      "description": "Offset used for pagination",
      +      "type": "number"
      +    },
      +    "opportunities": {
      +      "items": {
      +        "properties": {
      +          "active": {
      +            "description": "Active status indicator",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "classification_code": {
      +            "description": "Classification code",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "department": {
      +            "description": "Procuring department/agency",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "naics_code": {
      +            "description": "Primary NAICS code",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "office": {
      +            "description": "Procuring office name",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "posted_date": {
      +            "description": "Date opportunity was posted",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "response_deadline": {
      +            "description": "Proposal response deadline",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "set_aside": {
      +            "description": "Small business set-aside type if applicable",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "solicitation_number": {
      +            "description": "Unique solicitation identifier",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "sub_tier": {
      +            "description": "Sub-tier agency code",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "title": {
      +            "description": "Opportunity title",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "type": {
      +            "description": "Procurement type (presolicitation, solicitation, etc.)",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "ui_link": {
      +            "description": "URL to opportunity details on SAM.gov",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "total_records": {
      +      "description": "Total number of matching opportunities in SAM.gov",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "total_records",
      +    "limit",
      +    "offset",
      +    "opportunities"
      +  ],
      +  "type": "object"
      +}
  5. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "_apiKey": "your-samgov-api-key",
      +    "keyword": "software development",
      +    "limit": 20,
      +    "naics": "541512",
      +    "posted_from": "01/01/2024",
      +    "posted_to": "12/31/2024"
      +  },
      +  {
      +    "_apiKey": "your-samgov-api-key",
      +    "keyword": "IT services",
      +    "ptype": "o",
      +    "set_aside": "WOSB"
      +  }
      +]
  6. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds significant behavioral context beyond the readOnly/idempotent/openWorld annotations: it discloses the title-weighted relevance ranking, the mirror freshness field, the 30-day default date range, and the snapshot-versus-API-key behavior. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but purposeful: it front-loads the core search function, then explains ranking behavior, return fields, defaults, and aliases in a compact paragraph. Every sentence contributes useful information, though the single long paragraph could be slightly more scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with a required keyword, the description covers return values, defaults, aliases, freshness, ranking, and the keyless workflow. The output schema exists, so return-value details are already structured. Nothing critical is missing for an agent to call this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds value by explaining aliases (q/query/keywords), the 30-day default when posted_from/posted_to are omitted, and the meaning of the _apiKey parameter in relation to snapshot freshness. This goes beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Search active federal contract opportunities by keyword, NAICS code, set-aside type, posting date range, and procurement type.' It clearly distinguishes this from sibling SAM tools like entity search, exclusions, and opportunity retrieval by emphasizing active contract opportunities searched without an API key.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use this keyless snapshot search of SAM.gov and notes that an API key is only needed for postings newer than the snapshot (via the _apiKey parameter). It doesn't explicitly name alternative tools or state 'use X instead' for specific cases, but the context around the keyless snapshot and daily refresh provides practical guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.