WORLDBOOK

Worldbooks | WebMCP | Search | Submit WebMCP

openlibrary WebMCP

Browser tool configuration for openlibrary

URL Pattern: ^https?://(www\.)?openlibrary\.org(/.*)?$
Allowed Extra Domains: covers.openlibrary.org, openlibrary.org

Tools (4)

openlibrary_get_book_details()

Fetch the current work or edition details as JSON

Parameters

path string - Optional current Open Library path such as /works/OL45883W

JavaScript Handler

(params) => {
  const path = params.path || window.location.pathname;
  const normalized = path.endsWith('.json') ? path : path.replace(/\/$/, '') + '.json';
  return fetch('https://openlibrary.org' + normalized)
    .then((resp) => resp.ok ? resp.json() : Promise.reject(new Error('HTTP ' + resp.status)))
    .then((data) => ({
      success: true,
      path,
      details: {
        title: data.title || document.querySelector('h1')?.textContent?.trim() || '',
        description: typeof data.description === 'string' ? data.description : (data.description?.value || ''),
        subjects: data.subjects || [],
        firstPublishDate: data.first_publish_date || null,
        covers: data.covers || [],
        url: 'https://openlibrary.org' + path.replace(/\.json$/, '')
      }
    }))
    .catch((error) => ({ success: false, message: error.message, path }));
}

openlibrary_open_book()

Open an Open Library work page by work ID

Parameters

workId string required - Open Library work ID, for example OL45883W

JavaScript Handler

(params) => {
  window.location.href = 'https://openlibrary.org/works/' + params.workId;
  return { success: true, message: 'Opening work page...', workId: params.workId };
}

openlibrary_search()

Open Library 图书搜索

Parameters

query string required - 搜索关键词
count number - 返回数量

JavaScript Handler

openlibrary_search_books()

Search books from Open Library and return structured results

Parameters

query string required - Search keywords
limit number - Maximum results to return (default 10)

JavaScript Handler

(params) => {
  const limit = Math.max(1, Math.min(20, Number(params.limit || 10)));
  return fetch('https://openlibrary.org/search.json?q=' + encodeURIComponent(params.query) + '&limit=' + limit)
    .then((resp) => resp.ok ? resp.json() : Promise.reject(new Error('HTTP ' + resp.status)))
    .then((data) => {
      const books = (data.docs || []).slice(0, limit).map((doc, index) => ({
        rank: index + 1,
        title: doc.title || '',
        authors: doc.author_name || [],
        firstPublishYear: doc.first_publish_year || null,
        editionCount: doc.edition_count || 0,
        cover: doc.cover_i ? 'https://covers.openlibrary.org/b/id/' + doc.cover_i + '-M.jpg' : null,
        workKey: doc.key || null,
        url: doc.key ? 'https://openlibrary.org' + doc.key : null
      }));
      return {
        success: true,
        query: params.query,
        total: data.numFound || 0,
        count: books.length,
        books
      };
    })
    .catch((error) => ({ success: false, message: error.message }));
}

🔌 Chrome MCP Server Extension

Use these tools with Claude, ChatGPT, and other AI assistants.

Get Extension →

How to Use WebMCP

WebMCP tools are designed for browser extensions or automation frameworks. The browser extension matches the current URL against the pattern and executes the JavaScript handler when the tool is invoked.

API Endpoint:

GET /api/webmcp/match?url=https://www.openlibrary.com/...