Uncategorized
Format: SKILLMedia: Text
Web検索機能 - キーワードから検索結果を取得
Author: こうたPublished: 2026/05/11 19:10
SKILL definition (Markdown)
目的
指定したキーワードでウェブ検索を行い、上位 N 件の結果を取得します。
前提条件
- インターネット接続があること
- 使用する検索APIのキーとエンドポイントが設定されていること
使い方
keywordに検索したいキーワードを入力します。- 任意で
max_resultsに取得件数を指定します(デフォルト: 5)。
手順
- 検索APIへリクエストを送信する。
- 取得したJSONレスポンスからタイトル・URL・スニペットを抽出する。
- 結果をリスト形式で返す。
期待出力
[
{
"title": "ページタイトル",
"url": "https://example.com",
"snippet": "ページの抜粋..."
},
...
]
Additional resources1 file
scripts/main.pyScript · python
import os
import requests
def web_search(keyword, max_results=5):
api_key = os.getenv("SEARCH_API_KEY")
endpoint = "https://api.example.com/search"
params = {
"q": keyword,
"count": max_results
}
headers = {
"Ocp-Apim-Subscription-Key": api_key
}
response = requests.get(endpoint, params=params, headers=headers)
response.raise_for_status()
data = response.json()
results = []
for item in data.get("value", []):
results.append({
"title": item.get("name"),
"url": item.get("url"),
"snippet": item.get("snippet")
})
return results
# 例: print(web_search("OpenAI"))Discover more
Popular prompts

UncategorizedPromptImage
アンディー・ウォーホル風の画像
この画像をアンディー・ウォーホル風にしてほしい。
View detailsUncategorizedPromptText
植物情報取得・要約プロンプト
役割: あなたは植物学の専門家です。 前提: ユーザーは植物名や特徴、利用目的などのキーワードを入力します。 目的: 入力された情報から、対象植物の基本情報、主な特徴、栽培・管理ポイント、利用例などを整理し、見やすい形式で…
View detailsUncategorizedSKILLText
データ加工用汎用SKILL
目的 ここにSKILLの目的を記述 前提条件 必要なデータや環境 使用方法 SKILLの呼び出し方や引数 手順 1. 手順1 2. 手順2 期待出力 出力例やフォーマット 注意点 留意すべきポイント
View details