moc-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FIWARE Orion 読み取り専用クエリ

FIWARE Orion 只读查询

FIWARE Orion Context Broker (NGSIv2) に対して、認証不要の GET のみでエンティティ情報を取得するスキルです。書き込み・Subscription・Registration は実装していません。
这是一款仅通过无需认证的GET请求,从FIWARE Orion Context Broker(NGSIv2)获取实体信息的Skill。未实现写入、Subscription(订阅)、Registration(注册)功能。

インストール

安装

skills CLI でインストールします(OpenCode / Claude Code / Cursor 等に対応)。
bash
npx skills add kzkski/moc-skill -a opencode -y
.agents/skills/moc-skill/scripts/setup-opencode.sh
setup-opencode.sh
は OpenCode のツール実行詳細(bash 出力など)をデフォルトで非表示にします。一般ユーザー向けの静かな UI 用です。詳細を見たいときは OpenCode で
/details
を実行してください。
ローカルパスから試す場合:
bash
npx skills add ./path/to/moc-skill --list
npx skills add ./path/to/moc-skill -a opencode -y
.agents/skills/moc-skill/scripts/setup-opencode.sh
通过skills CLI进行安装(支持OpenCode/Claude Code/Cursor等工具)。
bash
npx skills add kzkski/moc-skill -a opencode -y
.agents/skills/moc-skill/scripts/setup-opencode.sh
setup-opencode.sh
默认会隐藏OpenCode的工具执行详情(如bash输出),适用于面向普通用户的简洁UI。如需查看详情,请在OpenCode中执行
/details
从本地路径测试时:
bash
npx skills add ./path/to/moc-skill --list
npx skills add ./path/to/moc-skill -a opencode -y
.agents/skills/moc-skill/scripts/setup-opencode.sh

重要: アクセス経路

重要: 访问路径

必ず
scripts/orion.sh
経由でアクセスすること。
カタログ外 URL へ直接
curl
しないでください。対象基盤は
endpoints.json
に登録された名前だけを使います。
npx skills add
後、
moc-skill
スキル配下の
scripts/orion.sh
を絶対パスで実行します。代表パス:
  • .agents/skills/moc-skill/scripts/orion.sh
    (OpenCode / Cursor 等)
  • .claude/skills/moc-skill/scripts/orion.sh
    (Claude Code)
  • ~/.config/opencode/skills/moc-skill/scripts/orion.sh
    (OpenCode グローバル)
エージェントは
**/moc-skill/scripts/orion.sh
を探索し、見つかったパスを
ORION
として使ってください。
orion.sh
は同ディレクトリ隣の
endpoints.json
を自動解決します。
bash
ORION="/path/to/moc-skill/scripts/orion.sh"
環境変数
ORION_ENDPOINTS_FILE
でカタログパスを上書きできます(未設定時はスキル同梱の
endpoints.json
)。
务必通过
scripts/orion.sh
进行访问
,请勿直接对目录外的URL执行
curl
。仅使用
endpoints.json
中已注册的目标平台名称。
执行
npx skills add
后,以绝对路径运行
moc-skill
技能下的
scripts/orion.sh
。典型路径:
  • .agents/skills/moc-skill/scripts/orion.sh
    (OpenCode/Cursor等)
  • .claude/skills/moc-skill/scripts/orion.sh
    (Claude Code)
  • ~/.config/opencode/skills/moc-skill/scripts/orion.sh
    (OpenCode全局)
Agent会搜索
**/moc-skill/scripts/orion.sh
,将找到的路径设为
ORION
使用。
orion.sh
会自动解析同目录下的
endpoints.json
bash
ORION="/path/to/moc-skill/scripts/orion.sh"
可通过环境变量
ORION_ENDPOINTS_FILE
覆盖目录路径(未设置时使用技能自带的
endpoints.json
)。

回答フォーマット

回答格式

最終回答は一般ユーザーが読みやすい要約にすること。
orion.sh
の取得結果をそのまま貼り付けない。
  • 一覧・比較・属性値はまたは箇条書きで要約する
  • 件数・基盤名・型名・主要属性など、依頼に答える情報だけを含める
  • 実行したコマンド、curl、生 JSON、HTTP ヘッダーなどの技術的な詳細は最終回答に含めない
  • ユーザーが「生 JSON を見せて」「コマンドも教えて」「デバッグ用に全文」などと明示したときだけ技術的な出力を含める
最终回答需整理为普通用户易读的摘要,请勿直接粘贴
orion.sh
的获取结果。
  • 列表、对比、属性值请用表格项目符号进行摘要
  • 仅包含能回应用户请求的信息,如数量、平台名、类型名、主要属性等
  • 执行的命令、curl、原始JSON、HTTP头这类技术细节请勿包含在最终回答中
  • 仅当用户明确要求「显示原始JSON」「告知命令」「提供完整内容用于调试」时,才包含技术输出

