stackexchange-mcp-server

Search Stack Exchange questions, fetch Q&A threads as markdown, look up tag FAQs and user profiles.

我该使用它吗

质量与安全性

A
描述质量
100%
模式完整度
98%
命名质量
80%
投毒风险
80%
权限匹配度
100%
协议合规性
100%

发现(2)

  • HIGHTool poisoning patterns detected
  • MEDIUMTool description contains URL to non-standard domain在 stackexchange_get_thread 中

基于对工具定义和协议合规性的自动分析。

上下文开销

~7,215token 数(工具定义)
~17.6 KB典型响应大小
对注意力有显著影响(占 128k 上下文窗口的 5.64%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "stackexchange-mcp-server": {
      "command": "bun",
      "args": [
        "@cyanheads/stackexchange-mcp-server"
      ]
    }
  }
}

可运行的软件包

npm@cyanheads/stackexchange-mcp-server0.1.15streamable-http

远程端点

https://stackexchange.caseyjhand.com/mcpstreamable-http

它能做什么

工具清单

工具(5)

🟢 只读🟡 写入🔴 删除⚪ 未知
🟢stackexchange_list_sites(filter)

Enumerate all sites in the Stack Exchange network — name, api_site_parameter, audience, and URL. The api_site_parameter value is what other tools accept as the `site` input (e.g. "stackoverflow", "superuser", "serverfault"). Results are fetched live and optionally filtered by name. Use this tool to discover valid site parameters before calling other stackexchange_* tools.

输入模式

{
  "type": "object",
  "properties": {
    "filter": {
      "description": "Optional case-insensitive name filter — returns only sites whose name contains all provided tokens. Omit to return all sites.",
      "type": "string"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

输出模式

{
  "type": "object",
  "properties": {
    "sites": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Human-readable site name (e.g. \"Stack Overflow\")."
          },
          "apiSiteParameter": {
            "type": "string",
            "description": "Value to pass as the `site` parameter on all other stackexchange_* tools (e.g. \"stackoverflow\")."
          },
          "siteUrl": {
            "type": "string",
            "description": "Public URL of the site."
          },
          "audience": {
            "description": "Intended audience description when provided by the API.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "apiSiteParameter",
          "siteUrl"
        ],
        "additionalProperties": false,
        "description": "A Stack Exchange network site entry."
      },
      "description": "Stack Exchange network sites matching the optional name filter."
    },
    "totalCount": {
      "type": "number",
      "description": "Total number of sites returned after filtering."
    },
    "quotaRemaining": {
      "type": "number",
      "description": "Remaining API quota calls for the current day."
    },
    "quotaMax": {
      "type": "number",
      "description": "Maximum API quota calls per day (300 keyless, ~10,000 with API key)."
    },
    "notice": {
      "description": "Actionable guidance when results are empty or filtered.",
      "type": "string"
    },
    "error": {
      "description": "Present when the call failed. Absent on success.",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "JSON-RPC error code for this failure."
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of what went wrong."
        },
        "data": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "string",
              "description": "Machine-readable failure mode. Declared by this tool: `quota_exceeded`: The Stack Exchange API quota_remaining reached 0 during the site page walk. `invalid_parameter`: Stack Exchange rejected a parameter of the /sites request and named the field. `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.",
              "examples": [
                "quota_exceeded",
                "invalid_parameter",
                "invalid_api_key",
                "upstream_unavailable"
              ]
            },
            "recovery": {
              "description": "Actionable next step for the caller.",
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "hint"
              ],
              "additionalProperties": {}
            },
            "retryable": {
              "description": "Whether retrying may succeed.",
              "type": "boolean"
            }
          },
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "anyOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "required": [
        "sites",
        "totalCount",
        "quotaRemaining",
        "quotaMax"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
🟢stackexchange_search_questions(query, site, tags, acceptedOnly, minScore, ...)

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.

输入模式

