{"url_pattern":"^https?://(www\\.)?pixiv\\.net(/.*)?$","site_name":"pixiv","allowed_domains":["example.com","pixiv.net"],"tools":[{"name":"pixiv_detail","description":"View illustration details (tags, stats, URLs)","inputSchema":{"type":"object","properties":{"id":{"type":"string","description":"Illustration ID"}},"required":["id"]},"handler":"(params) => {\n  const args = Object.assign({}, 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://www.pixiv.net\");\n      __wbContextUrl = __wbResp.url;\n      __wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');\n      data = __wbContextDocument;\n    }\n    {\n      const document = __wbContextDocument || globalThis.document;\n      const location = new URL(__wbBaseUrl());\n      const window = { document, location };\n      const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));\n      data = await (((async () => {\n  const id = ((args.id));\n  const res = await fetch(\n    'https://www.pixiv.net/ajax/illust/' + id,\n    { credentials: 'include' }\n  );\n  if (!res.ok) {\n    if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');\n    if (res.status === 404) throw new Error('Illustration not found: ' + id);\n    throw new Error('Pixiv request failed (HTTP ' + res.status + ')');\n  }\n  const data = await res.json();\n  const b = data?.body;\n  if (!b) throw new Error('Illustration not found');\n  return [{\n    illust_id: b.illustId,\n    title: b.illustTitle,\n    author: b.userName,\n    user_id: b.userId,\n    type: b.illustType === 0 ? 'illust' : b.illustType === 1 ? 'manga' : b.illustType === 2 ? 'ugoira' : String(b.illustType),\n    pages: b.pageCount,\n    bookmarks: b.bookmarkCount,\n    likes: b.likeCount,\n    views: b.viewCount,\n    tags: (b.tags?.tags || []).map(t => t.tag).join(', '),\n    created: b.createDate?.split('T')[0] || '',\n    url: 'https://www.pixiv.net/artworks/' + b.illustId\n  }];\n})())());\n    }\n    return data;\n  })();\n}"},{"name":"pixiv_ranking","description":"Pixiv illustration rankings (daily/weekly/monthly)","inputSchema":{"type":"object","properties":{"mode":{"type":"string","description":"Ranking mode","default":"daily","enum":["daily","weekly","monthly","rookie","original","male","female","daily_r18","weekly_r18"]},"page":{"type":"number","description":"Page number","default":1},"limit":{"type":"number","description":"Number of results","default":20}},"required":null},"handler":"(params) => {\n  const args = Object.assign({\"mode\": \"daily\", \"page\": 1, \"limit\": 20}, 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://www.pixiv.net\");\n      __wbContextUrl = __wbResp.url;\n      __wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');\n      data = __wbContextDocument;\n    }\n    {\n      const document = __wbContextDocument || globalThis.document;\n      const location = new URL(__wbBaseUrl());\n      const window = { document, location };\n      const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));\n      data = await (((async () => {\n  const mode = ((args.mode));\n  const page = ((args.page));\n  const limit = ((args.limit));\n  const res = await fetch(\n    'https://www.pixiv.net/ranking.php?mode=' + mode + '&p=' + page + '&format=json',\n    { credentials: 'include' }\n  );\n  if (!res.ok) {\n    if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');\n    throw new Error('Pixiv request failed (HTTP ' + res.status + ')');\n  }\n  const data = await res.json();\n  const items = (data?.contents || []).slice(0, limit);\n  return items.map((item, i) => ({\n    rank: item.rank,\n    title: item.title,\n    author: item.user_name,\n    user_id: item.user_id,\n    illust_id: item.illust_id,\n    pages: item.illust_page_count,\n    bookmarks: item.illust_bookmark_count,\n    url: 'https://www.pixiv.net/artworks/' + item.illust_id\n  }));\n})())());\n    }\n    return data;\n  })();\n}"},{"name":"pixiv_user","description":"View Pixiv artist profile","inputSchema":{"type":"object","properties":{"uid":{"type":"string","description":"Pixiv user ID"}},"required":["uid"]},"handler":"(params) => {\n  const args = Object.assign({}, 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://www.pixiv.net\");\n      __wbContextUrl = __wbResp.url;\n      __wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');\n      data = __wbContextDocument;\n    }\n    {\n      const document = __wbContextDocument || globalThis.document;\n      const location = new URL(__wbBaseUrl());\n      const window = { document, location };\n      const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));\n      data = await (((async () => {\n  const uid = ((args.uid));\n  const res = await fetch(\n    'https://www.pixiv.net/ajax/user/' + uid + '?full=1',\n    { credentials: 'include' }\n  );\n  if (!res.ok) {\n    if (res.status === 401 || res.status === 403) throw new Error('Authentication required — please log in to Pixiv in Chrome');\n    if (res.status === 404) throw new Error('User not found: ' + uid);\n    throw new Error('Pixiv request failed (HTTP ' + res.status + ')');\n  }\n  const data = await res.json();\n  const b = data?.body;\n  if (!b) throw new Error('User not found');\n  return [{\n    user_id: uid,\n    name: b.name,\n    premium: b.premium ? 'Yes' : 'No',\n    following: b.following,\n    illusts: typeof b.illusts === 'object' ? Object.keys(b.illusts).length : (b.illusts || 0),\n    manga: typeof b.manga === 'object' ? Object.keys(b.manga).length : (b.manga || 0),\n    novels: typeof b.novels === 'object' ? Object.keys(b.novels).length : (b.novels || 0),\n    comment: (b.comment || '').slice(0, 80),\n    url: 'https://www.pixiv.net/users/' + uid\n  }];\n})())());\n    }\n    return data;\n  })();\n}"}]}