Skip to main content
Glama

wikipedia-mcp-server

Get Wikipedia Article Sections

wikipedia_get_sections
Read-only

Fetch the table of contents for a Wikipedia article. Returns section titles, heading levels, section numbering (e.g. "2.1"), and section_index values. The first entry is the lead section, index 0, titled Introduction — the text above the first heading, which Wikipedia's own table of contents omits. Pass a section_index to wikipedia_get_article to retrieve just that section. Useful for enumerating article structure before doing a targeted section read. Redirect pages are followed automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesArticle title (e.g. "Python (programming language)"). A trailing #fragment is accepted and ignored; the characters < > [ ] { } and | cannot appear in a Wikipedia page name.
languageNoWikipedia language edition code (default "en"). Examples: "fr", "de", "ja".en

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
titleNoArticle title as resolved by Wikipedia.
pageidNoWikipedia page ID. Absent for stub articles.
languageNoLanguage edition queried.
sectionsNoArticle sections in document order with index values for targeted reads, led by the index-0 lead entry.
total_sectionsNoNumber of entries returned, counting the index-0 lead section.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • changedInput schema / properties / title / description
      Previous value: -"Article title (e.g. \"Python (programming language)\")."New value: +"Article title (e.g. \"Python (programming language)\"). A trailing #fragment is accepted and ignored; the characters < > [ ] { } and | cannot appear in a Wikipedia page name."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `not_found`: No Wikipedia article exists for the given title. `no_sections`: Article exists but has no sections (stub or very short article). `invalid_language`: The language is not a valid BCP 47 code, or names a Wikipedia edition that does not exist. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `not_found`: No Wikipedia article exists for the given title. `invalid_title`: The title contains characters MediaWiki cannot name a page with. `no_sections`: Article exists but has no sections (stub or very short article). `invalid_language`: The language is not a valid BCP 47 code, or names a Wikipedia edition that does not exist. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "not_found",
      -  "no_sections",
      -  "invalid_language"
      -]New value: +[
      +  "not_found",
      +  "invalid_title",
      +  "no_sections",
      +  "invalid_language"
      +]
    • changedOutput schema / properties / sections / description
      Previous value: -"Ordered list of article sections with index values for targeted reads."New value: +"Article sections in document order with index values for targeted reads, led by the index-0 lead entry."
    • changedOutput schema / properties / sections / items / properties / index / description
      Previous value: -"Section index — pass to wikipedia_get_article as section_index."New value: +"Section index — pass to wikipedia_get_article as section_index. 0 is the lead section."
    • changedOutput schema / properties / sections / items / properties / level / description
      Previous value: -"Heading depth: 2 = ==, 3 = ===, etc."New value: +"Heading depth: 2 = ==, 3 = ===, etc. The lead section reports 1."
    • changedOutput schema / properties / sections / items / properties / number / description
      Previous value: -"Section number (e.g. \"2.1\") for hierarchical navigation."New value: +"Section number (e.g. \"2.1\") for hierarchical navigation; \"0\" for the lead section."
    • changedOutput schema / properties / sections / items / properties / title / description
      Previous value: -"Section heading text."New value: +"Section heading text; \"Introduction\" for the lead, which has no heading."
    • changedOutput schema / properties / total_sections / description
      Previous value: -"Total number of sections in the article."New value: +"Number of entries returned, counting the index-0 lead section."
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already provide readOnlyHint and openWorldHint. The description adds substantive behavioral details: the exact fields returned (titles, levels, numbering, section_index), the inclusion of the lead section at index 0, and automatic redirect following. These go well beyond the annotations and inform the agent of edge-case behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured: it opens with the main action and return types, then clarifies the lead-section nuance, then provides a usage pointer, and finally a note on redirects. Each sentence earns its place, though it is slightly dense with detail.

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?

Given the presence of an output schema (indicated), the description covers all necessary operational context: what is returned, how the lead section is handled, how to retrieve a specific section, and redirect behavior. No critical gaps remain for an agent to call it correctly.

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 schema already describes both parameters (title and language) with 100% coverage, including examples and constraints. The description adds no additional parameter-specific semantics beyond referencing section_index, which is a return value rather than an input. Baseline of 3 is appropriate since the schema carries the load.

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 uses a specific verb 'Fetch' and a clear resource 'table of contents for a Wikipedia article'. It also names the sibling 'wikipedia_get_article' and explains how sections relate to it, making the tool's distinct role unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly states the tool is useful for enumerating article structure before a targeted section read, and directly instructs passing a section_index to wikipedia_get_article to retrieve that section. This gives clear when-to-use guidance and a pointer to the alternative.

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.