server:
  name: brave-search-server
  config:
    apiKey: ""
tools:
- name: brave_web_search
  description: "使用Brave Search API进行网页搜索，适用于一般查询、新闻、文章和在线内容。支持分页、内容过滤和新鲜度控制。"
  args:
  - name: q
    description: "搜索查询（最多400字符，50个词）"
    type: string
    required: true
  - name: count
    description: "结果数量（1-20，默认10）"
    type: integer
    required: false
    default: 10
  - name: offset
    description: "分页偏移量（最大9，默认0）"
    type: integer
    required: false
    default: 0
  - name: search_lang
    description: "搜索语言"
    type: string
    required: false
    enum: ["en", "zh-hans"]
  requestTemplate:
    url: "https://api.search.brave.com/res/v1/web/search"
    method: GET
    argsToUrlParam: true
    headers:
    - key: Accept
      value: "application/json"
    - key: X-Subscription-Token
      value: "{{.config.apiKey}}"
  responseTemplate:
    body: |
      {{- range $index, $item := .web.results }}
      ## 结果 {{add $index 1}}
      - **标题**: {{ $item.title }}
      - **描述**: {{ $item.description }}
      - **URL**: {{ $item.url }}
      {{- end }}
      {{- if .locations.results }}
        {{- range $index, $item := .locations.results }}
        ## 结果 {{add $index 1}}
        - **locationID**: {{ $item.id }}
        {{- end }}
      {{- end }}

- name: brave_local_search_pois
  description: "使用Brave Local Search API搜索本地POI（兴趣点）信息，包括名称、地址、电话、评分等信息。"
  args:
  - name: ids
    description: "Location ID列表，通过brave_web_search获取"
    type: array
    required: true
  - name: search_lang
    description: "搜索语言"
    type: string
    required: false
    default: "en"
  - name: search_lang
    description: "响应语言"
    type: string
    required: false
    default: "en-US"
  requestTemplate:
    url: "https://api.search.brave.com/res/v1/local/pois"
    method: GET
    argsToUrlParam: true
    headers:
    - key: Accept
      value: "application/json"
    - key: X-Subscription-Token
      value: "{{.config.apiKey}}"
  responseTemplate:
    body: |
      {{- range $index, $item := .results }}
      ## POI {{add $index 1}}
      - **名称**: {{ $item.name }}
      - **地址**: {{ $item.address.streetAddress }}, {{ $item.address.addressLocality }}, {{ $item.address.addressRegion }} {{ $item.address.postalCode }}
      - **电话**: {{ $item.phone }}
      - **评分**: {{ $item.rating.ratingValue }} ({{ $item.rating.ratingCount }} 条评价)
      - **价格范围**: {{ $item.priceRange }}
      - **营业时间**: {{ join $item.openingHours ", " }}
      {{- end }}

- name: brave_local_search_descriptions
  description: "使用Brave Local Search API获取本地POI的描述信息。"
  args:
  - name: ids
    description: "Location ID列表，通过brave_web_search获取"
    type: array
    required: true
  - name: search_lang
    description: "搜索语言"
    type: string
    required: false
    default: "en"
  - name: search_lang
    description: "响应语言"
    type: string
    required: false
    default: "en-US"
  requestTemplate:
    url: "https://api.search.brave.com/res/v1/local/descriptions"
    method: GET
    argsToUrlParam: true
    headers:
    - key: Accept
      value: "application/json"
    - key: X-Subscription-Token
      value: "{{.config.apiKey}}"
  responseTemplate:
    body: |
      {{- range $id, $desc := .descriptions }}
      ## 描述 {{ $id }}
      {{ $desc }}
      {{- end }}