{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Full-text search query (e.g. \"python async generator send value\")."
    },
    "site": {
      "default": "stackoverflow",
      "description": "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.",
      "type": "string"
    },
    "tags": {
      "description": "Filter results to questions with all specified tags.",
      "type": "array",
      "items": {
        "type": "string",
        "description": "A single tag to filter by (e.g. \"python\", \"async\")."
      }
    },
    "acceptedOnly": {
      "description": "When true, return only questions that have an accepted answer.",
      "type": "boolean"
    },
    "minScore": {
      "description": "Minimum question score — excludes questions with lower scores. Setting minScore orders results by score (votes), which may differ from the requested sort.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "sort": {
      "default": "relevance",
      "description": "Result ordering: \"relevance\" (default, best match), \"votes\" (highest score first), \"activity\" (most recently active), \"newest\" (most recently created).",
      "type": "string",
      "enum": [
        "relevance",
        "votes",
        "activity",
        "newest"
      ]
    },
    "pageSize": {
      "default": 10,
      "description": "Number of results to return (1–30, default 10).",
      "type": "integer",
      "minimum": 1,
      "maximum": 30
    },
    "page": {
      "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.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "query"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

输出模式

{
  "type": "object",
  "properties": {
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "questionId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Question ID — pass to stackexchange_get_thread to fetch the full thread."
          },
          "title": {
            "type": "string",
            "description": "Question title."
          },
          "link": {
            "type": "string",
            "description": "Direct URL to the question."
          },
          "score": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Question score (upvotes minus downvotes)."
          },
          "answerCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Total number of answers."
          },
          "isAnswered": {
            "type": "boolean",
            "description": "True when the question has an accepted answer or at least one positively-scored answer."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "A tag applied to this question."
            },
            "description": "Tags applied to this question."
          },
          "excerpt": {
            "description": "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.",
            "type": "string"
          },
          "creationDate": {
            "description": "ISO 8601 timestamp of when the question was asked — use it to judge whether the advice is still current.",
            "type": "string"
          },
          "lastActivityDate": {
            "description": "ISO 8601 timestamp of the most recent activity on the question (edit, answer, or comment).",
            "type": "string"
          }
        },
        "required": [
          "questionId",
          "title",
          "link",
          "score",
          "answerCount",
          "isAnswered",
          "tags"
        ],
        "additionalProperties": false,
        "description": "A Stack Exchange question with score, answer count, tags, dates, and optional excerpt."
      },
      "description": "Questions matching the search query, ordered by the specified sort."
    },
    "page": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "The 1-based page these results came from — 1 when the input omitted page."
    },
    "attribution": {
      "type": "string",
      "description": "Content license notice. Stack Exchange content is licensed under CC BY-SA 4.0 and requires attribution."
    },
    "quotaRemaining": {
      "type": "number",
      "description": "Remaining API quota calls for the current day."
    },
    "quotaMax": {
      "type": "number",
      "description": "Maximum API quota calls per day (300 keyless, ~10,000 with API key)."
    },
    "truncated": {
      "description": "True when results were capped at pageSize.",
      "type": "boolean"
    },
    "shown": {
      "description": "Number of results returned.",
      "type": "number"
    },
    "cap": {
      "description": "The pageSize cap applied to this request.",
      "type": "number"
    },
    "notice": {
      "description": "Actionable guidance when results are empty or filtered.",
      "type": "string"
    },
    "error": {
      "description": "Present when the call failed. Absent on success.",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "JSON-RPC error code for this failure."
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of what went wrong."
        },
        "data": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "string",
              "description": "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.",
              "examples": [
                "invalid_site",
                "invalid_parameter",
                "quota_exceeded",
                "paging_depth_limit",
                "invalid_api_key",
                "upstream_unavailable"
              ]
            },
            "recovery": {
              "description": "Actionable next step for the caller.",
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "hint"
              ],
              "additionalProperties": {}
            },
            "retryable": {
              "description": "Whether retrying may succeed.",
              "type": "boolean"
            }
          },
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "anyOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "required": [
        "questions",
        "page",
        "attribution",
        "quotaRemaining",
        "quotaMax"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
🟢stackexchange_get_tag_faq(tag, site, pageSize, page)

Fetch the highest-voted answered questions for a tag on a Stack Exchange site — the canonical "best answers in X" list. Returns a question list without bodies; use stackexchange_get_thread to read the full body and answers for any result. Results past the pageSize cap are reachable with the `page` parameter. Use this tool to find the authoritative community resources on a topic (e.g. tag "javascript" on stackoverflow). Use stackexchange_search_questions for free-text search rather than tag-based browsing.

