Skip to main content
Glama

generate_search_queries

Generates search intelligence for PubMed topics by extracting keywords, MeSH terms, and synonyms. Corrects spelling, suggests queries with estimated results, and shows how PubMed interprets the query.

Instructions

Gather search intelligence for a topic - returns RAW MATERIALS for Agent to decide.

This tool provides the BUILDING BLOCKS for search, not finished queries. The Agent decides how to use them.

══════════════════════════════════════════════════════════════════════ TWO USAGE MODES: ══════════════════════════════════════════════════════════════════════

MODE 1: KEYWORD SEARCH (single topic) ───────────────────────────────────── User: "搜尋 remimazolam 的文獻"

Step 1: generate_search_queries("remimazolam") Step 2: Build a Boolean query from returned materials Step 3: analyze_search_query(query="") Step 4: unified_search(query="")

══════════════════════════════════════════════════════════════════════

MODE 2: PICO SEARCH (clinical question) ─────────────────────────────────────── User: "remimazolam 在 ICU 鎮靜比 propofol 好嗎?會減少 delirium 嗎?"

Step 1: Agent extracts P/I/C/O from the clinical question, then calls parse_pico(description=..., p=..., i=..., c=..., o=...) to validate the structured handoff and get a runnable PICO pipeline.

Step 2: For EACH PICO element, call generate_search_queries() IN PARALLEL: - generate_search_queries("ICU patients") → P materials - generate_search_queries("remimazolam") → I materials - generate_search_queries("propofol") → C materials - generate_search_queries("delirium") → O materials

Step 3: Combine materials using Boolean logic: High precision: (P_terms) AND (I_terms) AND (C_terms) AND (O_terms) High recall: (P_terms) AND (I_terms OR C_terms) AND (O_terms)

Step 4: Add Clinical Query filter if appropriate: - therapy[filter] → 治療效果比較 - diagnosis[filter] → 診斷相關 - prognosis[filter] → 預後相關 - etiology[filter] → 病因相關

Step 5: Validate the final query with analyze_search_query()
Step 6: Execute unified_search() with the final Boolean query

══════════════════════════════════════════════════════════════════════

Features:

  • Spelling correction via NCBI ESpell

  • MeSH term lookup for standardized vocabulary

  • Synonym expansion from MeSH database

  • Query analysis: Shows how PubMed actually interprets each query (Agent's understanding vs PubMed's actual interpretation)

Args: topic: Search topic - can be a single keyword or PICO element strategy: Affects suggested_queries (if included) - "comprehensive": Multiple angles, includes reviews (default) - "focused": Adds RCT filter for high evidence - "exploratory": Broader search with more synonyms check_spelling: Whether to check/correct spelling (default: True) include_suggestions: Include pre-built query suggestions (default: True)

Returns: JSON with RAW MATERIALS: - corrected_topic: Spell-checked topic - keywords: Extracted significant keywords - mesh_terms: MeSH data with preferred terms and synonyms - all_synonyms: Flattened list of all synonyms - suggested_queries: Optional pre-built queries with: - estimated_count: How many results PubMed would return - pubmed_translation: How PubMed actually interprets the query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes
strategyNocomprehensive
check_spellingNo
include_suggestionsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations are provided, so the description carries full burden. It discloses behaviors like spelling correction via NCBI ESpell, MeSH term lookup, synonym expansion, and query analysis showing PubMed's interpretation. It also describes the return structure (JSON with fields like corrected_topic, keywords, mesh_terms, all_synonyms, suggested_queries with estimated_count and pubmed_translation). There is no contradiction.

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 lengthy but well-structured with headers, modes, steps, and features. It is front-loaded with the core purpose and uses clear formatting. While some detail might be excessive (e.g., full workflow steps), it is justified given the tool's complexity and integration with other tools.

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?

Given the tool's complexity (4 parameters, output schema, many siblings), the description is highly complete. It covers what the tool does, how to use it in two modes, parameter details, return value structure (listing keys), and integration with follow-up tools. The presence of an output schema is mentioned, but the description already explains the return fields.

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

Parameters5/5

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

Schema description coverage is 0%, but the description includes an 'Args:' section that explains each parameter (topic, strategy, check_spelling, include_suggestions) and their effects (e.g., strategy affects suggested_queries, check_spelling for spelling correction). This adds significant meaning beyond the schema alone.

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 clearly states the tool's purpose: 'Gather search intelligence for a topic - returns RAW MATERIALS for Agent to decide.' It distinguishes itself from sibling tools like unified_search and analyze_search_query by emphasizing that it provides building blocks, not finished queries. The two usage modes (keyword and PICO) further clarify its role.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use guidance with detailed step-by-step workflows for both keyword and PICO modes. It contrasts with sibling tools by stating that the agent decides how to use the raw materials, and it references subsequent steps (analyze_search_query, unified_search). No alternative tools are mentioned, but the usage context is thoroughly explained.

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/u9401066/pubmed-search-mcp'

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