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

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.
keywordNoSearch 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

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?

Annotations already declare readOnly/idempotent/openWorld, and the description adds substantial context beyond them: results come from a daily-refreshed local snapshot, a `mirror` field reports snapshot freshness, ranking weights the title far above description text to suppress boilerplate matches, and a key is only needed to reach postings newer than the snapshot. These are exactly the operational traits an agent cannot infer from structured fields.

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?

Front-loaded with the core verb and filter list, then the operational caveats. It is on the long side (three sentences plus an alias note), but nearly every clause carries actionable information; the trailing alias sentence is somewhat redundant with the schema aliases.

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, zero-required search tool with an output schema, the description covers the non-obvious essentials: default date window, keyless snapshot semantics, staleness via `mirror`, and ranking behavior. Nothing an agent needs to invoke it correctly is missing; return shape is already covered by the output schema.

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 description coverage is 100%, so the baseline is 3; the description still adds value by stating the query/q/keywords alias set, the SAM.gov-imposed date-range default, and the title-weighting behavior that should shape how keyword values are chosen. It adds meaning beyond the schema rather than repeating it.

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?

States a specific verb and resource (search federal contract opportunities) and enumerates the discriminating filters (keyword, NAICS, set-aside, date range, procurement type). It is clearly distinct from sam_get_opportunity (single lookup), sam_search_exclusions (exclusions list) and sam_set_aside_opportunities, which an agent can infer from the listed filters.

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?

Explains the key constraint that governs usage: SAM.gov requires a posting date range, and omitting posted_from/posted_to defaults to the last 30 days, plus that no API key is needed. It does not explicitly route to siblings such as sam_set_aside_opportunities when the agent only wants set-asides, so it stops short of full when-not 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.