Skip to main content
Glama
ukicar

Gallica/BnF MCP Server

by ukicar

search_by_title

Search for documents in the Gallica digital library using document titles. Specify exact or partial matches and control result pagination to find specific materials.

Instructions

Search for documents in the Gallica digital library by title.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe title to search for
exact_matchNoIf true, search for the exact title; otherwise, search for title containing the words
max_resultsNoMaximum number of results to return (1-50)
start_recordNoStarting record for pagination

Implementation Reference

  • Main MCP tool factory function that creates the search_by_title tool with its name, description, input schema (lines 28-52), and handler logic (lines 53-61) which validates inputs using zod and calls the SearchAPI.searchByTitle method.
    export function createSearchByTitleTool(searchApi: SearchAPI) {
      return {
        name: 'search_by_title',
        description: 'Search for documents in the Gallica digital library by title.',
        inputSchema: {
          type: 'object',
          properties: {
            title: {
              type: 'string',
              description: 'The title to search for',
            },
            exact_match: {
              type: 'boolean',
              description: 'If true, search for the exact title; otherwise, search for title containing the words',
              default: false,
            },
            max_results: {
              type: 'number',
              description: 'Maximum number of results to return (1-50)',
              default: config.defaultMaxRecords,
            },
            start_record: {
              type: 'number',
              description: 'Starting record for pagination',
              default: config.defaultStartRecord,
            },
          },
          required: ['title'],
        },
        handler: async (args: unknown) => {
          const parsed = exactMatchSchema.extend({ title: z.string() }).parse(args);
          return await searchApi.searchByTitle(
            parsed.title,
            parsed.exact_match ?? false,
            parsed.max_results ?? config.defaultMaxRecords,
            parsed.start_record ?? config.defaultStartRecord
          );
        },
      };
  • The actual search implementation in SearchAPI class that constructs the CQL query (exact match uses quotes, otherwise searches for words in title) and delegates to the core search method.
    searchByTitle(
      title: string,
      exactMatch: boolean = false,
      maxResults: number = config.defaultMaxRecords,
      startRecord: number = config.defaultStartRecord
    ): Promise<SearchResult> {
      const query = exactMatch ? `dc.title all "${title}"` : `dc.title all ${title}`;
      return this.search(query, startRecord, maxResults);
    }
  • src/mcpServer.ts:76-76 (registration)
    Tool instantiation: createSearchByTitleTool is called with searchApi to create the searchByTitle tool object.
    const searchByTitle = createSearchByTitleTool(searchApi);
  • Tool registration: searchByTitle is added to the tools array which is used in the ListToolsRequestSchema handler to expose available tools to MCP clients.
    const tools = [
      searchByTitle,
      searchByAuthor,
      searchBySubject,
      searchByDate,
      searchByDocumentType,
      advancedSearch,
      naturalLanguageSearch,
      getItemDetails,
      getItemPages,
      getPageImage,
      getPageText,
      sequentialReporting,
    ];
  • Zod schema definitions used for input validation: searchParamsSchema defines common parameters (max_results, start_record) and exactMatchSchema extends it with exact_match boolean option.
    const searchParamsSchema = z.object({
      max_results: z.number().int().positive().max(50).optional(),
      start_record: z.number().int().positive().optional(),
    });
    
    const exactMatchSchema = searchParamsSchema.extend({
      exact_match: z.boolean().optional(),
    });
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 only states the basic action ('search') without mentioning any behavioral traits like pagination handling, rate limits, authentication needs, error conditions, or what the search results look like. For a search tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly. Every part of the sentence earns its place by conveying essential information about the tool's function.

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 incomplete for a search tool with multiple parameters. It doesn't explain what the search returns (e.g., result format, metadata), how pagination works beyond the schema, or any limitations like rate limits. For a tool with 4 parameters and no structured output documentation, the description should provide more context about the search behavior and results.

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 description adds no parameter-specific information beyond what's already in the input schema, which has 100% coverage with clear descriptions for all four parameters. Since the schema fully documents parameters like 'title', 'exact_match', 'max_results', and 'start_record', the description doesn't need to compensate, but it also doesn't provide additional context about how parameters interact or search semantics.

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: 'Search for documents in the Gallica digital library by title.' It specifies the verb ('search'), resource ('documents'), and scope ('by title'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'search_by_author' or 'natural_language_search', which prevents 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. With multiple sibling search tools available (e.g., 'search_by_author', 'natural_language_search'), there's no indication of when title-based searching is preferred or what distinguishes this from other search methods. This lack of contextual guidance makes it harder for an agent to choose correctly.

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