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

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

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.
redirected_fromNoOriginal alias followed to this article.
redirect_sectionNoTarget fragment of the redirect, normalized to its heading when matched.
redirect_section_indexNoUnique numeric TOC index matching the redirect anchor. Absent when no index is verified.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedOutput schema / properties / redirect_section
      Added value: +{
      +  "description": "Target fragment of the redirect, normalized to its heading when matched.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / redirect_section_index
      Added value: +{
      +  "description": "Unique numeric TOC index matching the redirect anchor. Absent when no index is verified.",
      +  "maximum": 9007199254740991,
      +  "minimum": -9007199254740991,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / redirected_from
      Added value: +{
      +  "description": "Original alias followed to this article.",
      +  "type": "string"
      +}
  2. 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."
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations, it discloses important behavior: redirect pages are followed automatically, the lead section is included as index 0 even though Wikipedia's TOC omits it, and return fields are described. These are meaningful operational details for correct invocation and interpretation.

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 front-loaded with the core action and return shape, then adds the lead-section nuance and sibling relationship. Every sentence contributes actionable context without repetition.

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 output schema, annotations, and fully documented parameters, the description supplies the remaining context an agent needs: section return format, special lead-section behavior, redirect handling, and how to reuse section_index with a sibling tool.

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 both title and language are already well documented in the schema. The description does not add meaningful parameter semantics beyond that structured documentation, so the baseline of 3 is appropriate.

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 and resource: fetching the table of contents for a Wikipedia article. It clearly distinguishes this structural-listing tool from article retrieval by explaining it returns section titles, heading levels, numbering, and section_index values.

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 tells the agent to pass a section_index to wikipedia_get_article for a targeted section read and frames this tool as useful for enumerating article structure beforehand. That gives a clear alternative and workflow condition.

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.