Main Page: Difference between revisions

From Public AI Wiki
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 15: Line 15:
* '''Crisis Support''': Get current hotline numbers and resources for mental health emergencies
* '''Crisis Support''': Get current hotline numbers and resources for mental health emergencies
* '''Transit Information''': Real-time public transportation schedules and routes
* '''Transit Information''': Real-time public transportation schedules and routes
* '''Events & Activities''': Discover upcoming community events and festivals
* '''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
Line 30: Line 31:
|-
|-
| '''Examples:'''
| '''Examples:'''
* [[Tool:SuicideHotline]] - Hotline numbers in ToolResources
* [[Tool:SuicideHotline]] - Crisis hotlines with custom SuicideHotlineResource template
* [[Tool:UpcomingBTO]] - BTO details in page content
* [[Tool:UpcomingEvents]] - Events with custom UpcomingEventsResource template
| '''Examples:'''
| '''Examples:'''
* Swiss Transit - Calls transport.opendata.ch API
* Swiss Transit - Calls transport.opendata.ch API
* OSM Nominatim - Searches OpenStreetMap
* Singapore Carparks - Queries data.gov.sg API
|-
|-
| '''Who can contribute:''' Anyone (no coding required)
| '''Who can contribute:''' Anyone (no coding required)
Line 43: Line 44:
* Information that changes over time
* Information that changes over time
* Data that needs community verification
* Data that needs community verification
* Custom data structures per tool
| '''Best for:'''
| '''Best for:'''
* Real-time API integrations
* Real-time API integrations
Line 55: Line 57:
|fields=_pageName=Tool,description,community,has_resources
|fields=_pageName=Tool,description,community,has_resources
|order by=_pageName
|order by=_pageName
|format=table
|headers show
}}
== Recent Resources ==
{{#cargo_query:
tables=ToolResources
|fields=_pageName=Resource,country,tool
|order by=last_verified DESC
|limit=10
|format=table
|format=table
|headers show
|headers show
Line 74: Line 65:
Choose your contribution pathway based on what you want to do:
Choose your contribution pathway based on what you want to do:


=== 1️⃣ Improve a Wiki Tool ===
=== 1️⃣ Add Data to an Existing Tool ===


'''Add or update localized data for an existing tool'''
'''Add or update localized data for an existing tool'''
Line 82: Line 73:
'''Perfect for:'''
'''Perfect for:'''
* Adding suicide hotline numbers for your country
* Adding suicide hotline numbers for your country
* Updating BTO launch information
* Contributing upcoming events in your region
* Contributing local crisis resources
* Adding local crisis resources
* Verifying and updating existing information
* Verifying and updating existing information


'''Quick start:'''
'''Quick start:'''
# Browse the tools above and find one with <code>has_resources=true</code>
# Browse the tools above and find one with <code>has_resources=true</code>
# Create a page: <code>Resource:ToolName/YourLocation</code>
# Check the tool's page for its custom resource template (e.g., [[Template:SuicideHotlineResource]], [[Template:UpcomingEventsResource]])
# Use the [[Template:ToolResource]] template
# Create or edit a page: <code>Resource:ToolName/YourLocation</code>
# Fill in your local data (phone numbers, websites, etc.)
# Use the tool's specific resource template with the appropriate fields
# Save and done!
# Fill in your local data and save!


'''💡 For technically-minded contributors:''' You can set up automations (GitHub Actions, cron jobs) to periodically update wiki data via the MediaWiki API.
'''💡 Tip:''' Look at existing resources for that tool to see what fields are available and how to format your data.


----
----


=== 2️⃣ Add a New Wiki Tool ===
=== 2️⃣ Create a New Wiki Tool ===


'''Create a new tool where community members can contribute data'''
'''Design a new tool with a custom data structure'''


'''Difficulty:''' Easy to Medium
'''Difficulty:''' Medium


'''When to use this:'''
'''When to use this:'''
* You have location-specific data that communities can maintain
* You have location-specific data that communities can maintain
* The information doesn't require API calls
* The information doesn't require API calls
* Multiple people can verify and update the information
* You need a specific data structure for your use case


'''Quick start:'''
'''Quick start:'''
# Create a page: <code>Tool:YourToolName</code>
# Create <code>Template:YourToolNameResource</code> - define your data fields (see [[Template:SuicideHotlineResource]] or [[Template:UpcomingBTOResource]] as examples)
# Use the [[Template:Tool]] template
# Create <code>Tool:YourToolName</code> - use the {{tl|Tool}} template with <code>has_resources=true</code>
# Set <code>has_resources=true</code> if you'll add location-specific data
# Create <code>Resource:YourToolName/Location</code> - add your first resource using your template
# Add your first resources (see option #1 above)
# Go to [[Special:CargoTables]], find your table, and click "Recreate data"
# The tool is now available to AI assistants!


'''Example tools to create:'''
'''💡 Important:''' ALL resource templates must include these baseline fields: <code>tool</code>, <code>country</code>, <code>region</code>, <code>last_verified</code>. Your table name must be <code>YourToolNameResources</code> for the MCP server to work.
* Public Library Hours (by location)
* Community Event Calendars
* Local Government Service Contact Info
* Emergency Services by Region


----
----
Line 135: Line 121:


'''Quick start:'''
'''Quick start:'''
# Fork the [https://github.com/yourusername/pai-mcp-server repository]
# Fork the [https://github.com/forpublicai/pai-mcp-server repository]
# Add your <code>@mcp.tool()</code> function to <code>main.py</code>
# Add your <code>@mcp.tool()</code> function to <code>main.py</code>
# Test locally
# Test locally with <code>python main.py</code>
# Submit a Pull Request
# Submit a Pull Request


Line 154: Line 140:
! Use this pathway
! Use this pathway
|-
|-
| Add data for an existing tool
| Add data to an existing tool
| <span style="font-size: 1.2em;">1️⃣</span> Improve a Wiki Tool
| <span style="font-size: 1.2em;">1️⃣</span> Add Data to an Existing Tool
|-
|-
| Create a tool with community-maintainable data
| Create a tool with custom data fields
| <span style="font-size: 1.2em;">2️⃣</span> Add a New Wiki Tool
| <span style="font-size: 1.2em;">2️⃣</span> Create a New Wiki Tool
|-
|-
| Build an API integration or complex tool
| Build an API integration or complex tool
Line 166: Line 152:
----
----


== Detailed Templates & Examples ==
== Examples to Learn From ==


=== Adding a Wiki Tool Resource ===
'''Well-designed Tools:'''
* [[Tool:SuicideHotline]] + [[Template:SuicideHotlineResource]] - Crisis resources with multiple contact methods
* [[Tool:UpcomingEvents]] + [[Template:UpcomingEventsResource]] - Events with dates and venue information
* [[Tool:UpcomingBTO]] + [[Template:UpcomingBTOResource]] - Single-country tool (region field left empty)


Create a page: <code>Resource:ToolName/Location</code>
== How Resource Templates Work ==


'''Example:''' Adding US suicide hotline
Each tool defines its own resource template with exactly the fields it needs:
<pre>
{{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
}}
</pre>


=== Creating a New Wiki Tool ===
{| class="wikitable"
 
! Tool
Create a page: <code>Tool:YourToolName</code>
! Template
 
! Custom Fields
'''Example:''' Public Library Hours
! Notes
<pre>
|-
{{Tool
| [[Tool:SuicideHotline]]
|name=Public Library Hours
| [[Template:SuicideHotlineResource]]
|description=Operating hours for public libraries by location
| primary_phone, secondary_phone, text_service, online_chat_url, youth_hotline, emergency_services, languages, availability
|community=Singapore
| Multi-country, uses region for states/provinces
|has_resources=true
|-
|overview=Provides current operating hours for public libraries across Singapore, including special hours for holidays and events.
| [[Tool:UpcomingEvents]]
|usage=Query by library name or region to get current hours.
| [[Template:UpcomingEventsResource]]
}}
| event_name, event_type, start_date, end_date, venue, address, admission, description, registration_url
</pre>
| Multi-country, region optional
|-
| [[Tool:UpcomingBTO]]
| [[Template:UpcomingBTOResource]]
| launch_month, location, unit_count, flat_types, classification
| Single-country (Singapore only), region left empty
|-
| Your tool!
| [[Template:YourToolResource]]
| Whatever fields you need!
| Remember: tool, country, region, last_verified are always required
|}


Then add resources for each library location.
This gives tool creators complete flexibility to structure their data appropriately.
 
=== Important: Updating Cargo Tables ===
 
After adding or editing wiki tools/resources:
# Navigate to [[Special:CargoTables]]
# Find the relevant table (Tools or ToolResources)
# Click "Recreate" to update the database
# Your changes are now live!


== Guidelines ==
== Guidelines ==
Line 220: Line 197:


* '''Accuracy''': All information must be current and verified
* '''Accuracy''': All information must be current and verified
* '''Verification''': Always include a '''last_verified''' date
* '''Verification''': Always include a <code>last_verified</code> date
* '''Completeness''': Provide all relevant contact methods (phone, text, online)
* '''Completeness''': Fill in all relevant fields for your resource
* '''Localization''': Information should be specific to the country/region
* '''Localization''': Information should be specific to the country/region
* '''Neutrality''': Present information objectively without bias
* '''Neutrality''': Present information objectively without bias
Line 228: Line 205:


✅ '''Good candidates for Wiki Tools:'''
✅ '''Good candidates for Wiki Tools:'''
* Information that changes over time (phone numbers, schedules)
* Information that changes over time (phone numbers, schedules, events)
* Localized data (country/region-specific resources)
* Localized data (country/region-specific resources)
* Public services (hotlines, transit, emergency services)
* Public services (hotlines, transit, emergency services, events)
* Data that AI assistants frequently need but may not have current info on
* Data that AI assistants frequently need but may not have current info on
* Information that benefits from community verification


❌ '''Not appropriate:'''
❌ '''Not appropriate:'''
Line 238: Line 216:
* 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
 
* Time-sensitive data that changes by the minute (use MCP tools with APIs instead)
== 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? ==
 
* '''Wiki editing''': [[Template:Tool|Tool Template]] | [[Template:ToolResource|Resource Template]]
* '''Development''': [https://github.com/yourusername/pai-mcp-server/blob/main/CONTRIBUTING.md Full Contributing Guide]
* '''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]]

