Skip to main content
Glama
salwks

mcp-techTrend

fda_510k_recent

Read-onlyIdempotent

Retrieve recent FDA 510(k) clearance data filtered by date, with optional device name queries using wildcard tokens for partial matches.

Instructions

Recent FDA 510(k) clearances via openFDA. Date filter is always applied. openFDA uses token-exact matching on string fields — for partial name matches use wildcards (e.g. device_name:mammo* not device_name:mammography).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo
daysNo
max_resultsNo
response_formatNomarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Pydantic model FDA510kInput: validates query, days (1-365), max_results (1-100), and response_format for the fda_510k_recent tool.
    class FDA510kInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
        query: str | None = Field(None, max_length=300)
        days: int = Field(30, ge=1, le=365)
        max_results: int = Field(20, ge=1, le=100)
        response_format: ResponseFormat = ResponseFormat.MARKDOWN
  • Tool registration via @_maybe_tool decorator for source='fda_510k', name='fda_510k_recent'. The _maybe_tool function gates registration based on whether the source is in ENABLED_SOURCES.
    @_maybe_tool(
        source="fda_510k",
        name="fda_510k_recent",
        description=(
            "Recent FDA 510(k) clearances via openFDA. Date filter is always applied. "
            "openFDA uses token-exact matching on string fields — for partial name "
            "matches use wildcards (e.g. `device_name:mammo*` not `device_name:mammography`)."
        ),
        annotations={
            "readOnlyHint": True,
            "destructiveHint": False,
            "openWorldHint": True,
            "idempotentHint": True,
        },
  • Main handler function for fda_510k_recent. Uses openFDA API to search 510(k) clearances filtered by decision_date range and optional query. Builds a custom URL with +AND+ search syntax, fetches JSON with TTL_STATIC cache, renders markdown via _render_510k_md, and handles 404 (no results) gracefully.
    async def fda_510k_recent(
        query: str | None = None,
        days: int = 30,
        max_results: int = 20,
        response_format: ResponseFormat = ResponseFormat.MARKDOWN,
    ) -> str:
        try:
            args = FDA510kInput(
                query=query, days=days, max_results=max_results, response_format=response_format
            )
            end = _utc_now().strftime("%Y%m%d")
            start = (_utc_now() - timedelta(days=args.days)).strftime("%Y%m%d")
            date_clause = f"decision_date:[{start}+TO+{end}]"
            parts = [date_clause]
            if args.query:
                parts.append(args.query)
            search = _build_openfda_search(parts)
            params: dict[str, Any] = {
                "search": search,
                "limit": args.max_results,
                "sort": "decision_date:desc",
            }
            api_key = os.environ.get("OPENFDA_API_KEY")
            if api_key:
                params["api_key"] = api_key
            # openFDA's `+AND+` must NOT be percent-encoded; pass as a manually-built URL.
            url = f"{OPENFDA_510K}?search={search}&limit={params['limit']}&sort=decision_date:desc"
            if api_key:
                url += f"&api_key={api_key}"
            data = await _http_get_json(url, ttl=TTL_STATIC)
            items = data.get("results", []) if isinstance(data, dict) else []
            header = f"FDA 510(k) — 최근 {args.days}일 ({len(items)}건)"
            return _format(items, args.response_format, render_md=lambda x: _render_510k_md(x, header))
        except httpx.HTTPStatusError as e:
            # openFDA returns 404 when zero results — show empty list instead of error.
            if e.response.status_code == 404:
                header = f"FDA 510(k) — 최근 {args.days}일 (0건)"
                return _format([], args.response_format, render_md=lambda x: _render_510k_md(x, header))
            return _handle_error(e, "fda_510k_recent")
        except Exception as e:
            return _handle_error(e, "fda_510k_recent")
  • Markdown renderer _render_510k_md: formats 510(k) results into a structured markdown table with device name (linked to FDA's pmn page), applicant, decision description, date, and product code.
    def _render_510k_md(items: list[dict[str, Any]], header: str) -> str:
        if not items:
            return f"# {header}\n\n_결과 없음_"
        lines = [f"# {header}", f"_총 {len(items)}건_", ""]
        for i, r in enumerate(items, 1):
            knum = r.get("k_number", "")
            url = f"https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID={knum}" if knum else ""
            link = f"[{knum}]({url})" if url else knum
            lines.append(
                f"## {i}. {r.get('device_name', '?')} — {link}\n"
                f"- 신청자: {r.get('applicant', '?')}\n"
                f"- 결정: {r.get('decision_description') or r.get('decision_code', '?')} · "
                f"{r.get('decision_date', '?')} · 제품코드 `{r.get('product_code', '?')}`\n"
            )
        return "\n".join(lines)
  • Helper _build_openfda_search: joins search parts with openFDA's +AND+ syntax for building the query string.
    def _build_openfda_search(parts: list[str]) -> str:
        return "+AND+".join(parts) if parts else ""
Behavior4/5

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

Annotations already indicate read-only and idempotent, but description adds critical behavioral info: date filter always applied and token-exact matching with wildcard recommendations.

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

Conciseness5/5

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

Extremely concise two sentences, front-loaded with purpose and key behavioral note.

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 output schema exists and annotations are rich, description provides essential query guidance but lacks parameter explanations for non-query fields.

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

Parameters2/5

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

With 0% schema description coverage, description only partially explains query parameter behavior, omitting details for days, max_results, and response_format.

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?

Description clearly states the tool retrieves recent FDA 510(k) clearances via openFDA, distinguishing it from sibling tools like fda_recalls_recent.

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?

Provides date filter always applied and query syntax tips, but does not explicitly contrast with similar tools or state when to use this tool over others.

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/salwks/mcp-techTrend'

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