Skip to main content
Glama
prtc
by prtc

export_bibtex

Export BibTeX citations from NASA ADS for LaTeX or Quarto documents by providing paper bibcodes.

Instructions

Export BibTeX citations for one or more papers. Useful for adding references to LaTeX/Quarto documents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bibcodesYesList of ADS bibcodes to export

Implementation Reference

  • Main handler function that implements the export_bibtex tool logic by querying ADS for paper details and generating BibTeX entries.
    async def export_bibtex(bibcodes: list[str]) -> list[TextContent]:
        """Export BibTeX citations for papers."""
        try:
            bibtex_entries = []
            
            for bibcode in bibcodes:
                # Get paper with BibTeX data
                papers = list(ads.SearchQuery(bibcode=bibcode))
                
                if not papers:
                    bibtex_entries.append(f"% Paper not found: {bibcode}\n")
                    continue
                
                paper = papers[0]
                
                # Generate BibTeX entry
                authors_str = " and ".join(paper.author) if paper.author else "Unknown"
                title = paper.title[0] if paper.title else "No title"
                
                entry = f"""@ARTICLE{{{bibcode},
        author = {{{authors_str}}},
        title = {{{title}}},
        journal = {{{paper.pub or 'Unknown'}}},
        year = {paper.year},
        adsurl = {{https://ui.adsabs.harvard.edu/abs/{bibcode}}},
    }}
    """
                bibtex_entries.append(entry)
            
            if not bibtex_entries:
                return [TextContent(
                    type="text",
                    text="No valid bibcodes provided"
                )]
            
            response = "BibTeX Citations:\n\n" + "\n".join(bibtex_entries)
            return [TextContent(type="text", text=response)]
        
        except Exception as e:
            logger.error(f"Error exporting BibTeX: {e}")
            return [TextContent(
                type="text",
                text=f"Error exporting BibTeX: {str(e)}"
            )]
  • Tool registration in the list_tools() function, defining the tool name, description, and input schema.
    Tool(
        name="export_bibtex",
        description=(
            "Export BibTeX citations for one or more papers. "
            "Useful for adding references to LaTeX/Quarto documents."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "bibcodes": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "List of ADS bibcodes to export",
                },
            },
            "required": ["bibcodes"],
        },
    ),
  • Input schema definition for the export_bibtex tool, specifying bibcodes as a required array of strings.
    inputSchema={
        "type": "object",
        "properties": {
            "bibcodes": {
                "type": "array",
                "items": {"type": "string"},
                "description": "List of ADS bibcodes to export",
            },
        },
        "required": ["bibcodes"],
    },
  • Dispatcher in call_tool() that routes calls to the export_bibtex handler.
    elif name == "export_bibtex":
        return await export_bibtex(bibcodes=arguments["bibcodes"])
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool is for 'exporting' and 'useful for adding references,' but does not disclose key traits such as whether this is a read-only operation, if it requires authentication, rate limits, or what the output format looks like (e.g., BibTeX string, file). This leaves gaps in understanding the tool's behavior.

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 appropriately sized and front-loaded: two concise sentences that directly state the purpose and usage context without unnecessary details. Every sentence earns its place by providing essential information efficiently.

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's moderate complexity (export function with one parameter) and no annotations or output schema, the description is partially complete. It covers the basic purpose and a usage hint but lacks details on behavioral traits and output format. This is adequate for a simple tool but has clear gaps in transparency and completeness.

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 input schema has 100% description coverage, with the 'bibcodes' parameter fully documented in the schema. The description does not add any parameter-specific details beyond what the schema provides (e.g., it doesn't explain bibcode format or constraints). According to the rules, with high schema coverage, the baseline is 3 even without extra param info in the description.

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's purpose: 'Export BibTeX citations for one or more papers.' It specifies the verb ('export'), resource ('BibTeX citations'), and scope ('one or more papers'). However, it does not explicitly differentiate from sibling tools like 'get_paper_details' or 'search_papers', which might also handle paper data but in different formats or contexts.

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

Usage Guidelines3/5

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

The description provides some usage context: 'Useful for adding references to LaTeX/Quarto documents.' This implies when to use the tool (for document citation needs) but does not specify when not to use it or name alternatives among sibling tools. For example, it doesn't clarify if this is for formatted citations vs. raw data from other tools.

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/prtc/nasa-ads-mcp'

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