Skip to main content
Glama
botanicastudios

Crossref MCP Server

searchByTitle

Search for scientific papers by title in Crossref to find academic publications and retrieve structured metadata about scholarly works.

Instructions

Search for scientific papers by title in Crossref

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe title to search for
rowsNoNumber of results to return

Implementation Reference

  • Primary handler implementation for the 'searchByTitle' tool. Fetches academic works from Crossref API using the provided title query, limits results with 'rows', formats them using formatWorkToJson helper, and returns structured JSON response or error.
    async ({ title, rows }) => {
      try {
        const url = `${CROSSREF_API_BASE}/works?query.title=${encodeURIComponent(
          title
        )}&rows=${rows}&select=${CROSSREF_SELECT_FIELDS}`;
        const response = await fetch(url, {
          headers: {
            "User-Agent": "Crossref MCP Server",
          },
        });
    
        if (!response.ok) {
          throw new Error(`API request failed with status ${response.status}`);
        }
    
        const data = await response.json();
        const works = data.message?.items || [];
    
        if (works.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    status: "no_results",
                    query: { title, rows },
                    results: [],
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
    
        const formattedWorks = works.map((work) => formatWorkToJson(work));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  status: "success",
                  query: { title, rows },
                  count: formattedWorks.length,
                  results: formattedWorks,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  status: "error",
                  message: error.message,
                  query: { title, rows },
                },
                null,
                2
              ),
            },
          ],
        };
      }
    }
  • Input schema validation using Zod for the searchByTitle tool parameters.
    {
      title: z.string().describe("The title to search for"),
      rows: z
        .number()
        .optional()
        .default(5)
        .describe("Number of results to return"),
    },
  • mcp-server.js:21-107 (registration)
    Registration of the 'searchByTitle' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      "searchByTitle",
      "Search for scientific papers by title in Crossref",
      {
        title: z.string().describe("The title to search for"),
        rows: z
          .number()
          .optional()
          .default(5)
          .describe("Number of results to return"),
      },
      async ({ title, rows }) => {
        try {
          const url = `${CROSSREF_API_BASE}/works?query.title=${encodeURIComponent(
            title
          )}&rows=${rows}&select=${CROSSREF_SELECT_FIELDS}`;
          const response = await fetch(url, {
            headers: {
              "User-Agent": "Crossref MCP Server",
            },
          });
    
          if (!response.ok) {
            throw new Error(`API request failed with status ${response.status}`);
          }
    
          const data = await response.json();
          const works = data.message?.items || [];
    
          if (works.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    {
                      status: "no_results",
                      query: { title, rows },
                      results: [],
                    },
                    null,
                    2
                  ),
                },
              ],
            };
          }
    
          const formattedWorks = works.map((work) => formatWorkToJson(work));
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    status: "success",
                    query: { title, rows },
                    count: formattedWorks.length,
                    results: formattedWorks,
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    status: "error",
                    message: error.message,
                    query: { title, rows },
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
      }
    );
  • Helper function to format Crossref work data into a clean JSON structure, used by the searchByTitle handler to process API responses.
    export const formatWorkToJson = (work) => {
      if (!work) return { error: "No data available" };
    
      return {
        title: work.title?.[0] || null,
        authors: work.author
          ? work.author.map((a) => ({
              given: a.given || null,
              family: a.family || null,
              name: `${a.given || ""} ${a.family || ""}`.trim(),
            }))
          : [],
        published: work.published
          ? {
              dateParts: work.published["date-parts"]?.[0] || [],
              dateString: work.published["date-parts"]?.[0]?.join("-") || null,
            }
          : null,
        type: work.type || null,
        doi: work.DOI || null,
        url: work.URL || null,
        container: work["container-title"]?.[0] || null,
        publisher: work.publisher || null,
        issue: work.issue || null,
        volume: work.volume || null,
        abstract: work.abstract || null,
      };
    };
  • Test or alternative handler implementation for searchByTitle in the test handlers file, nearly identical to the main handler.
    searchByTitle: async ({ title, rows = 5 }) => {
      try {
        const url = `https://api.crossref.org/works?query.title=${encodeURIComponent(
          title
        )}&rows=${rows}`;
        const response = await fetch(url, {
          headers: {
            "User-Agent": "Crossref MCP Server Test",
          },
        });
    
        if (!response.ok) {
          throw new Error(`API request failed with status ${response.status}`);
        }
    
        const data = await response.json();
        const works = data.message?.items || [];
    
        if (works.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    status: "no_results",
                    query: { title, rows },
                    results: [],
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
    
        const formattedWorks = works.map((work) => formatWorkToJson(work));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  status: "success",
                  query: { title, rows },
                  count: formattedWorks.length,
                  results: formattedWorks,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  status: "error",
                  message: error.message,
                  query: { title, rows },
                },
                null,
                2
              ),
            },
          ],
        };
      }
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the search function but doesn't mention rate limits, authentication requirements, error handling, or what the response format looks like (beyond 'scientific papers'). This leaves significant gaps for a tool with potential external API constraints.

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 communicates the core purpose without unnecessary words. It's appropriately sized for a simple search tool and front-loads the essential information.

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 lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what the search returns (beyond 'scientific papers'), how results are structured, or any limitations of the Crossref API. For a search tool with external dependencies, more context is needed.

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 input schema already fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., search behavior, title matching rules, result ordering). The baseline score of 3 reflects adequate but minimal value addition.

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 action ('Search for scientific papers') and resource ('by title in Crossref'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'searchByAuthor' or 'getWorkByDOI', which would be needed for a perfect score.

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 'searchByAuthor' or 'getWorkByDOI'. There's no mention of use cases, prerequisites, or comparative advantages, leaving the agent without context for tool selection.

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/botanicastudios/crossref-mcp'

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