输入模式

{
  "type": "object",
  "properties": {
    "tag": {
      "type": "string",
      "description": "Tag to look up (e.g. \"python\", \"javascript\", \"docker\"). Must match exactly."
    },
    "site": {
      "default": "stackoverflow",
      "description": "Stack Exchange site — use the api_site_parameter value (e.g. \"stackoverflow\", \"superuser\"). Defaults to \"stackoverflow\". Call stackexchange_list_sites to discover valid values.",
      "type": "string"
    },
    "pageSize": {
      "default": 10,
      "description": "Number of results to return (1–30, default 10).",
      "type": "integer",
      "minimum": 1,
      "maximum": 30
    },
    "page": {
      "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.",
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "tag"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

输出模式

{
  "type": "object",
  "properties": {
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "questionId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Question ID — pass to stackexchange_get_thread to fetch the full thread."
          },
          "title": {
            "type": "string",
            "description": "Question title."
          },
          "link": {
            "type": "string",
            "description": "Direct URL to the question."
          },
          "score": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Question score (upvotes minus downvotes)."
          },
          "answerCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Total number of answers."
          },
          "isAnswered": {
            "type": "boolean",
            "description": "True when the question has an accepted answer or at least one positively-scored answer."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "A tag applied to this question."
            },
            "description": "Tags applied to this question."
          },
          "creationDate": {
            "description": "ISO 8601 timestamp of when the question was asked — use it to judge whether the advice is still current.",
            "type": "string"
          },
          "lastActivityDate": {
            "description": "ISO 8601 timestamp of the most recent activity on the question (edit, answer, or comment).",
            "type": "string"
          }
        },
        "required": [
          "questionId",
          "title",
          "link",
          "score",
          "answerCount",
          "isAnswered",
          "tags"
        ],
        "additionalProperties": false,
        "description": "A Stack Exchange FAQ question with score, answer count, tags, and dates."
      },
      "description": "Highest-voted answered questions for the specified tag, ordered by votes."
    },
    "tag": {
      "type": "string",
      "description": "Tag name used for this FAQ lookup."
    },
    "site": {
      "type": "string",
      "description": "Stack Exchange site api_site_parameter used for this lookup."
    },
    "page": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "The 1-based page these results came from — 1 when the input omitted page."
    },
    "attribution": {
      "type": "string",
      "description": "Content license notice. Stack Exchange content is licensed under CC BY-SA 4.0 and requires attribution."
    },
    "quotaRemaining": {
      "type": "number",
      "description": "Remaining API quota calls for the current day."
    },
    "quotaMax": {
      "type": "number",
      "description": "Maximum API quota calls per day (300 keyless, ~10,000 with API key)."
    },
    "truncated": {
      "description": "True when results were capped at pageSize.",
      "type": "boolean"
    },
    "shown": {
      "description": "Number of results returned.",
      "type": "number"
    },
    "cap": {
      "description": "The pageSize cap applied to this request.",
      "type": "number"
    },
    "notice": {
      "description": "Actionable guidance when results are empty or filtered.",
      "type": "string"
    },
    "error": {
      "description": "Present when the call failed. Absent on success.",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "JSON-RPC error code for this failure."
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of what went wrong."
        },
        "data": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "string",
              "description": "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.",
              "examples": [
                "invalid_site",
                "invalid_parameter",
                "quota_exceeded",
                "paging_depth_limit",
                "invalid_api_key",
                "upstream_unavailable"
              ]
            },
            "recovery": {
              "description": "Actionable next step for the caller.",
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "hint"
              ],
              "additionalProperties": {}
            },
            "retryable": {
              "description": "Whether retrying may succeed.",
              "type": "boolean"
            }
          },
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "anyOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "required": [
        "questions",
        "tag",
        "site",
        "page",
        "attribution",
        "quotaRemaining",
        "quotaMax"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
🟢stackexchange_get_user(userId, site)

Fetch a Stack Exchange user profile by numeric user ID: reputation, badge counts, answer and question counts, account and last-access dates, and top tags by answer score. Useful for credibility context on an answer author — pass the authorUserId from any question or answer in stackexchange_get_thread output. Returns profile fields plus up to 10 top tags by answer score.

输入模式

