Main Page: Difference between revisions

From Public AI Wiki
No edit summary
No edit summary
Line 17: Line 17:
* '''Location Services''': Search for places and get geographic information
* '''Location Services''': Search for places and get geographic information
* '''And more...''': Any information that benefits from being current, localized, and structured
* '''And more...''': Any information that benefits from being current, localized, and structured
== Understanding Public AI Tools ==
Public AI has two types of tools, each serving different purposes:
{| class="wikitable" style="width: 100%;"
! style="width: 50%;" | Wiki Tools
! style="width: 50%;" | MCP Tools
|-
| '''Data lives in this wiki'''<br/>The MCP server reads and serves wiki content to AI assistants
| '''Code lives in GitHub repository'''<br/>Python functions that integrate with external APIs
|-
| '''Examples:'''
* [[Tool:SuicideHotline]] - Hotline numbers in ToolResources
* [[Tool:UpcomingBTO]] - BTO details in page content
| '''Examples:'''
* Swiss Transit - Calls transport.opendata.ch API
* OSM Nominatim - Searches OpenStreetMap
|-
| '''Who can contribute:''' Anyone (no coding required)
| '''Who can contribute:''' Developers (Python required)
|-
| '''Best for:'''
* Location-specific resources
* Information that changes over time
* Data that needs community verification
| '''Best for:'''
* Real-time API integrations
* Complex data processing
* External service connections
|}


