Skip to main content
Glama
ukicar

Gallica/BnF MCP Server

by ukicar

get_page_image

Retrieve IIIF image URLs and metadata for specific pages in Gallica/BnF digital documents using ARK identifiers and page numbers.

Instructions

Get IIIF image URL for a specific page. Returns URL and metadata, not binary data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
arkYesARK identifier
pageYesPage number
sizeNoImage size (e.g., "full", "200,", "500,500", "pct:50")
regionNoImage region (e.g., "full", "x,y,w,h")

Implementation Reference

  • Main tool implementation: createGetPageImageTool function that defines the get_page_image tool with its name, description, input schema, and async handler that validates inputs and calls iiifClient.getImageUrl to return IIIF image URLs
    export function createGetPageImageTool(iiifClient: IIIFClient) {
      return {
        name: 'get_page_image',
        description: 'Get IIIF image URL for a specific page. Returns URL and metadata, not binary data.',
        inputSchema: {
          type: 'object',
          properties: {
            ark: {
              type: 'string',
              description: 'ARK identifier',
            },
            page: {
              type: 'number',
              description: 'Page number',
            },
            size: {
              type: 'string',
              description: 'Image size (e.g., "full", "200,", "500,500", "pct:50")',
            },
            region: {
              type: 'string',
              description: 'Image region (e.g., "full", "x,y,w,h")',
            },
          },
          required: ['ark', 'page'],
        },
        handler: async (args: unknown) => {
          const parsed = z.object({
            ark: z.string(),
            page: z.number().int().positive(),
            size: z.string().optional(),
            region: z.string().optional(),
          }).parse(args);
    
          const options: { size?: string; region?: string } = {};
          if (parsed.size) options.size = parsed.size;
          if (parsed.region) options.region = parsed.region;
          
          const url = iiifClient.getImageUrl(parsed.ark, parsed.page, options);
    
          return {
            ark: parsed.ark,
            page: parsed.page,
            iiif_url: url,
            thumbnail_url: iiifClient.getImageUrl(parsed.ark, parsed.page, { size: '200,' }),
          };
        },
      };
    }
  • Input schema definition: Validates 'ark' (required string), 'page' (required number), 'size' (optional string for image size), and 'region' (optional string for image region)
    inputSchema: {
      type: 'object',
      properties: {
        ark: {
          type: 'string',
          description: 'ARK identifier',
        },
        page: {
          type: 'number',
          description: 'Page number',
        },
        size: {
          type: 'string',
          description: 'Image size (e.g., "full", "200,", "500,500", "pct:50")',
        },
        region: {
          type: 'string',
          description: 'Image region (e.g., "full", "x,y,w,h")',
        },
      },
      required: ['ark', 'page'],
    },
  • src/mcpServer.ts:87-87 (registration)
    Tool instantiation: Creates getPageImage tool instance using createGetPageImageTool with iiifClient dependency
    const getPageImage = createGetPageImageTool(iiifClient);
  • Tool registration: Adds getPageImage to the tools array for MCP server registration
    getPageImage,
  • Helper method: IIIFClient.getImageUrl that constructs IIIF image URLs using ark, page, and options (region, size, rotation, quality, format)
    getImageUrl(ark: string, page: number, options: IIIFImageOptions = {}): string {
      // Extract ARK identifier
      const arkId = ark.replace(/^ark:\/12148\//, '').replace(/^\/ark:\/12148\//, '');
      
      const region = options.region || 'full';
      const size = options.size || 'full';
      const rotation = options.rotation !== undefined ? options.rotation : 0;
      const quality = options.quality || 'native';
      const format = options.format || 'jpg';
    
      return `${this.baseUrl}/iiif/ark:/12148/${arkId}/f${page}/${region}/${size}/${rotation}/${quality}.${format}`;
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the return format (URL and metadata, not binary data) which is valuable behavioral context. However, it lacks details on authentication needs, rate limits, error conditions, or whether this is a read-only operation, leaving significant gaps in behavioral understanding.

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 extremely concise with just two sentences that are front-loaded with essential information. Every word earns its place, with no redundant or unnecessary content, making it efficient for agent comprehension.

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 no annotations and no output schema, the description provides basic purpose and output format but lacks sufficient context for a tool with 4 parameters. It doesn't explain what metadata is returned, how errors are handled, or provide examples of typical use cases, leaving the agent with incomplete operational understanding.

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 parameters are fully documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the relationship between ark and page or providing examples beyond those in schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

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 specific action ('Get IIIF image URL'), resource ('for a specific page'), and output type ('Returns URL and metadata, not binary data'). It distinguishes from potential sibling tools like get_page_text by specifying image retrieval rather than text extraction.

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 implies usage when needing image URLs for pages, but provides no explicit guidance on when to use this tool versus alternatives like get_item_pages or get_item_details. No exclusions or prerequisites are mentioned, leaving usage context partially ambiguous.

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/ukicar/sweet-bnf'

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