-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
refactor(torii-server): mcp and sql cleanup with instructions static …
…file (#2790)
Showing
3 changed files
with
218 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
Torii - Dojo Game Indexer for Starknet | ||
|
||
Torii is a specialized indexer designed for Dojo games running on Starknet. It indexes and tracks Entity Component System (ECS) data, providing a comprehensive view of game state and history. | ||
|
||
Database Structure: | ||
- entities: Tracks all game entities and their current state | ||
- dynamic model tables: Stores model data data associated with entities | ||
- models: Contains model definitions from the game | ||
- events: Records all game events and state changes | ||
- transactions: Stores all blockchain transactions affecting the game | ||
- event messages: event messages follow same structure as entities but are events | ||
|
||
|
||
You should always retrieve the schema if unsure about how to query the database. With the schema you can then associate entities with models and know | ||
what to query. | ||
|
||
Key Features: | ||
1. Entity Tracking | ||
- Query entities by type, component, or state | ||
- Track entity history and state changes | ||
- Aggregate entity statistics | ||
|
||
2. Component Analysis | ||
- Retrieve component data for specific entities | ||
- Query entities with specific component combinations | ||
- Track component value changes over time | ||
|
||
3. Event History | ||
- Access chronological game events | ||
- Filter events by type, entity, or time range | ||
- Analyze event patterns and frequencies | ||
|
||
4. Transaction Records | ||
- Query game-related transactions | ||
- Track transaction status and effects | ||
- Link transactions to entity changes | ||
|
||
Available Tools: | ||
1. 'query': Execute custom SQL queries for complex data analysis | ||
2. 'schema': Retrieve database schema information to understand table structures and query data / entities efficiently | ||
|
||
Common Query Patterns: | ||
1. Entity Lookup: | ||
SELECT * FROM entities WHERE entity_id = X | ||
|
||
2. Component State: | ||
SELECT * from [ns-Position] where internal_entity_id = X | ||
|
||
3. Event History: | ||
SELECT * FROM events | ||
WHERE entity_id = X | ||
ORDER BY block_number DESC | ||
|
||
4. State Changes: | ||
SELECT * FROM transactions | ||
WHERE affected_entity_id = X | ||
ORDER BY block_number DESC | ||
|
||
The database is optimized for querying game state and history, allowing clients to: | ||
- Retrieve current game state | ||
- Track entity lifecycle | ||
- Analyze game events | ||
- Monitor state changes | ||
- Generate game statistics |