Skip to main content
Glama
alexwade

DataCite MCP Server

by alexwade

get_doi_schema_xml

Retrieve the raw DataCite Metadata Schema XML for a given DOI to inspect the complete, canonical metadata record.

Instructions

Fetch the raw DataCite Metadata Schema XML for a DOI (base64-decoded). Useful for inspecting the complete, canonical metadata record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doiYes

Implementation Reference

  • The registerTool function that registers the 'get_doi_schema_xml' tool with the MCP server. The handler normalizes the DOI, fetches the record via the DataCite API (with caching), base64-decodes the XML from the response attributes, and returns it. Handles 404 errors and other API errors.
    export function registerTool(server: McpServer): void {
      server.tool(
        "get_doi_schema_xml",
        "Fetch the raw DataCite Metadata Schema XML for a DOI (base64-decoded). Useful for inspecting the complete, canonical metadata record.",
        GetDoiSchemaXmlSchema.shape,
        async (params) => {
          const input = GetDoiSchemaXmlSchema.parse(params);
          const doi = normalizeDoi(input.doi);
    
          try {
            const record = await getCached<DoiRecord>(
              doiCache,
              doi,
              () =>
                dataciteClient
                  .get<DoiResponse>(`/dois/${encodeURIComponent(doi)}`, { detail: true })
                  .then((r) => r.data)
            );
    
            if (!record.attributes.xml) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: JSON.stringify(
                      { doi, xml: null, message: "No XML available for this DOI." },
                      null,
                      2
                    ),
                  },
                ],
              };
            }
    
            const xml = Buffer.from(record.attributes.xml, "base64").toString("utf-8");
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify({ doi, xml }, null, 2),
                },
              ],
            };
          } catch (err) {
            if (err instanceof DataCiteError && err.statusCode === 404) {
              throw notFound(doi);
            }
            const msg = err instanceof Error ? err.message : String(err);
            throw apiError(msg);
          }
        }
      );
    }
  • Zod schema defining the input: a single required 'doi' string.
    const GetDoiSchemaXmlSchema = z.object({
      doi: z.string().min(1),
    });
  • Import and registration of get_doi_schema_xml in the central tools index.
    import { registerTool as registerGetDoiSchemaXml } from "./get-doi-schema-xml.js";
    
    export function registerAllTools(server: McpServer): void {
      registerSearchDois(server);
      registerGetDoi(server);
      registerFormatCitation(server);
      registerGetDoiMetrics(server);
      registerGetRelatedWorks(server);
      registerSearchByPerson(server);
      registerListRepositories(server);
      registerGetRepository(server);
      registerGetDoiSchemaXml(server);
    }
  • Type declaration for the registerTool export.
    import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    export declare function registerTool(server: McpServer): void;
Behavior3/5

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

With no annotations provided, the description must fully disclose behavior. It mentions that the output is 'base64-decoded' and 'XML,' but it does not address potential error states, authentication requirements, rate limits, or other side effects. This is adequate but not thorough.

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 two concise sentences that immediately convey the purpose. Every word serves a purpose, and there is no redundancy or unnecessary detail.

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

Completeness4/5

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

Given the tool's simplicity (single parameter, no output schema), the description adequately covers the return format and the decoding behavior. It could mention error handling or the structure of the XML, but overall it is sufficient for the tool's complexity.

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?

The input schema provides the 'doi' parameter with no description (0% coverage). The description only repeats that it fetches for a DOI, adding no additional semantic guidance about format, constraints, or examples. More detail would help, such as the expected format or that it must be a valid DataCite DOI.

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 action ('Fetch') and the resource ('raw DataCite Metadata Schema XML for a DOI'), with a specific detail about base64-decoding. It distinguishes from sibling tools like get_doi or get_doi_metrics by focusing on the canonical XML record.

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?

The description indicates the tool is 'useful for inspecting the complete, canonical metadata record,' providing clear context for its use. However, it does not explicitly state when not to use it or suggest alternatives, such as using get_doi for a different format.

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/alexwade/datacite-mcp'

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