manage_collection
Create and update PocketBase collection schemas by specifying fields, API rules, indexes, and view queries for base, auth, or view collections.
Instructions
USE WHEN you need to create or modify a collection schema.
EXAMPLES:
Create base: manage_collection(action="create", name="posts", fields=[{"name": "title", "type": "text", "required": True}])
Create view: manage_collection(action="create", name="post_stats", collection_type="view", view_query="SELECT id, title FROM posts")
Update rules: manage_collection(action="update", name="posts", api_rules={"list": "@request.auth.id != ''"})
NEXT STEPS: describe_collection to verify, find_records or write_record to use.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Collection name. | |
| action | Yes | Whether to create a new collection or update an existing one. | |
| fields | No | Field definitions. See PocketBase schema for field shapes. | |
| indexes | No | Index definitions. | |
| api_rules | No | API rules: {list, view, create, update, delete}. | |
| view_query | No | SQL query (for type='view' only). Validated before creation. | |
| collection_type | No | Collection type (for create only). | base |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||