{
  "type": "object",
  "properties": {
    "userId": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Numeric user ID (at most 2147483647) — use the authorUserId field from a question or answer in stackexchange_get_thread output."
    },
    "site": {
      "default": "stackoverflow",
      "description": "Stack Exchange site — use the api_site_parameter value (e.g. \"stackoverflow\", \"superuser\"). Defaults to \"stackoverflow\". Call stackexchange_list_sites to discover valid values.",
      "type": "string"
    }
  },
  "required": [
    "userId"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

输出模式

{
  "type": "object",
  "properties": {
    "userId": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Numeric user ID on this Stack Exchange site."
    },
    "displayName": {
      "type": "string",
      "description": "Display name shown on the site."
    },
    "link": {
      "type": "string",
      "description": "Direct URL to the user profile."
    },
    "reputation": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "User reputation score."
    },
    "badgeCounts": {
      "description": "Badge counts when provided by the API.",
      "type": "object",
      "properties": {
        "gold": {
          "description": "Number of gold badges.",
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "silver": {
          "description": "Number of silver badges.",
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "bronze": {
          "description": "Number of bronze badges.",
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        }
      },
      "additionalProperties": false
    },
    "location": {
      "description": "User-provided location string when available.",
      "type": "string"
    },
    "websiteUrl": {
      "description": "User-provided website URL when available.",
      "type": "string"
    },
    "answerCount": {
      "description": "Total number of answers posted when provided by the API.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "questionCount": {
      "description": "Total number of questions posted when provided by the API.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "creationDate": {
      "description": "ISO 8601 timestamp of when the account was created — the account age.",
      "type": "string"
    },
    "lastAccessDate": {
      "description": "ISO 8601 timestamp of the last time the user accessed the site — a stale value means the author is unlikely to respond.",
      "type": "string"
    },
    "topTags": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "tagName": {
            "type": "string",
            "description": "Tag name."
          },
          "answerCount": {
            "description": "Number of answers in this tag.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "answerScore": {
            "description": "Total answer score in this tag.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "tagName"
        ],
        "additionalProperties": false,
        "description": "A tag the user has answered in, with answer count and score."
      },
      "description": "Top tags by answer score (up to 10). Empty array for new users with no answers."
    },
    "quotaRemaining": {
      "type": "number",
      "description": "Remaining API quota calls for the current day."
    },
    "quotaMax": {
      "type": "number",
      "description": "Maximum API quota calls per day (300 keyless, ~10,000 with API key)."
    },
    "error": {
      "description": "Present when the call failed. Absent on success.",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "JSON-RPC error code for this failure."
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of what went wrong."
        },
        "data": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "string",
              "description": "Machine-readable failure mode. Declared by this tool: `user_not_found`: The user lookup returns an empty result set — SE returns HTTP 200 with no items for unknown user IDs rather than 404. `invalid_user_id`: userId is above 2147483647 — Stack Exchange user IDs are 32-bit signed integers. `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. `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.",
              "examples": [
                "user_not_found",
                "invalid_user_id",
                "invalid_site",
                "invalid_parameter",
                "quota_exceeded",
                "invalid_api_key",
                "upstream_unavailable"
              ]
            },
            "recovery": {
              "description": "Actionable next step for the caller.",
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "hint"
              ],
              "additionalProperties": {}
            },
            "retryable": {
              "description": "Whether retrying may succeed.",
              "type": "boolean"
            }
          },
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "anyOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "required": [
        "userId",
        "displayName",
        "link",
        "reputation",
        "topTags",
        "quotaRemaining",
        "quotaMax"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
🟢stackexchange_get_thread(questionIdOrUrl, site, maxAnswers, includeComments)

Fetch a complete Q&A thread — question body and all answers, accepted answer first then sorted by score, rendered as clean markdown with fenced code blocks. Accepts an integer question ID or a full Stack Exchange question URL (e.g. "https://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster" or "11227809"). HTML is normalized to markdown automatically; attribution (author + link) included per CC BY-SA 4.0. Get question IDs from stackexchange_search_questions or stackexchange_get_tag_faq.

输入模式

