Skip to main content
Glama
chrismannina

PubMed MCP Server

by chrismannina

search_by_journal

Search PubMed articles from a specific journal by name, date range, and result limit to find relevant research publications.

Instructions

Search articles from a specific journal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
journal_nameYesJournal name or abbreviation
max_resultsNoMaximum number of results
date_fromNoStart date (YYYY/MM/DD)
date_toNoEnd date (YYYY/MM/DD)

Implementation Reference

  • The main handler function that executes the search_by_journal tool logic. It extracts parameters, calls the PubMed client to search by journal, formats the results using _format_article_summary, and returns an MCPResponse.
    async def _handle_search_by_journal(self, arguments: Dict[str, Any]) -> MCPResponse:
        """Handle journal-based search."""
        try:
            journal_name = arguments.get("journal_name", "")
            if not journal_name:
                return MCPResponse(
                    content=[{"type": "text", "text": "Journal name is required"}], is_error=True
                )
    
            max_results = arguments.get("max_results", 20)
            date_from = arguments.get("date_from")
            date_to = arguments.get("date_to")
    
            search_result = await self.pubmed_client.search_articles(
                query=f'"{journal_name}"[Journal]',
                max_results=max_results,
                date_from=date_from,
                date_to=date_to,
                cache=self.cache,
            )
    
            content = []
            content.append(
                {
                    "type": "text",
                    "text": f"**Recent Articles from {journal_name}**\n\n"
                    f"Total Results: {search_result.total_results:,}\n"
                    f"Showing: {search_result.returned_results}\n",
                }
            )
    
            for i, article_data in enumerate(search_result.articles, 1):
                article_text = self._format_article_summary(article_data, i)
                content.append({"type": "text", "text": article_text})
    
            return MCPResponse(content=content)
    
        except Exception as e:
            logger.error(f"Error in search_by_journal: {e}")
            return MCPResponse(
                content=[{"type": "text", "text": f"Error: {str(e)}"}], is_error=True
            )
  • The JSON schema definition for the search_by_journal tool, including input parameters and validation rules.
    {
        "name": "search_by_journal",
        "description": "Search articles from a specific journal",
        "inputSchema": {
            "type": "object",
            "properties": {
                "journal_name": {"type": "string", "description": "Journal name or abbreviation"},
                "max_results": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20,
                    "description": "Maximum number of results",
                },
                "date_from": {"type": "string", "description": "Start date (YYYY/MM/DD)"},
                "date_to": {"type": "string", "description": "End date (YYYY/MM/DD)"},
            },
            "required": ["journal_name"],
        },
    },
  • The handler_map dictionary that registers the _handle_search_by_journal function for the 'search_by_journal' tool name in the handle_tool_call method.
    handler_map = {
        "search_pubmed": self._handle_search_pubmed,
        "get_article_details": self._handle_get_article_details,
        "search_by_author": self._handle_search_by_author,
        "find_related_articles": self._handle_find_related_articles,
        "export_citations": self._handle_export_citations,
        "search_mesh_terms": self._handle_search_mesh_terms,
        "search_by_journal": self._handle_search_by_journal,
        "get_trending_topics": self._handle_get_trending_topics,
        "analyze_research_trends": self._handle_analyze_research_trends,
        "compare_articles": self._handle_compare_articles,
        "get_journal_metrics": self._handle_get_journal_metrics,
        "advanced_search": self._handle_advanced_search,
    }
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. It states the action ('Search') but doesn't mention whether this is a read-only operation, potential rate limits, authentication requirements, or what the output format might be. For a search tool with zero annotation coverage, this is a significant gap.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, earning a perfect score for conciseness.

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

Completeness2/5

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

Given the complexity of a search operation with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what kind of results to expect, how they're formatted, or any behavioral constraints. The agent would need to guess about the tool's behavior beyond the basic purpose.

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 description coverage is 100%, so the schema already documents all four parameters thoroughly. The description adds no additional parameter information beyond what's in the schema, but since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 verb ('Search') and resource ('articles from a specific journal'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_by_author' or 'advanced_search', which limits its score to 4 rather than 5.

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 like 'search_by_author' or 'advanced_search'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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

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