Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_search_grants_gov

Search for U.S. government grant opportunities using keywords, agencies, or eligibility criteria to find funding with deadlines and requirements.

Instructions

Search grants.gov by keyword, agency, or other criteria. Returns opportunity listings with deadlines and eligibility.

Returns: dict: Grant opportunities list with titles, agencies, deadlines, funding amounts, eligibility criteria or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordNoSearch keyword
opp_numNoOpportunity number
eligibilitiesNoEligibilities (comma-separated)
agenciesNoAgency codes (comma-separated)
rowsNoResults to return
opp_statusesNo'forecasted|posted' (pipe-separated, default: 'forecasted|posted')forecasted|posted
alnNoAssistance Listing Number
funding_categoriesNoCategories (comma-separated)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'search_grants_gov' tool (note: tool name is 'search_grants_gov', not 'bc_search_grants_gov'). Decorated with @core_mcp.tool() for MCP registration. Includes input schema via Pydantic Annotated Fields and full implementation of the grants.gov API search logic.
    @core_mcp.tool()
    def search_grants_gov(
        keyword: Annotated[Optional[str], Field(description="Search keyword")] = None,
        opp_num: Annotated[Optional[str], Field(description="Opportunity number")] = None,
        eligibilities: Annotated[Optional[str], Field(description="Eligibilities (comma-separated)")] = None,
        agencies: Annotated[Optional[str], Field(description="Agency codes (comma-separated)")] = None,
        rows: Annotated[int, Field(description="Results to return")] = 10,
        opp_statuses: Annotated[
            Optional[str], Field(description="'forecasted|posted' (pipe-separated, default: 'forecasted|posted')")
        ] = "forecasted|posted",
        aln: Annotated[Optional[str], Field(description="Assistance Listing Number")] = None,
        funding_categories: Annotated[Optional[str], Field(description="Categories (comma-separated)")] = None,
    ) -> dict:
        """Search grants.gov by keyword, agency, or other criteria. Returns opportunity listings with deadlines and eligibility.
    
        Returns:
            dict: Grant opportunities list with titles, agencies, deadlines, funding amounts, eligibility criteria or error message.
        """
        url = "https://api.grants.gov/v1/api/search2"
    
        # Build request payload
        payload = {"rows": rows, "oppStatuses": opp_statuses or "forecasted|posted"}
    
        # Add optional parameters if provided
        if keyword:
            payload["keyword"] = keyword
        if opp_num:
            payload["oppNum"] = opp_num
        if eligibilities:
            payload["eligibilities"] = eligibilities
        if agencies:
            payload["agencies"] = agencies
        if aln:
            payload["aln"] = aln
        if funding_categories:
            payload["fundingCategories"] = funding_categories
    
        try:
            headers = {"Content-Type": "application/json"}
            response = requests.post(url, json=payload, headers=headers)
            response.raise_for_status()
    
            # Return the JSON response
            return response.json()
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch grants data: {e!s}"}
  • Wildcard import statement that brings the search_grants_gov tool into the core module. Since the function is decorated with @core_mcp.tool(), this import registers the tool with the core_mcp FastMCP instance.
    from .grants._search_grants_gov import *
  • Re-export of the search_grants_gov function from its implementation module, facilitating the wildcard import in core/__init__.py.
    from ._search_grants_gov import search_grants_gov
  • Input schema defined via Pydantic Field descriptions in the function signature parameters.
    def search_grants_gov(
        keyword: Annotated[Optional[str], Field(description="Search keyword")] = None,
        opp_num: Annotated[Optional[str], Field(description="Opportunity number")] = None,
        eligibilities: Annotated[Optional[str], Field(description="Eligibilities (comma-separated)")] = None,
        agencies: Annotated[Optional[str], Field(description="Agency codes (comma-separated)")] = None,
        rows: Annotated[int, Field(description="Results to return")] = 10,
        opp_statuses: Annotated[
            Optional[str], Field(description="'forecasted|posted' (pipe-separated, default: 'forecasted|posted')")
        ] = "forecasted|posted",
        aln: Annotated[Optional[str], Field(description="Assistance Listing Number")] = None,
        funding_categories: Annotated[Optional[str], Field(description="Categories (comma-separated)")] = None,
    ) -> dict:
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions what the tool returns, it doesn't describe important behavioral aspects like rate limits, authentication requirements, error handling beyond 'error message', pagination behavior (though 'rows' parameter suggests some control), or whether this is a read-only operation. For a search tool with no annotation coverage, this leaves significant gaps.

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 appropriately concise with two sentences that efficiently convey the core functionality and return value. The first sentence states what the tool does, and the second describes the return format. There's no wasted text, though the structure could be slightly improved by front-loading the most critical information more explicitly.

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

Completeness3/5

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

Given the tool has 8 parameters with 100% schema coverage and an output schema exists (implied by 'Returns: dict'), the description provides adequate context for a search tool. However, with no annotations and multiple parameters, the description could better address behavioral aspects like search limitations, result ordering, or what happens when no parameters are provided (all are optional). The existence of an output schema reduces the need to explain return values in detail.

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?

The schema description coverage is 100%, so all parameters are documented in the schema. The description mentions searching 'by keyword, agency, or other criteria' which aligns with parameters like 'keyword', 'agencies', and others, but adds no additional semantic context beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

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

Purpose4/5

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

The description clearly states the tool searches grants.gov by specific criteria (keyword, agency, or other) and returns opportunity listings with deadlines and eligibility. It provides a specific verb ('search') and resource ('grants.gov'), but doesn't differentiate from sibling tools since none appear to be related to grants.gov searches.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, limitations, or suggest when other tools might be more appropriate. The sibling tools list shows many unrelated biomedical tools, but no guidance is given about when this grants search tool is the right choice.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/biocontext-ai/knowledgebase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server