{"url_pattern":"^https?://stackoverflow\\.com(/.*)?$","site_name":"stackoverflow","allowed_domains":["api.stackexchange.com","example.com","stackoverflow.com"],"tools":[{"name":"stackoverflow_bounties","description":"Active bounties on Stack Overflow","inputSchema":{"type":"object","properties":{"limit":{"type":"number","description":"Max number of results","default":10}},"required":null},"handler":"(params) => {\n  const args = Object.assign({\"limit\": 10}, params || {});\n  let data = null;\n  let __wbContextUrl = globalThis.location?.href || '';\n  let __wbContextDocument = globalThis.document || null;\n    const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);\n    const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');\n    const __wbGet = (value, path) => {\n      if (!path) return value;\n      return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);\n    };\n    const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');\n    const __wbResolve = (target, base) => {\n      if (target == null) return '';\n      const text = String(target);\n      try {\n        return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();\n      } catch (_error) {\n        return text;\n      }\n    };\n    const __wbFetch = async (target, options) => {\n      const url = __wbResolve(target, __wbBaseUrl());\n      const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));\n      if (!resp.ok) {\n        throw new Error(`HTTP ${resp.status} for ${url}`);\n      }\n      const text = await resp.text();\n      try {\n        return { url, text, data: JSON.parse(text) };\n      } catch (_error) {\n        return { url, text, data: text };\n      }\n    };\n  return (async () => {\n    {\n      const __wbResp = await __wbFetch(\"https://api.stackexchange.com/2.3/questions/featured?order=desc&sort=activity&site=stackoverflow\");\n      data = __wbResp.data;\n    }\n    data = __wbGet(data, \"items\");\n    {\n      const source = Array.isArray(data) ? data : (data == null ? [] : [data]);\n      data = source.map((item, index) => ({\n        \"title\": item.title,\n        \"bounty\": item.bounty_amount,\n        \"score\": item.score,\n        \"answers\": item.answer_count,\n        \"url\": item.link,\n      }));\n    }\n    if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);\n    return data;\n  })();\n}"},{"name":"stackoverflow_hot","description":"Hot Stack Overflow questions","inputSchema":{"type":"object","properties":{"limit":{"type":"number","description":"Max number of results","default":10}},"required":null},"handler":"(params) => {\n  const args = Object.assign({\"limit\": 10}, params || {});\n  let data = null;\n  let __wbContextUrl = globalThis.location?.href || '';\n  let __wbContextDocument = globalThis.document || null;\n    const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);\n    const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');\n    const __wbGet = (value, path) => {\n      if (!path) return value;\n      return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);\n    };\n    const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');\n    const __wbResolve = (target, base) => {\n      if (target == null) return '';\n      const text = String(target);\n      try {\n        return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();\n      } catch (_error) {\n        return text;\n      }\n    };\n    const __wbFetch = async (target, options) => {\n      const url = __wbResolve(target, __wbBaseUrl());\n      const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));\n      if (!resp.ok) {\n        throw new Error(`HTTP ${resp.status} for ${url}`);\n      }\n      const text = await resp.text();\n      try {\n        return { url, text, data: JSON.parse(text) };\n      } catch (_error) {\n        return { url, text, data: text };\n      }\n    };\n  return (async () => {\n    {\n      const __wbResp = await __wbFetch(\"https://api.stackexchange.com/2.3/questions?order=desc&sort=hot&site=stackoverflow\");\n      data = __wbResp.data;\n    }\n    data = __wbGet(data, \"items\");\n    {\n      const source = Array.isArray(data) ? data : (data == null ? [] : [data]);\n      data = source.map((item, index) => ({\n        \"title\": item.title,\n        \"score\": item.score,\n        \"answers\": item.answer_count,\n        \"url\": item.link,\n      }));\n    }\n    if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);\n    return data;\n  })();\n}"},{"name":"stackoverflow_search","description":"Search Stack Overflow questions","inputSchema":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"count":{"type":"string","description":"Number of results (default 10, max 50)"}},"required":["query"]},"handler":"(params) => {\n  const run = async function(args) {\n\n      if (!args.query) return {error: 'Missing argument: query', hint: 'Provide a search query string'};\n      const count = Math.min(parseInt(args.count) || 10, 50);\n      const url = 'https://api.stackexchange.com/2.3/search?order=desc&sort=relevance&intitle='\n        + encodeURIComponent(args.query)\n        + '&site=stackoverflow&pagesize=' + count;\n      const resp = await fetch(url);\n      if (!resp.ok) return {error: 'HTTP ' + resp.status};\n      const data = await resp.json();\n      if (data.error_id) return {error: data.error_name, message: data.error_message};\n      const items = data.items || [];\n      return {\n        query: args.query,\n        count: items.length,\n        has_more: data.has_more,\n        quota_remaining: data.quota_remaining,\n        questions: items.map(q => ({\n          id: q.question_id,\n          title: q.title,\n          url: q.link,\n          score: q.score,\n          answers: q.answer_count,\n          views: q.view_count,\n          tags: q.tags,\n          author: q.owner?.display_name,\n          is_answered: q.is_answered,\n          created: q.creation_date,\n          last_activity: q.last_activity_date\n        }))\n      };\n  };\n  return run(params || {});\n}"},{"name":"stackoverflow_unanswered","description":"Top voted unanswered questions on Stack Overflow","inputSchema":{"type":"object","properties":{"limit":{"type":"number","description":"Max number of results","default":10}},"required":null},"handler":"(params) => {\n  const args = Object.assign({\"limit\": 10}, params || {});\n  let data = null;\n  let __wbContextUrl = globalThis.location?.href || '';\n  let __wbContextDocument = globalThis.document || null;\n    const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);\n    const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');\n    const __wbGet = (value, path) => {\n      if (!path) return value;\n      return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);\n    };\n    const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');\n    const __wbResolve = (target, base) => {\n      if (target == null) return '';\n      const text = String(target);\n      try {\n        return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();\n      } catch (_error) {\n        return text;\n      }\n    };\n    const __wbFetch = async (target, options) => {\n      const url = __wbResolve(target, __wbBaseUrl());\n      const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));\n      if (!resp.ok) {\n        throw new Error(`HTTP ${resp.status} for ${url}`);\n      }\n      const text = await resp.text();\n      try {\n        return { url, text, data: JSON.parse(text) };\n      } catch (_error) {\n        return { url, text, data: text };\n      }\n    };\n  return (async () => {\n    {\n      const __wbResp = await __wbFetch(\"https://api.stackexchange.com/2.3/questions/unanswered?order=desc&sort=votes&site=stackoverflow\");\n      data = __wbResp.data;\n    }\n    data = __wbGet(data, \"items\");\n    {\n      const source = Array.isArray(data) ? data : (data == null ? [] : [data]);\n      data = source.map((item, index) => ({\n        \"title\": item.title,\n        \"score\": item.score,\n        \"answers\": item.answer_count,\n        \"url\": item.link,\n      }));\n    }\n    if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);\n    return data;\n  })();\n}"}]}