{
  "type": "object",
  "properties": {
    "questionIdOrUrl": {
      "type": "string",
      "description": "Numeric question ID (e.g. \"11227809\") or a full Stack Exchange question URL (e.g. \"https://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster\"). The integer immediately following /questions/ is extracted from URLs."
    },
    "site": {
      "default": "stackoverflow",
      "description": "Stack Exchange site — use the api_site_parameter value (e.g. \"stackoverflow\", \"superuser\"). Defaults to \"stackoverflow\". Must match the site where the question lives. Call stackexchange_list_sites to discover valid values.",
      "type": "string"
    },
    "maxAnswers": {
      "default": 10,
      "description": "Maximum number of answers to include (1–100, default 10). Answers are sorted: accepted first, then by score.",
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "includeComments": {
      "default": false,
      "description": "Fetch the comment thread under the question and under every returned answer (default false). Comments are where a stale answer usually gets corrected (\"this breaks on v3\", \"use X instead now\"), so set this when the answer's continued accuracy matters. Costs 2 extra API calls against the daily quota regardless of how many answers are returned.",
      "type": "boolean"
    }
  },
  "required": [
    "questionIdOrUrl"
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false
}

输出模式

{
  "type": "object",
  "properties": {
    "questionId": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Numeric question ID — identifies this thread on the site."
    },
    "title": {
      "type": "string",
      "description": "Question title."
    },
    "link": {
      "type": "string",
      "description": "Direct URL to the question."
    },
    "score": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Question score (upvotes minus downvotes)."
    },
    "answerCount": {
      "description": "Total answers the question has upstream. When greater than the returned answers[] length, more answers exist — raise maxAnswers to fetch them.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "A tag applied to this question."
      },
      "description": "Tags applied to this question."
    },
    "bodyMarkdown": {
      "type": "string",
      "description": "Question body normalized from HTML to markdown."
    },
    "authorName": {
      "description": "Question author display name when available.",
      "type": "string"
    },
    "authorLink": {
      "description": "Question author profile URL when available.",
      "type": "string"
    },
    "authorUserId": {
      "description": "Question author numeric user ID when available — pass to stackexchange_get_user to fetch the full profile.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "acceptedAnswerId": {
      "description": "ID of the accepted answer when one exists.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "creationDate": {
      "description": "ISO 8601 timestamp of when the question was asked — use it to judge whether the advice is still current.",
      "type": "string"
    },
    "lastActivityDate": {
      "description": "ISO 8601 timestamp of the most recent activity on the question (edit, answer, or comment).",
      "type": "string"
    },
    "comments": {
      "description": "Comments on the question, newest first, present only when includeComments is true. An empty array means this post has no comments; an absent array means its comment state is unknown — either comments were not requested, or the batched fetch was cut short before this post contributed any. Never read an absent array as \"no comments\".",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "commentId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Numeric comment ID."
          },
          "score": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Comment score — comments can score below zero."
          },
          "bodyMarkdown": {
            "type": "string",
            "description": "Comment body normalized from HTML to markdown."
          },
          "authorName": {
            "description": "Comment author display name when available.",
            "type": "string"
          },
          "authorLink": {
            "description": "Comment author profile URL when available.",
            "type": "string"
          },
          "creationDate": {
            "description": "ISO 8601 timestamp of when the comment was posted — the newest comments carry the freshest corrections.",
            "type": "string"
          }
        },
        "required": [
          "commentId",
          "score",
          "bodyMarkdown"
        ],
        "additionalProperties": false,
        "description": "A single comment with markdown body, score, date, and author attribution."
      }
    },
    "commentsTruncated": {
      "description": "True when the question's comments[] is a partial list — more exist upstream than were returned.",
      "type": "boolean"
    },
    "answers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "answerId": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Numeric answer ID."
          },
          "score": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Answer score (upvotes minus downvotes)."
          },
          "isAccepted": {
            "type": "boolean",
            "description": "True when this is the accepted answer."
          },
          "bodyMarkdown": {
            "type": "string",
            "description": "Answer body normalized from HTML to markdown."
          },
          "authorName": {
            "description": "Answer author display name when available.",
            "type": "string"
          },
          "authorLink": {
            "description": "Answer author profile URL when available.",
            "type": "string"
          },
          "authorReputation": {
            "description": "Answer author reputation when available.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "authorUserId": {
            "description": "Answer author numeric user ID when available — pass to stackexchange_get_user to fetch the full profile.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "creationDate": {
            "description": "ISO 8601 timestamp of when the answer was posted — an old answer may predate the current API.",
            "type": "string"
          },
          "lastActivityDate": {
            "description": "ISO 8601 timestamp of the most recent edit or activity on the answer.",
            "type": "string"
          },
          "comments": {
            "description": "Comments on this answer, newest first, present only when includeComments is true. An empty array means this post has no comments; an absent array means its comment state is unknown — either comments were not requested, or the batched fetch was cut short before this post contributed any. Never read an absent array as \"no comments\".",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "commentId": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Numeric comment ID."
                },
                "score": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Comment score — comments can score below zero."
                },
                "bodyMarkdown": {
                  "type": "string",
                  "description": "Comment body normalized from HTML to markdown."
                },
                "authorName": {
                  "description": "Comment author display name when available.",
                  "type": "string"
                },
                "authorLink": {
                  "description": "Comment author profile URL when available.",
                  "type": "string"
                },
                "creationDate": {
                  "description": "ISO 8601 timestamp of when the comment was posted — the newest comments carry the freshest corrections.",
                  "type": "string"
                }
              },
              "required": [
                "commentId",
                "score",
                "bodyMarkdown"
              ],
              "additionalProperties": false,
              "description": "A single comment with markdown body, score, date, and author attribution."
            }
          },
          "commentsTruncated": {
            "description": "True when this answer's comments[] is a partial list — more exist upstream than were returned.",
            "type": "boolean"
          }
        },
        "required": [
          "answerId",
          "score",
          "isAccepted",
          "bodyMarkdown"
        ],
        "additionalProperties": false,
        "description": "A single Q&A answer with markdown body, score, dates, and author attribution."
      },
      "description": "Answers sorted: accepted answer first, then by score descending."
    },
    "quotaRemaining": {
      "type": "number",
      "description": "Remaining API quota calls for the current day."
    },
    "quotaMax": {
      "type": "number",
      "description": "Maximum API quota calls per day (300 keyless, ~10,000 with API key)."
    },
    "truncated": {
      "description": "True when answers were capped at maxAnswers.",
      "type": "boolean"
    },
    "shown": {
      "description": "Number of answers returned.",
      "type": "number"
    },
    "cap": {
      "description": "The maxAnswers cap applied to this request.",
      "type": "number"
    },
    "commentsCap": {
      "description": "Maximum comments carried per post — a post at this count reports commentsTruncated.",
      "type": "number"
    },
    "error": {
      "description": "Present when the call failed. Absent on success.",
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "JSON-RPC error code for this failure."
        },
        "message": {
          "type": "string",
          "description": "Human-readable description of what went wrong."
        },
        "data": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "string",
              "description": "Machine-readable failure mode. Declared by this tool: `question_not_found`: The question lookup returns an empty result set — SE returns HTTP 200 with no items for unknown question IDs rather than 404. `invalid_site`: The provided site value is not a valid Stack Exchange network site identifier. `invalid_id_or_url`: The input is not a parseable integer ID and not a recognizable SE question URL. `invalid_parameter`: Stack Exchange rejected a request parameter other than the question ID, and named the field. `quota_exceeded`: The Stack Exchange API quota_remaining has reached 0. `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.",
              "examples": [
                "question_not_found",
                "invalid_site",
                "invalid_id_or_url",
                "invalid_parameter",
                "quota_exceeded",
                "invalid_api_key",
                "upstream_unavailable"
              ]
            },
            "recovery": {
              "description": "Actionable next step for the caller.",
              "type": "object",
              "properties": {
                "hint": {
                  "type": "string"
                }
              },
              "required": [
                "hint"
              ],
              "additionalProperties": {}
            },
            "retryable": {
              "description": "Whether retrying may succeed.",
              "type": "boolean"
            }
          },
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message"
      ],
      "additionalProperties": {}
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "anyOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "required": [
        "questionId",
        "title",
        "link",
        "score",
        "tags",
        "bodyMarkdown",
        "answers",
        "quotaRemaining",
        "quotaMax"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}

社区

评价此服务器

证据

最近观测

已验证未记录版本5 个工具
已验证未记录版本5 个工具