Introduction

The DeepSeek Harness (DSH) plugin xby-toronto-open-data-server is a tool for directly accessing Toronto Open Data through the CKAN API, maintained by xby-skill. The plugin is designed specifically for LLM agents, aiming to address issues in agent development such as API complexity, difficulty in dataset discovery, and tedious format handling when retrieving structured open data. By encapsulating the interfaces for Toronto open datasets, it provides a complete workflow from discovery to querying and previewing.

Installation

Use the official command to install it:

dsh plugin --profile web add github:xby_skill/xby-toronto-open-data-server

Core Capabilities

The plugin provides the following core features, covering the entire data querying workflow:

  1. set_xby_apikey
    Used to set an API key in the conversation. This setting is automatically persisted and remains valid after a restart.
  2. toronto_start_here
    This is the starting point for any Toronto data query. It explains how to use the server effectively and provides a complete workflow guide for accessing Toronto Open Data.
  3. toronto_smart_data_helper
    This is the most recommended way to handle data. It is a smart helper that accepts a dataset ID and a query description, automatically determines whether the data is API-accessible or requires a CSV download, and returns the relevant data or next-step recommendations.
  4. Dataset Discovery
    Includes toronto_list_datasets (lists all datasets), toronto_search_datasets (searches by keywords), and toronto_popular_datasets (retrieves the list of popular datasets).
  5. Data Querying and Structure
    Includes toronto_get_dataset_schema (retrieves field names, IDs, and types for a dataset) and toronto_query_dataset_data (executes advanced queries with precise filtering, sorting, and field selection).
  6. Data Retrieval
    Includes toronto_get_dataset_stats (retrieves record counts, field information, and resource overviews) and toronto_fetch_csv_data (downloads and returns CSV file content or provides a download link).

Usage Examples

1. Initialization and Discovery

First, call set_xby_apikey in the conversation to set your key. Then, use toronto_start_here to understand the workflow, or use toronto_search_datasets to find data for a specific topic.

2. Smart Query

For most use cases, directly call toronto_smart_data_helper. It accepts a dataset ID and a target description, and automatically handles the subsequent logic.

3. Advanced Query Flow

If you need finer control, follow these steps:

  1. Use toronto_get_dataset_schema(dataset_id) to obtain field names and types.
  2. Use toronto_query_dataset_data to run the query, providing precise field names.
// 示例:查询特定条件的记录
{
  "filters": {
    "establishment_status": "Pass",
    "inspection_date": "2024-01-01"
  },
  "sorts": "inspection_date desc",
  "fields": ["name", "address", "score"]
}

4. Handling CSV Data

For datasets in CSV format, toronto_query_dataset_data returns a download link instead of query results. In this case, use toronto_fetch_csv_data to retrieve the file content or download it directly.

Notes

  • Prefer the Smart Assistant: toronto_smart_data_helper is the recommended method for most use cases, as it simplifies the workflow and handles complex format determination.
  • CSV File Characteristics: For CSV files, query operations return a download link rather than direct data results.
  • Advanced Query Dependency: Before using toronto_query_dataset_data for advanced filtering, sorting, or field selection, you must first call toronto_get_dataset_schema to obtain the correct field names.

Conclusion

This plugin provides a standard interface for LLM agents to interact with Toronto Open Data. By combining a smart assistant with structured queries, developers can efficiently retrieve and process Toronto public data. For more details, refer to the plugin directory or GitHub repository.