== Browse All Tools ==
== Browse All Tools ==
Line 22: Line 53:
{{#cargo_query:
{{#cargo_query:
tables=Tools
tables=Tools
|fields=_pageName=Tool,description
|fields=_pageName=Tool,description,community,has_resources
|order by=_pageName
|order by=_pageName
|format=table
|format=table
Line 41: Line 72:
== How to Contribute ==
== How to Contribute ==


=== Adding a New Tool ===
Choose your contribution pathway based on what you want to do:
 
=== 1️⃣ Improve a Wiki Tool ===


# Create a page with the prefix '''Tool:''' (e.g., [[Tool:YourToolName]])
'''Add or update localized data for an existing tool'''
 
'''Difficulty:''' Easy (no coding required)
 
'''Perfect for:'''
* Adding suicide hotline numbers for your country
* Updating BTO launch information
* Contributing local crisis resources
* Verifying and updating existing information
 
'''Quick start:'''
# Browse the tools above and find one with <code>has_resources=true</code>
# Create a page: <code>Resource:ToolName/YourLocation</code>
# Use the [[Template:ToolResource]] template
# Fill in your local data (phone numbers, websites, etc.)
# Save and done!
 
'''💡 For technically-minded contributors:''' You can set up automations (GitHub Actions, cron jobs) to periodically update wiki data via the MediaWiki API.
 
----
 
=== 2️⃣ Add a New Wiki Tool ===
 
'''Create a new tool where community members can contribute data'''
 
'''Difficulty:''' Easy to Medium
 
'''When to use this:'''
* You have location-specific data that communities can maintain
* The information doesn't require API calls
* Multiple people can verify and update the information
 
'''Quick start:'''
# Create a page: <code>Tool:YourToolName</code>
# Use the [[Template:Tool]] template
# Use the [[Template:Tool]] template
# Fill in the required parameters:
# Set <code>has_resources=true</code> if you'll add location-specific data
#* '''name''': Display name of the tool
# Add your first resources (see option #1 above)
#* '''description''': Brief description (one sentence)
# The tool is now available to AI assistants!
#* '''tool_type''': Category (Crisis Support, Transit, Mapping, General)
 
#* '''has_resources''': Set to "true" if this tool has locale-specific resources
'''Example tools to create:'''
#* '''overview''': Detailed explanation of what the tool does
* Public Library Hours (by location)
#* '''usage''': Instructions on how to use the tool
* Community Event Calendars
* Local Government Service Contact Info
* Emergency Services by Region
 
----


'''Example:'''
=== 3️⃣ Add a New MCP Tool ===
<pre>
 
{{Tool
'''Implement a Python tool that integrates with external APIs'''
|name=Weather Alerts
 
|description=Real-time weather alerts and warnings by region
'''Difficulty:''' Advanced (requires Python/coding)
|tool_type=General
 
|has_resources=true
'''When to use this:'''
|overview=Provides severe weather alerts...
* You need to call external APIs (weather, transit, etc.)
|usage=Query by country or region...
* The tool requires real-time data
}}
* Complex logic or data transformation is needed
</pre>
 
'''Quick start:'''
# Fork the [https://github.com/yourusername/pai-mcp-server repository]
# Add your <code>@mcp.tool()</code> function to <code>main.py</code>
# Test locally
# Submit a Pull Request
 
'''Example tools to create:'''
* Weather API integrations
* Stock market data
* Real-time transit for other countries
* News aggregators
 
----
 
=== Quick Decision Guide ===
 
{| class="wikitable"
! I want to...
! Use this pathway
|-
| Add data for an existing tool
| <span style="font-size: 1.2em;">1️⃣</span> Improve a Wiki Tool
|-
| Create a tool with community-maintainable data
| <span style="font-size: 1.2em;">2️⃣</span> Add a New Wiki Tool
|-
| Build an API integration or complex tool
| <span style="font-size: 1.2em;">3️⃣</span> Add a New MCP Tool
|}
 
----
 
== Detailed Templates & Examples ==


=== Adding a Resource to an Existing Tool ===
=== Adding a Wiki Tool Resource ===


# Create a page with format '''Resource:ToolName/Location''' (e.g., [[Resource:SuicideHotline/Singapore]])
Create a page: <code>Resource:ToolName/Location</code>
# Use the [[Template:ToolResource]] template
# Fill in the parameters:
#* '''tool''': Link to parent tool (e.g., "Tool:SuicideHotline")
#* '''country''': Country name
#* '''region''': (Optional) State/province/region
#* '''data_field1_name''' through '''data_field5_name''': Custom field names
#* '''data_field1_value''' through '''data_field5_value''': Values for those fields
#* '''additional_info''': Any extra information
#* '''details''': Long-form content
#* '''last_verified''': Date you verified this information (YYYY-MM-DD format)


'''Example:'''
'''Example:''' Adding US suicide hotline
<pre>
<pre>
{{ToolResource
{{ToolResource
Line 89: Line 182:
|data_field2_name=Text Service
|data_field2_name=Text Service
|data_field2_value=Text "HELLO" to 741741 (Crisis Text Line)
|data_field2_value=Text "HELLO" to 741741 (Crisis Text Line)
|additional_info=Free and confidential support
|data_field3_name=Online Chat
|last_verified=2024-01-15
|data_field3_value=https://988lifeline.org/chat
|additional_info=Free and confidential support. Services available in English and Spanish.
|last_verified=2025-12-26
}}
}}
</pre>
</pre>


=== Updating Existing Information ===
=== Creating a New Wiki Tool ===


# Find the resource page you want to update
Create a page: <code>Tool:YourToolName</code>
# Click "Edit" at the top of the page
# Update the relevant fields
# '''Important''': Update the '''last_verified''' date to today's date
# Save the page
# Navigate to [[Special:CargoTables]] and click "Recreate" for the ToolResources table


== Technical Documentation ==
'''Example:''' Public Library Hours
 
<pre>
=== For Developers ===
{{Tool
|name=Public Library Hours
|description=Operating hours for public libraries by location
|community=Singapore
|has_resources=true
|overview=Provides current operating hours for public libraries across Singapore, including special hours for holidays and events.
|usage=Query by library name or region to get current hours.
}}
</pre>


This wiki uses:
Then add resources for each library location.
* '''MediaWiki''': The underlying wiki platform
* '''Cargo Extension''': Structured data storage and querying
* '''FastMCP Server''': Exposes wiki data as MCP tools for AI assistants


=== API Access ===
=== Important: Updating Cargo Tables ===


Data can be queried via:
After adding or editing wiki tools/resources:
* '''MediaWiki API''': Standard MediaWiki API endpoints
# Navigate to [[Special:CargoTables]]
* '''Cargo API''': Special:CargoQuery for structured queries
# Find the relevant table (Tools or ToolResources)
* '''MCP Server''': FastMCP server provides simplified access for AI assistants
# Click "Recreate" to update the database
 
# Your changes are now live!
=== Cargo Tables ===
 
View and manage the structured data:
* [[Special:CargoTables|View all Cargo tables]]
* '''Tools''' table: Stores all tool definitions
* '''ToolResources''' table: Stores locale-specific resource data


== Guidelines ==
== Guidelines ==
Line 138: Line 227:
=== What Belongs Here ===
=== What Belongs Here ===


✅ '''Good candidates for Public AI:'''
✅ '''Good candidates for Wiki Tools:'''
* Information that changes over time (phone numbers, schedules)
* Information that changes over time (phone numbers, schedules)
* Localized data (country/region-specific resources)
* Localized data (country/region-specific resources)
Line 149: Line 238:
* Information that rarely changes and is well-known (e.g., historical facts)
* Information that rarely changes and is well-known (e.g., historical facts)
* Opinion pieces or subjective content
* Opinion pieces or subjective content
== Technical Documentation ==
=== For Developers ===
This wiki uses:
* '''MediaWiki''': The underlying wiki platform
* '''Cargo Extension''': Structured data storage and querying
* '''FastMCP Server''': Exposes wiki data as MCP tools for AI assistants
'''Repository:''' [https://github.com/yourusername/pai-mcp-server pai-mcp-server]
=== API Access ===
Data can be queried via:
* '''MediaWiki API''': Standard MediaWiki API endpoints (<code>https://wiki.publicai.co/w/api.php</code>)
* '''Cargo API''': Special:CargoQuery for structured queries
* '''MCP Server''': FastMCP server provides simplified access for AI assistants
=== Cargo Tables ===
View and manage the structured data:
* [[Special:CargoTables|View all Cargo tables]]
* '''Tools''' table: Stores all tool definitions
* '''ToolResources''' table: Stores locale-specific resource data


== Need Help? ==
== Need Help? ==


* [[Template:Tool|View Tool Template Documentation]]
* '''Wiki editing''': [[Template:Tool|Tool Template]] | [[Template:ToolResource|Resource Template]]
* [[Template:ToolResource|View Resource Template Documentation]]
* '''Development''': [https://github.com/yourusername/pai-mcp-server/blob/main/CONTRIBUTING.md Full Contributing Guide]
* [[Special:CargoTables|Manage Cargo Tables]]
* '''Cargo tables''': [[Special:CargoTables|Manage Tables]]
* '''Questions''': Open an issue in the repository
 
== Examples to Learn From ==
 
'''Good Wiki Tools:'''
* [[Tool:SuicideHotline]] - Clean resource structure with multiple countries
* [[Tool:UpcomingBTO]] - Rich page content that updates regularly
 
'''Good Resources to Study:'''
* [[Resource:SuicideHotline/Singapore]] - Well-structured with all fields
* [[Resource:SuicideHotline/Switzerland]] - Multiple contact methods




[[Category:Public AI]]
[[Category:Public AI]]

Revision as of 06:25, 26 December 2025

Public AI is a structured knowledge base of tools and resources that AI assistants can access programmatically to help users with real-world tasks.

What is Public AI?

Public AI serves as a bridge between AI assistants (like Claude, ChatGPT, etc.) and real-world information that users need. Instead of AI assistants having outdated or incomplete information, they can query this wiki to get current, accurate, and localized data.

How It Works

  1. Structured Data: Information is stored using MediaWiki's Cargo extension, making it queryable like a database
  2. MCP Server: A FastMCP server reads from this wiki and exposes the data as tools that AI assistants can use
  3. AI Integration: When you ask an AI assistant a question (e.g., "What's the suicide hotline in Singapore?"), it queries this wiki and gives you current information

Use Cases

  • Crisis Support: Get current hotline numbers and resources for mental health emergencies
  • Transit Information: Real-time public transportation schedules and routes
  • Location Services: Search for places and get geographic information
  • And more...: Any information that benefits from being current, localized, and structured

Understanding Public AI Tools

Public AI has two types of tools, each serving different purposes:

Wiki Tools MCP Tools
Data lives in this wiki
The MCP server reads and serves wiki content to AI assistants
Code lives in GitHub repository
Python functions that integrate with external APIs
Examples: Examples:
  • Swiss Transit - Calls transport.opendata.ch API
  • OSM Nominatim - Searches OpenStreetMap
Who can contribute: Anyone (no coding required) Who can contribute: Developers (Python required)
Best for:
  • Location-specific resources
  • Information that changes over time
  • Data that needs community verification
Best for:
  • Real-time API integrations
  • Complex data processing
  • External service connections

Browse All Tools

Tool description community has resources
Tool:SuicideHotline International suicide prevention hotlines and crisis support resources Singapore Switzerland Yes
Tool:UpcomingBTO Upcoming Build-To-Order (BTO) public housing launches in Singapore Singapore Yes
Tool:UpcomingEvents Community and public events happening in various locations Singapore Yes

Recent Resources

No results

How to Contribute

Choose your contribution pathway based on what you want to do:

1️⃣ Improve a Wiki Tool

Add or update localized data for an existing tool

Difficulty: Easy (no coding required)

Perfect for:

  • Adding suicide hotline numbers for your country
  • Updating BTO launch information
  • Contributing local crisis resources
  • Verifying and updating existing information

Quick start:

  1. Browse the tools above and find one with has_resources=true
  2. Create a page: Resource:ToolName/YourLocation
  3. Use the Template:ToolResource template
  4. Fill in your local data (phone numbers, websites, etc.)
  5. Save and done!

💡 For technically-minded contributors: You can set up automations (GitHub Actions, cron jobs) to periodically update wiki data via the MediaWiki API.


2️⃣ Add a New Wiki Tool

Create a new tool where community members can contribute data

Difficulty: Easy to Medium

When to use this:

  • You have location-specific data that communities can maintain
  • The information doesn't require API calls
  • Multiple people can verify and update the information

Quick start:

  1. Create a page: Tool:YourToolName
  2. Use the Template:Tool template
  3. Set has_resources=true if you'll add location-specific data
  4. Add your first resources (see option #1 above)
  5. The tool is now available to AI assistants!

Example tools to create:

  • Public Library Hours (by location)
  • Community Event Calendars
  • Local Government Service Contact Info
  • Emergency Services by Region

3️⃣ Add a New MCP Tool

Implement a Python tool that integrates with external APIs

Difficulty: Advanced (requires Python/coding)

When to use this:

  • You need to call external APIs (weather, transit, etc.)
  • The tool requires real-time data
  • Complex logic or data transformation is needed

Quick start:

  1. Fork the repository
  2. Add your @mcp.tool() function to main.py
  3. Test locally
  4. Submit a Pull Request

Example tools to create:

  • Weather API integrations
  • Stock market data
  • Real-time transit for other countries
  • News aggregators

Quick Decision Guide

I want to... Use this pathway
Add data for an existing tool 1️⃣ Improve a Wiki Tool
Create a tool with community-maintainable data 2️⃣ Add a New Wiki Tool
Build an API integration or complex tool 3️⃣ Add a New MCP Tool

Detailed Templates & Examples

Adding a Wiki Tool Resource

Create a page: Resource:ToolName/Location

Example: Adding US suicide hotline

{{ToolResource
|tool=Tool:SuicideHotline
|country=United States
|region=National
|data_field1_name=Phone
|data_field1_value=988 (Suicide & Crisis Lifeline, 24/7)
|data_field2_name=Text Service
|data_field2_value=Text "HELLO" to 741741 (Crisis Text Line)
|data_field3_name=Online Chat
|data_field3_value=https://988lifeline.org/chat
|additional_info=Free and confidential support. Services available in English and Spanish.
|last_verified=2025-12-26
}}

Creating a New Wiki Tool

Create a page: Tool:YourToolName

Example: Public Library Hours

{{Tool
|name=Public Library Hours
|description=Operating hours for public libraries by location
|community=Singapore
|has_resources=true
|overview=Provides current operating hours for public libraries across Singapore, including special hours for holidays and events.
|usage=Query by library name or region to get current hours.
}}

Then add resources for each library location.

Important: Updating Cargo Tables

After adding or editing wiki tools/resources:

  1. Navigate to Special:CargoTables
  2. Find the relevant table (Tools or ToolResources)
  3. Click "Recreate" to update the database
  4. Your changes are now live!

Guidelines

Quality Standards

  • Accuracy: All information must be current and verified
  • Verification: Always include a last_verified date
  • Completeness: Provide all relevant contact methods (phone, text, online)
  • Localization: Information should be specific to the country/region
  • Neutrality: Present information objectively without bias

What Belongs Here

Good candidates for Wiki Tools:

  • Information that changes over time (phone numbers, schedules)
  • Localized data (country/region-specific resources)
  • Public services (hotlines, transit, emergency services)
  • Data that AI assistants frequently need but may not have current info on

Not appropriate:

  • Personal or private information
  • Copyrighted content without permission
  • Information that rarely changes and is well-known (e.g., historical facts)
  • Opinion pieces or subjective content

Technical Documentation

For Developers

This wiki uses:

  • MediaWiki: The underlying wiki platform
  • Cargo Extension: Structured data storage and querying
  • FastMCP Server: Exposes wiki data as MCP tools for AI assistants

Repository: pai-mcp-server

API Access

Data can be queried via:

  • MediaWiki API: Standard MediaWiki API endpoints (https://wiki.publicai.co/w/api.php)
  • Cargo API: Special:CargoQuery for structured queries
  • MCP Server: FastMCP server provides simplified access for AI assistants

Cargo Tables

View and manage the structured data:

  • View all Cargo tables
  • Tools table: Stores all tool definitions
  • ToolResources table: Stores locale-specific resource data

Need Help?

Examples to Learn From

Good Wiki Tools:

Good Resources to Study: