Skip to main content
Glama

stackexchange-mcp-server

Search Stack Exchange Questions

stackexchange_search_questions
Read-onlyIdempotent

Search questions across a Stack Exchange site. Returns ranked questions with title, score, answer count, accepted status, tags, ask and last-activity dates, and a short excerpt of the question body — not the full body. Results supply question_id values for stackexchange_get_thread, which fetches the full question body and all answers. Results past the pageSize cap are reachable with the page parameter. Use the site parameter to target a specific community (e.g. "stackoverflow", "superuser", "unix"); call stackexchange_list_sites to discover valid site values.

Input Schema

NameRequiredDescriptionDefault
pageNoPage of results to return, 1-based (default 1). Page 2 with pageSize 10 returns results 11–20. Each page is a separate upstream call and costs one API quota unit, which matters on the keyless 300/day tier. Without STACKEXCHANGE_API_KEY, Stack Exchange refuses any page above 25.
siteNoStack Exchange site to search — the api_site_parameter (e.g. "stackoverflow", "superuser", "serverfault") or the site's domain (e.g. "serverfault.com"). Defaults to "stackoverflow". Call stackexchange_list_sites to discover valid values.stackoverflow
sortNoResult ordering: "relevance" (default, best match), "votes" (highest score first), "activity" (most recently active), "newest" (most recently created).relevance
tagsNoFilter results to questions with all specified tags.
queryYesFull-text search query (e.g. "python async generator send value").
minScoreNoMinimum question score — excludes questions with lower scores. Setting minScore orders results by score (votes), which may differ from the requested sort.
pageSizeNoNumber of results to return (1–30, default 10).
acceptedOnlyNoWhen true, return only questions that have an accepted answer.

Output Schema