推奨ワークフロー

推荐工作流程

endpoints.json
に登録された makeour.city 系 Orion では
types
を呼ばない
GET /v2/types
は 401 Unauthorized)。無駄なリトライを避け、次の順で探索します。
  1. endpoints — 基盤名・Fiware-Service 一覧(各
    note
    )を確認
  2. entities / count
    service=
    (複数サービス時)と
    type=
    で直接取得・件数確認
  3. entity — 特定 ID の詳細取得
型名の手がかりは
endpoints
のサービス
note
、ユーザーの依頼文、または
entities
の試行結果から得ます。
bash
"${ORION}" endpoints
"${ORION}" entities sagacity service=moc_sagacity limit=10
"${ORION}" count sagacity service=sagacity_topita type=TopitaPointUser
"${ORION}" entities yokosuka type=WeatherForecast limit=5
"${ORION}" entity yokosuka "forecast-001" attrs=location
endpoints.json
中注册的makeour.city系列Orion平台,请勿调用
types
GET /v2/types
会返回401 Unauthorized)。为避免无效重试,请按以下顺序进行查询:
  1. endpoints — 确认平台名、Fiware-Service列表(各条目的
    note
  2. entities / count — 通过
    service=
    (多服务场景)和
    type=
    直接获取数据、确认数量
  3. entity — 获取特定ID的详细信息
类型名的线索可从
endpoints
的服务
note
、用户请求内容或
entities
的尝试结果中获取。
bash
"${ORION}" endpoints
"${ORION}" entities sagacity service=moc_sagacity limit=10
"${ORION}" count sagacity service=sagacity_topita type=TopitaPointUser
"${ORION}" entities yokosuka type=WeatherForecast limit=5
"${ORION}" entity yokosuka "forecast-001" attrs=location

コマンドリファレンス

命令参考

コマンド説明
endpoints
カタログに登録された基盤名・URL・Fiware-Service 一覧・説明を表示
types <ep> [service=NAME]
GET /v2/types?options=count
makeour.city では 401 のため使用しない
entities <ep> [k=v ...]
GET /v2/entities
(未指定時
options=keyValues
limit=20
を付与)
entity <ep> <id> [k=v ...]
GET /v2/entities/{id}
(同上デフォルト付与)
count <ep> [k=v ...]
limit=1&options=count
Fiware-Total-Count
ヘッダーのみ返す
raw <ep> <path?query> [service=NAME]
/v2/
配下に限定した任意 GET
<ep>
endpoints.json
のキー名(例:
Sandbox
,
sagacity
,
yokosuka
)。
複数 Fiware-Service: 1 エントリに配列で複数サービスを登録できます。クエリ時は
service=NAME
を指定してください(Orion へのクエリパラメータではなく、ヘッダー選択用の予約キー)。単一サービスのエントリでは
service=
は不要です。
命令说明
endpoints
显示目录中已注册的平台名、URL、Fiware-Service列表及说明
types <ep> [service=NAME]
执行
GET /v2/types?options=count
makeour.city平台会返回401,请勿使用
entities <ep> [k=v ...]
执行
GET /v2/entities
(未指定时默认添加
options=keyValues
limit=20
entity <ep> <id> [k=v ...]
执行
GET /v2/entities/{id}
(同上默认添加参数)
count <ep> [k=v ...]
通过
limit=1&options=count
仅返回
Fiware-Total-Count
头信息
raw <ep> <path?query> [service=NAME]
仅对
/v2/
路径下执行任意GET请求
<ep>
endpoints.json
中的键名(示例:
Sandbox
,
sagacity
,
yokosuka
)。
多Fiware-Service场景:单个条目可通过数组注册多个服务。查询时需指定
service=NAME
(这是用于选择头信息的预留键,而非Orion的查询参数)。单服务条目无需指定
service=

デバッグ

调试

ORION_DRY_RUN=1
を設定すると curl コマンドを表示するだけで実行しません。
bash
ORION_DRY_RUN=1 "${ORION}" entities yokosuka type=WeatherForecast
设置
ORION_DRY_RUN=1
后,仅显示curl命令而不实际执行。
bash
ORION_DRY_RUN=1 "${ORION}" entities yokosuka type=WeatherForecast

NGSIv2 クエリパラメータ早見表

NGSIv2查询参数速查表

entities
/
entity
/
count
/
raw
[k=v ...]
または
raw
のクエリ文字列に指定します。
パラメータ用途
type
Entity Type でフィルタ(例:
type=Device
q
属性条件(例:
q=temperature>25
attrs
返却属性の限定(例:
attrs=location,temperature
idPattern
エンティティ ID の正規表現(例:
idPattern=^sensor-.*
limit
最大取得件数(
entities
/
entity
デフォルト 20)
offset
ページング開始位置
orderBy
ソート(例:
orderBy=!dateObserved
georel
+
geometry
+
coords
地理空間クエリ(例:
georel=near;maxDistance:1000
geometry=Point
coords=-3.7,40.4
options
レスポンス形式(
keyValues
,
count
,
values
など)
可在
entities
/
entity
/
count
/
raw
[k=v ...]
raw
的查询字符串中指定以下参数。
参数用途
type
按Entity Type过滤(示例:
type=Device
q
属性条件过滤(示例:
q=temperature>25
attrs
限定返回的属性(示例:
attrs=location,temperature
idPattern
实体ID的正则匹配(示例:
idPattern=^sensor-.*
limit
最大获取数量(
entities
/
entity
默认20)
offset
分页起始位置
orderBy
排序(示例:
orderBy=!dateObserved
georel
+
geometry
+
coords
地理空间查询(示例:
georel=near;maxDistance:1000
geometry=Point
coords=-3.7,40.4
options
响应格式(
keyValues
,
count
,
values
等)

注意点

注意事项

  • types は使わない: 登録基盤では
    /v2/types
    が 401。型探索は
    entities
    +
    type=
    /
    count
    で行う
  • 読み取り専用: POST / PATCH / DELETE / Subscription / Registration は行わない
  • カタログ必須: 未定義のエンドポイント名は拒否される
  • raw は /v2/ のみ:
    /v2/
    以外へのパスはエラー
  • Entity ID:
    [A-Za-z0-9._:~-]+
    のみ許可(パストラバーサル対策)
  • Fiware ヘッダー:
    endpoints.json
    Fiware-Service
    /
    Fiware-ServicePath
    が空でなければ自動付与。
    Fiware-Service
    が配列の場合は
    service=
    で選択
  • 依存:
    curl
    ,
    jq
    が PATH に必要
  • 请勿使用types:已注册平台的
    /v2/types
    会返回401,需通过
    entities
    +
    type=
    /
    count
    进行类型查询
  • 只读限制:不执行POST/PATCH/DELETE/Subscription/Registration操作
  • 必须使用目录:未定义的端点名称会被拒绝
  • raw仅支持/v2/
    /v2/
    以外的路径会报错
  • Entity ID限制:仅允许
    [A-Za-z0-9._:~-]+
    格式(防止路径遍历)
  • Fiware头信息:若
    endpoints.json
    中的
    Fiware-Service
    /
    Fiware-ServicePath
    不为空,则自动添加。
    Fiware-Service
    为数组时,需通过
    service=
    选择
  • 依赖环境:PATH中需包含
    curl
    ,
    jq

カタログ形式 (
endpoints.json
)

目录格式 (
endpoints.json
)

json
{
  "endpoints": {
    "<名前>": {
      "base_url": "https://orion.<自治体>.makeour.city",
      "Fiware-Service": "単一ヘッダー値",
      "Fiware-ServicePath": "ヘッダー値(不要なら空文字)",
      "note": "説明"
    },
    "sagacity": {
      "base_url": "https://orion.sagacity.makeour.city",
      "Fiware-Service": [
        { "value": "moc_sagacity", "note": "MoC 佐賀" },
        { "value": "sagacity_topita", "note": "Topita" },
        { "value": "sagacity_ikunowa", "note": "保育園データ" }
      ],
      "Fiware-ServicePath": "",
      "note": "複数サービスを1エントリで管理"
    }
  }
}
Fiware-Service
文字列(単一)または 配列(複数)を指定できます。配列要素は文字列、または
value
/
Fiware-ServicePath
/
note
を持つオブジェクトにできます。エントリ共通の
Fiware-ServicePath
は、オブジェクト側で未指定の場合のデフォルトになります。
新しい基盤を追加するときは、運用者が提供する Orion URL と Fiware ヘッダー値をこの形式で追記してください。
json
{
  "endpoints": {
    "<名称>": {
      "base_url": "https://orion.<自治体>.makeour.city",
      "Fiware-Service": "单一头信息值",
      "Fiware-ServicePath": "头信息值(无需则为空字符串)",
      "note": "说明"
    },
    "sagacity": {
      "base_url": "https://orion.sagacity.makeour.city",
      "Fiware-Service": [
        { "value": "moc_sagacity", "note": "MoC 佐贺" },
        { "value": "sagacity_topita", "note": "Topita" },
        { "value": "sagacity_ikunowa", "note": "保育园数据" }
      ],
      "Fiware-ServicePath": "",
      "note": "单个条目管理多个服务"
    }
  }
}
Fiware-Service
可指定为字符串(单一服务)或数组(多服务)。数组元素可为字符串,或包含
value
/
Fiware-ServicePath
/
note
的对象。条目通用的
Fiware-ServicePath
会作为对象未指定时的默认值。
添加新平台时,请按照此格式补充运维人员提供的Orion URL和Fiware头信息值。