Latest revision as of 08:33, 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?[edit | edit source]

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[edit | edit source]

  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[edit | edit source]

  • Crisis Support: Get current hotline numbers and resources for mental health emergencies
  • Transit Information: Real-time public transportation schedules and routes
  • Events & Activities: Discover upcoming community events and festivals
  • 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[edit | edit source]

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
  • Singapore Carparks - Queries data.gov.sg API
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
  • Custom data structures per tool
Best for:
  • Real-time API integrations
  • Complex data processing
  • External service connections

Browse All Tools[edit | edit source]

Tool description community has resources
Main Page No
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

How to Contribute[edit | edit source]

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

1️⃣ Add Data to an Existing Tool[edit | edit source]

Add or update localized data for an existing tool

Difficulty: Easy (no coding required)

Perfect for:

  • Adding suicide hotline numbers for your country
  • Contributing upcoming events in your region
  • Adding local crisis resources
  • Verifying and updating existing information

Quick start:

  1. Browse the tools above and find one with has_resources=true
  2. Check the tool's page for its custom resource template (e.g., Template:SuicideHotlineResource, Template:UpcomingEventsResource)
  3. Create or edit a page: Resource:ToolName/YourLocation
  4. Use the tool's specific resource template with the appropriate fields
  5. Fill in your local data and save!