NameRequiredDescriptionDefault
capNoThe pageSize cap applied to this request.
pageNoThe 1-based page these results came from — 1 when the input omitted page.
errorNoPresent when the call failed. Absent on success.
shownNoNumber of results returned.
noticeNoActionable guidance when results are empty or filtered.
quotaMaxNoMaximum API quota calls per day (300 keyless, ~10,000 with API key).
questionsNoQuestions matching the search query, ordered by the specified sort.
truncatedNoTrue when results were capped at pageSize.
appliedSortNoSort Stack Exchange applied to these results.
attributionNoContent license notice. Stack Exchange content is licensed under CC BY-SA 4.0 and requires attribution.
quotaRemainingNoRemaining API quota calls for the current day.
sortOverrideReasonNoPresent only when appliedSort differs from the requested sort; says why.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / site / description
      Previous value: -"Stack Exchange site to search — use the api_site_parameter value (e.g. \"stackoverflow\", \"superuser\", \"serverfault\"). Defaults to \"stackoverflow\". Call stackexchange_list_sites to discover valid values."New value: +"Stack Exchange site to search — the api_site_parameter (e.g. \"stackoverflow\", \"superuser\", \"serverfault\") or the site's domain (e.g. \"serverfault.com\"). Defaults to \"stackoverflow\". Call stackexchange_list_sites to discover valid values."
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "questions",
      -      "page",
      -      "attribution",
      -      "quotaRemaining",
      -      "quotaMax"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "questions",
      +      "page",
      +      "attribution",
      +      "quotaRemaining",
      +      "quotaMax",
      +      "appliedSort"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / appliedSort
      Added value: +{
      +  "description": "Sort Stack Exchange applied to these results.",
      +  "enum": [
      +    "relevance",
      +    "votes",
      +    "activity",
      +    "newest"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_parameter`: Stack Exchange rejected a request parameter and named the field rather than reporting a bad site. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. `paging_depth_limit`: Stack Exchange refused the requested page because paging above page 25 needs a key. `invalid_api_key`: Stack Exchange does not recognize the API key this server is configured with. `upstream_unavailable`: Stack Exchange answered with a body that is not the expected JSON envelope. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_parameter`: Stack Exchange rejected a request parameter and named the field rather than reporting a bad site. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. `throttled`: Stack Exchange is throttling this server's IP address, or its backoff window outlasts what the call can wait. `pacer_shed`: The call would wait in this server's queue to Stack Exchange longer than its time budget allows. `paging_depth_limit`: Stack Exchange refused the requested page because paging above page 25 needs a key. `invalid_api_key`: Stack Exchange does not recognize the API key this server is configured with. `upstream_unavailable`: Stack Exchange reported itself temporarily unavailable or failing internally, or answered with a body that is not the expected JSON envelope. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "invalid_site",
      -  "invalid_parameter",
      -  "quota_exceeded",
      -  "paging_depth_limit",
      -  "invalid_api_key",
      -  "upstream_unavailable"
      -]New value: +[
      +  "invalid_site",
      +  "invalid_parameter",
      +  "quota_exceeded",
      +  "throttled",
      +  "pacer_shed",
      +  "paging_depth_limit",
      +  "invalid_api_key",
      +  "upstream_unavailable"
      +]
    • addedOutput schema / properties / sortOverrideReason
      Added value: +{
      +  "description": "Present only when appliedSort differs from the requested sort; says why.",
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • changedOutput schema / properties / questions / items / properties / excerpt / description
      Previous value: -"Opening prose of the question body, trimmed to roughly 300 characters and ending in \"…\" when cut. Code blocks are omitted; absent when the question body is nothing but code."New value: +"Opening prose of the question body, trimmed to roughly 300 characters and ending in \"…\" when cut. Code blocks and markdown structure are omitted; absent when the question body is nothing but code."
  3. Changed6 schema fields changed
    • addedInput schema / properties / page
      Added value: +{
      +  "default": 1,
      +  "description": "Page of results to return, 1-based (default 1). Page 2 with pageSize 10 returns results 11–20. Each page is a separate upstream call and costs one API quota unit, which matters on the keyless 300/day tier. Without STACKEXCHANGE_API_KEY, Stack Exchange refuses any page above 25.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "questions",
      -      "attribution",
      -      "quotaRemaining",
      -      "quotaMax"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "questions",
      +      "page",
      +      "attribution",
      +      "quotaRemaining",
      +      "quotaMax"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_parameter`: Stack Exchange rejected a request parameter and named the field rather than reporting a bad site. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_parameter`: Stack Exchange rejected a request parameter and named the field rather than reporting a bad site. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. `paging_depth_limit`: Stack Exchange refused the requested page because paging above page 25 needs a key. `invalid_api_key`: Stack Exchange does not recognize the API key this server is configured with. `upstream_unavailable`: Stack Exchange answered with a body that is not the expected JSON envelope. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "invalid_site",
      -  "invalid_parameter",
      -  "quota_exceeded"
      -]New value: +[
      +  "invalid_site",
      +  "invalid_parameter",
      +  "quota_exceeded",
      +  "paging_depth_limit",
      +  "invalid_api_key",
      +  "upstream_unavailable"
      +]
    • addedOutput schema / properties / page
      Added value: +{
      +  "description": "The 1-based page these results came from — 1 when the input omitted page.",
      +  "maximum": 9007199254740991,
      +  "minimum": -9007199254740991,
      +  "type": "integer"
      +}
    • changedOutput schema / properties / questions / items / properties / excerpt / description
      Previous value: -"Short text excerpt from the question when available."New value: +"Opening prose of the question body, trimmed to roughly 300 characters and ending in \"…\" when cut. Code blocks are omitted; absent when the question body is nothing but code."
  4. Changed5 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_parameter`: Stack Exchange rejected a request parameter and named the field rather than reporting a bad site. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "invalid_site",
      -  "quota_exceeded"
      -]New value: +[
      +  "invalid_site",
      +  "invalid_parameter",
      +  "quota_exceeded"
      +]
    • changedOutput schema / properties / questions / items / description
      Previous value: -"A Stack Exchange question with score, answer count, tags, and optional excerpt."New value: +"A Stack Exchange question with score, answer count, tags, dates, and optional excerpt."
    • addedOutput schema / properties / questions / items / properties / creationDate
      Added value: +{
      +  "description": "ISO 8601 timestamp of when the question was asked — use it to judge whether the advice is still current.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / questions / items / properties / lastActivityDate
      Added value: +{
      +  "description": "ISO 8601 timestamp of the most recent activity on the question (edit, answer, or comment).",
      +  "type": "string"
      +}
  5. 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": [
      +      "questions",
      +      "attribution",
      +      "quotaRemaining",
      +      "quotaMax"
      +    ]
      +  },
      +  {
      +    "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. Declared by this tool: `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "invalid_site",
      +            "quota_exceeded"
      +          ],
      +          "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: -[
      -  "questions",
      -  "attribution",
      -  "quotaRemaining",
      -  "quotaMax"
      -]
  6. Changed1 schema field changed
    • changedInput schema / properties / minScore / description
      Previous value: -"Minimum question score — excludes questions with lower scores."New value: +"Minimum question score — excludes questions with lower scores. Setting minScore orders results by score (votes), which may differ from the requested sort."
  7. Changed3 schema fields changed
    • addedOutput schema / properties / cap
      Added value: +{
      +  "description": "The pageSize cap applied to this request.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / shown
      Added value: +{
      +  "description": "Number of results returned.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "True when results were capped at pageSize.",
      +  "type": "boolean"
      +}
  8. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint, so the safety profile is covered. The description adds genuinely non-obvious behavior: results are ranked, bodies are excerpted rather than full, and pagination beyond the pageSize cap requires the page parameter. It stops short of restating quota/cost behavior, which the schema already carries, so a 4 rather than a 5.

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, front-loaded with purpose, then return shape, then workflow and pagination. No filler and no repetition of structured fields.

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, so return values need only light framing, and the description supplies exactly that plus the follow-up tool. With annotations covering safety and a fully documented 8-parameter schema, an agent has everything needed to select and invoke this tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description nonetheless adds cross-parameter meaning by framing `site` as community targeting with example values and `page` as the escape hatch past the pageSize cap. It does not touch sort, tags, minScore or acceptedOnly, but those are fully documented in the schema.

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 ("Search questions across a Stack Exchange site") and immediately bounds scope with what is returned and what is not ("a short excerpt of the question body — not the full body"). It also names the sibling that continues the workflow (stackexchange_get_thread), so the tool is distinguishable without opening any schema.

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?

Explicit routing guidance: use search to obtain question_id values, then call stackexchange_get_thread for full bodies and answers; call stackexchange_list_sites to discover valid site values. It also tells the agent what to do when results are truncated ("Results past the pageSize cap are reachable with the `page` parameter").

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.