Skip to main content
Glama

Get Subject

openlibrary_get_subject
Read-only

Browse works by subject. Returns matching works with edition counts and cover IDs, plus the total work count for the subject. Case and spacing are normalized before lookup, so "Science Fiction" and "science_fiction" are the same request. Subject tags are user-contributed and the vocabulary varies — when a subject returns no works, try a different word form (singular/plural), a synonym, or a broader term.

Input Schema

NameRequiredDescriptionDefault
limitNoMax works to return. Subject pages typically show 12 at a time.
offsetNoZero-based offset for pagination.
subjectYesSubject name. Normalized before lookup — trimmed, lowercased, and internal whitespace converted to underscores (e.g., " Science Fiction " → "science_fiction") — so varying case or surrounding whitespace does not change the result.

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
worksNoWorks under this subject, up to limit.
noticeNoRecovery guidance when work_count is 0, composed with requested/applied page limits and next offset when the limit was reduced to 100. Absent when neither applies.
offsetNoZero-based offset of the first returned result — echoes the requested offset, so an empty page still records the offset that produced it.
totalCountNoTotal works tagged with this subject across all pages.
work_countNoTotal works tagged with this subject.
subject_keyNoNormalized subject key (lowercase, underscores).
subject_nameNoCanonical subject name as stored on Open Library.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / limit / maximum
      Previous value: -100New value: +9007199254740991
    • changedInput schema / properties / subject / description
      Previous value: -"Subject name. Normalized before lookup — lowercased with spaces converted to underscores (e.g., \"Science Fiction\" → \"science_fiction\") — so varying case or spacing does not change the result."New value: +"Subject name. Normalized before lookup — trimmed, lowercased, and internal whitespace converted to underscores (e.g., \" Science Fiction \" → \"science_fiction\") — so varying case or surrounding whitespace does not change the result."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_subject`: The subject is empty after trimming whitespace. Other values are possible when a failure originates below the handler."
    • addedOutput schema / properties / error / properties / data / properties / reason / examples
      Added value: +[
      +  "invalid_subject"
      +]
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery guidance when work_count is 0 — echoes the subject and suggests alternatives. Absent when works are found."New value: +"Recovery guidance when work_count is 0, composed with requested/applied page limits and next offset when the limit was reduced to 100. Absent when neither applies."
  2. Changed2 schema fields changed
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "subject_name",
      -      "subject_key",
      -      "work_count",
      -      "works"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "subject_name",
      +      "subject_key",
      +      "work_count",
      +      "offset",
      +      "works"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / offset
      Added value: +{
      +  "description": "Zero-based offset of the first returned result — echoes the requested offset, so an empty page still records the offset that produced it.",
      +  "type": "number"
      +}
  3. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "subject_name",
      +      "subject_key",
      +      "work_count",
      +      "works"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode.",
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "subject_name",
      -  "subject_key",
      -  "work_count",
      -  "works"
      -]
  4. Changed1 schema field changed
    • changedInput schema / properties / subject / description
      Previous value: -"Subject name. Spaces are converted to underscores internally (e.g., \"science fiction\" → \"science_fiction\"). Use lowercase for best results."New value: +"Subject name. Normalized before lookup — lowercased with spaces converted to underscores (e.g., \"Science Fiction\" → \"science_fiction\") — so varying case or spacing does not change the result."
  5. Changed1 schema field changed
    • addedOutput schema / properties / totalCount
      Added value: +{
      +  "description": "Total works tagged with this subject across all pages.",
      +  "type": "number"
      +}
  6. Changed2 schema fields changed
    • removedOutput schema / properties / message
      Removed value: -{
      -  "description": "Recovery hint when work_count is 0 — echoes the subject and suggests alternatives. Absent when works are found.",
      -  "type": "string"
      -}
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Recovery guidance when work_count is 0 — echoes the subject and suggests alternatives. Absent when works are found.",
      +  "type": "string"
      +}
  7. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, so safety is covered; the description still adds the returned fields and the important caveat that subject tags are user-contributed with inconsistent vocabulary. That vocabulary volatility is non-obvious behavior an agent would otherwise misdiagnose as an empty result.

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?

Three sentences, each carrying distinct information: what it does, what it returns, and how to handle empty results. Front-loaded with the purpose and free of redundant wording despite repeating the normalization note.

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

Completeness5/5

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

An output schema exists and annotations cover the safety profile, so the description only needs to add purpose, return shape hints, and the vocabulary caveat — all present. Nothing an agent needs to invoke it correctly is missing.

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 coverage is 100%, so subject normalization is already fully documented in the schema, and the description's restatement of case/spacing normalization adds little. It says nothing about limit/offset semantics, so the baseline 3 applies.

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?

States a specific verb and resource ('Browse works by subject') and describes what comes back (matching works with edition counts and cover IDs, plus total work count). This cleanly separates it from the search_books and get_work siblings without needing the schema.

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?

Gives actionable guidance for the failure case — if no works return, try singular/plural, synonyms, or a broader term — which is real usage context. It stops short of naming an alternative tool (e.g. search_books) for free-text queries, so no exclusions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.