💡 Tip: Look at existing resources for that tool to see what fields are available and how to format your data.


2️⃣ Create a New Wiki Tool[edit | edit source]

Design a new tool with a custom data structure

Difficulty: Medium

When to use this:

  • You have location-specific data that communities can maintain
  • The information doesn't require API calls
  • You need a specific data structure for your use case

Quick start:

  1. Create Template:YourToolNameResource - define your data fields (see Template:SuicideHotlineResource or Template:UpcomingBTOResource as examples)
  2. Create Tool:YourToolName - use the Template:Tl template with has_resources=true
  3. Create Resource:YourToolName/Location - add your first resource using your template
  4. Go to Special:CargoTables, find your table, and click "Recreate data"

💡 Important: ALL resource templates must include these baseline fields: tool, country, region, last_verified. Your table name must be YourToolNameResources for the MCP server to work.


3️⃣ Add a New MCP Tool[edit | edit source]

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 with python main.py
  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[edit | edit source]

I want to... Use this pathway
Add data to an existing tool 1️⃣ Add Data to an Existing Tool
Create a tool with custom data fields 2️⃣ Create a New Wiki Tool
Build an API integration or complex tool 3️⃣ Add a New MCP Tool

Examples to Learn From[edit | edit source]

Well-designed Tools:

How Resource Templates Work[edit | edit source]

Each tool defines its own resource template with exactly the fields it needs:

Tool Template Custom Fields Notes
Tool:SuicideHotline Template:SuicideHotlineResource primary_phone, secondary_phone, text_service, online_chat_url, youth_hotline, emergency_services, languages, availability Multi-country, uses region for states/provinces
Tool:UpcomingEvents Template:UpcomingEventsResource event_name, event_type, start_date, end_date, venue, address, admission, description, registration_url Multi-country, region optional
Tool:UpcomingBTO Template:UpcomingBTOResource launch_month, location, unit_count, flat_types, classification Single-country (Singapore only), region left empty
Your tool! Template:YourToolResource Whatever fields you need! Remember: tool, country, region, last_verified are always required

This gives tool creators complete flexibility to structure their data appropriately.

Guidelines[edit | edit source]

Quality Standards[edit | edit source]

  • Accuracy: All information must be current and verified
  • Verification: Always include a last_verified date
  • Completeness: Fill in all relevant fields for your resource
  • Localization: Information should be specific to the country/region
  • Neutrality: Present information objectively without bias

What Belongs Here[edit | edit source]

Good candidates for Wiki Tools:

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

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
  • Time-sensitive data that changes by the minute (use MCP tools with APIs instead)