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.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "limit": 20,
      "naics": "541512",
      "keyword": "software development",
      "posted_to": "12/31/2024",
      "posted_from": "01/01/2024"
    },
    "name": "sam_search_opportunities"
  }
}

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). Not sure of the code? naics_search turns industry words into NAICS codes; naics_lookup explains one.
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. Changed1 schema field changed
    • changedInput schema / properties / naics / description
      Previous value: -"NAICS code to filter by (e.g., \"541512\" for computer systems design)"New value: +"NAICS code to filter by (e.g., \"541512\" for computer systems design). Not sure of the code? naics_search turns industry words into NAICS codes; naics_lookup explains one."
  2. Changed1 schema field changed
    • changedInput schema / properties / _apiKey / description
      Previous 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."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."
  3. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[
      -  "keyword"
      -]New value: +[]
  4. 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"
      +]
  5. 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"
      +  }
      +]
  6. 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"
      +}
  7. 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"
      +}
  8. 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"
      +  }
      +]
  9. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive/openWorld, and the description adds substantial context beyond them: daily snapshot refresh, keyless operation with a note on when an API key is needed, relevance ranking with title weighted above description text, and the `mirror` freshness field. The ranking caveat is exactly the kind of non-obvious behavior an agent needs to interpret results.

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 purpose and filters before moving to behavioral notes; every sentence conveys something. The title-weighting sentence is long and slightly run-on, and the alias note is repeated between description and schema, but there is no filler.

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 a full schema and an output schema, the description covers the gaps that matter: keyless vs keyed access, snapshot freshness, default date window, and result ranking. Nothing an agent needs to invoke it correctly is absent.

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

Parameters3/5

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

Schema coverage is 100%, so the schema already documents aliases, defaults, NAICS and set-aside enumerations. The description restates the alias set and the 30-day default but adds the rationale (SAM.gov itself requires a date range), which is mildly useful. Baseline 3 is appropriate since the schema carries the parameter burden.

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 active federal contract opportunities") and enumerates the filterable dimensions — keyword, NAICS, set-aside, posting date range, procurement type. This is distinguishable from siblings like sam_search_exclusions (debarment) and sam_get_opportunity (single-record fetch) without opening a schema.

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?

Gives clear operating context: it searches the public Contract Opportunities extract, works keylessly, and explains the default-to-last-30-days behavior if posted_from/posted_to are omitted. It also routes to naics_search/naics_lookup when the caller doesn't know a code. What's missing is an explicit statement of when to prefer a sibling such as sam_set_aside_opportunities or sam_get_opportunity for a single notice.

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.