{"id":16487,"plugin_id":"plugins_6a56a7df7a488191aa29d06c3124d761","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T23:13:27.870Z","digest":"1ab7c93ad804c561eb99bcab542f9180a5f1fc790e0f260486555e5741c352fb","against":null,"payload":{"description":"Dataverse schema authoring and inspection — tables, columns, relationships, forms, and views. Use when the user wants to define, evolve, or inspect the data model — add a column, create a table, set up a lookup, customize a form, build a view, or list existing columns and relationships.","included_files":[{"relative_path":"references/alternate-keys.md","size_in_bytes":4163},{"relative_path":"references/forms-and-views.md","size_in_bytes":9387},{"relative_path":"references/metadata-propagation.md","size_in_bytes":2322}],"name":"dv-metadata","skill_md_contents":"---\r\nname: dv-metadata\r\ndescription: Dataverse schema authoring and inspection — tables, columns, relationships, forms, and views. Use when the user wants to define, evolve, or inspect the data model — add a column, create a table, set up a lookup, customize a form, build a view, or list existing columns and relationships.\r\n---\r\n\r\n# Skill: Metadata — Making Changes\r\n\r\n**Before the first metadata change in a session:**\r\n1. **Confirm the target environment** with the user — see the Multi-Environment Rule in dv-overview.\r\n2. **Confirm the solution** — ask \"What solution should these components go into?\" If `SOLUTION_NAME` is in `.env`, confirm it. If no solution exists yet, **you MUST ask the user** for the solution name and publisher prefix before creating anything. The publisher prefix is **permanent** — it cannot be changed after components are created with it.\r\n\r\n**STOP and ask the user:**\r\n> \"What solution name and publisher prefix should I use? The prefix (e.g., `contoso`, `lit`, `soc`) is permanent on every table and column.\"\r\n\r\nThen query existing publishers and show them — the user may want to reuse one:\r\n\r\n```python\r\n# Publisher discovery + solution creation — use SDK (never raw Web API).\r\n# See dv-solution for the full publisher discovery flow.\r\npublishers = client.records.list(\"publisher\",\r\n    filter=\"customizationprefix ne 'none' and uniquename ne 'MicrosoftCorporation'\",\r\n    select=[\"publisherid\", \"uniquename\", \"friendlyname\", \"customizationprefix\"], top=10)\r\n# MANDATORY: Show existing publishers to user and ask which to use or create new\r\n```\r\n\r\nAfter user confirms, create using SDK:\r\n\r\n```python\r\npublisher_id = client.records.create(\"publisher\", {\r\n    \"uniquename\": \"<name>\", \"friendlyname\": \"<display>\",\r\n    \"customizationprefix\": \"<prefix>\",  # from user input, NOT hardcoded\r\n    \"description\": \"<desc>\",\r\n})\r\nsolution_id = client.records.create(\"solution\", {\r\n    \"uniquename\": \"<SolutionName>\", \"friendlyname\": \"<Display Name>\",\r\n    \"version\": \"1.0.0.0\",\r\n    \"publisherid@odata.bind\": f\"/publishers({publisher_id})\",\r\n})\r\n```\r\n\r\nNever create tables or columns outside a solution.\r\n\r\n3. Pass `solution=\"<UniqueName>\"` in every SDK call, or include `\"MSCRM.SolutionName\": \"<UniqueName>\"` on every raw Web API call.\r\n\r\n## Skill boundaries\r\n\r\n| Need | Use instead |\r\n|---|---|\r\n| Create, update, or delete data records | **dv-data** |\r\n| Query or read records | **dv-query** |\r\n| Export or deploy solutions | **dv-solution** |\r\n| ERP schema | see erp-target.md |\r\n\r\n---\r\n\r\n## How Changes Are Made: Environment-First\r\n\r\n**Do not write solution XML by hand to create new tables, columns, forms, or views.**\r\n\r\nThe environment validates metadata far more reliably than an agent editing XML. The correct workflow is:\r\n\r\n1. **Make the change in the environment** via the Dataverse MetadataService API (or `pac` commands where available)\r\n2. **Pull the change into the repo** via `pac solution export` + `pac solution unpack`\r\n3. **Commit the result**\r\n\r\nThe exported XML is generated by Dataverse itself and is always valid. Hand-written XML is fragile — a single incorrect attribute or missing element causes an import failure with an opaque error.\r\n\r\nThe only time you write files directly is when editing something that already exists in the repo (e.g., tweaking an existing view's columns or modifying a form layout you've already pulled).\r\n\r\n**CLI schema inspection:** `dataverse data describe --table account --include all --json` (uses LogicalName). API discovery: `dataverse api list --target dataverse`.\r\n\r\n---\r\n\r\n## Creating a Table\r\n\r\n**If creating multiple tables for a data import**, also see these sections later in this skill:\r\n- **Idempotent Table Creation** — check-first pattern for re-runnable scripts\r\n- **Alternate Keys** — required for upsert; create immediately after each table\r\n- **Metadata Propagation Delays and Lock Contention** — phased creation to avoid lock errors\r\n\r\n**Prefer the SDK for table creation** — use raw Web API only when you need full control over OwnershipType, HasActivities, or other advanced properties the SDK doesn't expose.\r\n\r\n**SDK approach (use this by default):**\r\n\r\n```python\r\nimport os, sys\r\nsys.path.insert(0, os.path.join(os.getcwd(), \"scripts\"))\r\nfrom auth import get_client\r\n\r\n# get_client sets a plugin attribution context on the User-Agent header.\r\n# Do not modify the context value — it is a closed schema for server-side\r\n# telemetry (app/skill/agent). Never include secrets or PII.\r\nclient = get_client(\"dv-metadata\")\r\n\r\ninfo = client.tables.create(\r\n    \"new_ProjectBudget\",\r\n    {\"new_Amount\": \"decimal\", \"new_Description\": \"string\"},\r\n    solution=\"MySolution\",\r\n    primary_column=\"new_Name\",\r\n    display_name=\"Project Budget\",  # human-readable name; plural auto-appends \"s\"\r\n)\r\nprint(f\"Created: {info['table_schema_name']}\")\r\n```\r\n\r\n**Web API fallback (ONLY when you need OwnershipType, HasActivities, or other properties the SDK doesn't expose):**\r\n\r\n```python\r\n# Helper for Label boilerplate\r\ndef label(text):\r\n    return {\"@odata.type\": \"Microsoft.Dynamics.CRM.Label\",\r\n            \"LocalizedLabels\": [{\"@odata.type\": \"Microsoft.Dynamics.CRM.LocalizedLabel\",\r\n                                  \"Label\": text, \"LanguageCode\": 1033}]}\r\n\r\nentity = {\r\n    \"@odata.type\": \"Microsoft.Dynamics.CRM.EntityMetadata\",\r\n    \"SchemaName\": \"new_ProjectBudget\",\r\n    \"DisplayName\": label(\"Project Budget\"),\r\n    \"DisplayCollectionName\": label(\"Project Budgets\"),\r\n    \"Description\": label(\"\"),\r\n    \"OwnershipType\": \"UserOwned\",\r\n    \"HasActivities\": False, \"HasNotes\": False, \"IsActivity\": False,\r\n    \"PrimaryNameAttribute\": \"new_name\",\r\n    \"Attributes\": [{\r\n        \"@odata.type\": \"Microsoft.Dynamics.CRM.StringAttributeMetadata\",\r\n        \"SchemaName\": \"new_name\",\r\n        \"DisplayName\": label(\"Name\"),\r\n        \"RequiredLevel\": {\"Value\": \"ApplicationRequired\"},\r\n        \"MaxLength\": 100, \"IsPrimaryName\": True,\r\n    }]\r\n}\r\n# POST to /api/data/v9.2/EntityDefinitions with MSCRM.SolutionUniqueName header\r\n```\r\n\r\n---\r\n\r\n## Column Naming: Avoid `*Id` Suffix Collisions\r\n\r\n**Never name a regular column with an `Id` suffix** (e.g., `prefix_CountryId`). Dataverse auto-generates a navigation property with the `Id` suffix when you create a lookup — if a regular column with that name exists, lookup creation fails with a schema name collision.\r\n\r\n- WRONG: `prefix_DepartmentId` (int) — collides with auto-generated lookup\r\n- RIGHT: `prefix_SrcDepartmentId` or `prefix_DepartmentSourceId`\r\n\r\n---\r\n\r\n## Adding Columns\r\n\r\n**SDK approach (preferred):**\r\n\r\n```python\r\ncreated = client.tables.add_columns(\r\n    \"new_ProjectBudget\",\r\n    {\"new_Description\": \"string\", \"new_Amount\": \"decimal\", \"new_Active\": \"bool\"},\r\n)\r\nprint(created)  # ['new_Description', 'new_Amount', 'new_Active']\r\n```\r\n\r\nSupported type strings: `\"string\"` / `\"text\"`, `\"int\"` / `\"integer\"`, `\"decimal\"` / `\"money\"`, `\"float\"` / `\"double\"`, `\"datetime\"` / `\"date\"`, `\"bool\"` / `\"boolean\"`, `\"file\"`, and `Enum` subclasses (for local option sets).\r\n\r\n**Choice (picklist) column via SDK:**\r\n\r\n```python\r\nfrom enum import IntEnum\r\n\r\nclass BudgetStatus(IntEnum):\r\n    DRAFT = 100000000\r\n    APPROVED = 100000001\r\n    REJECTED = 100000002\r\n\r\ncreated = client.tables.add_columns(\r\n    \"new_ProjectBudget\",\r\n    {\"new_Status\": BudgetStatus},\r\n)\r\n```\r\n\r\n**Web API approach (needed for column types the SDK doesn't support — e.g., currency with precision, memo with custom max length):**\r\n\r\n```python\r\n# Currency column\r\nattribute = {\r\n    \"@odata.type\": \"Microsoft.Dynamics.CRM.MoneyAttributeMetadata\",\r\n    \"SchemaName\": \"new_amount\",\r\n    \"DisplayName\": {\"@odata.type\": \"Microsoft.Dynamics.CRM.Label\",\r\n                    \"LocalizedLabels\": [{\"@odata.type\": \"Microsoft.Dynamics.CRM.LocalizedLabel\",\r\n                                          \"Label\": \"Amount\", \"LanguageCode\": 1033}]},\r\n    \"RequiredLevel\": {\"Value\": \"None\"},\r\n    \"MinValue\": 0,\r\n    \"MaxValue\": 1000000000,\r\n    \"Precision\": 2,\r\n    \"PrecisionSource\": 2\r\n}\r\n# POST to /api/data/v9.2/EntityDefinitions(LogicalName='new_projectbudget')/Attributes\r\n```\r\n\r\n---\r\n\r\n## Lookup Columns and Relationships\r\n\r\n**SDK approach — simple lookup (preferred):**\r\n\r\n```python\r\nresult = client.tables.create_lookup_field(\r\n    referencing_table=\"new_projectbudget\",\r\n    lookup_field_name=\"new_AccountId\",\r\n    referenced_table=\"account\",\r\n    display_name=\"Account\",\r\n    solution=\"MySolution\",\r\n)\r\nprint(f\"Created lookup: {result.lookup_schema_name}\")\r\n```\r\n\r\n**SDK approach — full control over 1:N relationship:**\r\n\r\n```python\r\nfrom PowerPlatform.Dataverse.models.relationship import (\r\n    LookupAttributeMetadata,\r\n    OneToManyRelationshipMetadata,\r\n    CascadeConfiguration,\r\n)\r\nfrom PowerPlatform.Dataverse.models.labels import Label, LocalizedLabel\r\nfrom PowerPlatform.Dataverse.common.constants import CASCADE_BEHAVIOR_REMOVE_LINK\r\n\r\nlookup = LookupAttributeMetadata(\r\n    schema_name=\"new_AccountId\",\r\n    display_name=Label(localized_labels=[LocalizedLabel(label=\"Account\", language_code=1033)]),\r\n)\r\n\r\nrelationship = OneToManyRelationshipMetadata(\r\n    schema_name=\"account_new_projectbudget\",\r\n    referenced_entity=\"account\",\r\n    referencing_entity=\"new_projectbudget\",\r\n    referenced_attribute=\"accountid\",\r\n    cascade_configuration=CascadeConfiguration(delete=CASCADE_BEHAVIOR_REMOVE_LINK),\r\n)\r\n\r\nresult = client.tables.create_one_to_many_relationship(lookup, relationship, solution=\"MySolution\")\r\nprint(f\"Created: {result.relationship_schema_name}\")\r\n```\r\n\r\n**SDK approach — many-to-many relationship:**\r\n\r\n```python\r\nfrom PowerPlatform.Dataverse.models.relationship import ManyToManyRelationshipMetadata\r\n\r\nrelationship = ManyToManyRelationshipMetadata(\r\n    schema_name=\"new_ticket_knowledgebase\",\r\n    entity1_logical_name=\"new_ticket\",\r\n    entity2_logical_name=\"new_knowledgebase\",\r\n)\r\n\r\nresult = client.tables.create_many_to_many_relationship(relationship, solution=\"MySolution\")\r\nprint(f\"Created: {result.relationship_schema_name}\")\r\n```\r\n\r\n**Web API approach (fallback when SDK patterns don't suffice):**\r\n\r\n```python\r\nrelationship = {\r\n    \"@odata.type\": \"Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata\",\r\n    \"SchemaName\": \"account_new_projectbudget\",\r\n    \"ReferencedEntity\": \"account\",\r\n    \"ReferencingEntity\": \"new_projectbudget\",\r\n    \"Lookup\": {\r\n        \"@odata.type\": \"Microsoft.Dynamics.CRM.LookupAttributeMetadata\",\r\n        \"SchemaName\": \"new_AccountId\",\r\n        \"DisplayName\": {\"@odata.type\": \"Microsoft.Dynamics.CRM.Label\",\r\n                        \"LocalizedLabels\": [{\"@odata.type\": \"Microsoft.Dynamics.CRM.LocalizedLabel\",\r\n                                              \"Label\": \"Account\", \"LanguageCode\": 1033}]},\r\n        \"RequiredLevel\": {\"Value\": \"None\"}\r\n    }\r\n}\r\n# POST to /api/data/v9.2/RelationshipDefinitions\r\n```\r\n\r\n**After creating a lookup — the @odata.bind navigation property:**\r\n\r\nWhen you create records that set this lookup, you need the **navigation property name** for `@odata.bind`. The navigation property name is case-sensitive and must match the entity's `$metadata` (usually the SchemaName of the lookup field, e.g., `new_AccountId`):\r\n\r\n| Navigation Property Name | `@odata.bind` key | Entity set |\r\n|---|---|---|\r\n| `new_AccountId` | `new_AccountId@odata.bind` | `/accounts(<guid>)` |\r\n| `new_ParentTicketId` | `new_ParentTicketId@odata.bind` | `/new_tickets(<guid>)` |\r\n\r\n**Common mistake:** Using the logical name (lowercase) like `new_accountid@odata.bind` returns a 400 error. Navigation property names are case-sensitive and must match the entity's `$metadata`.\r\n\r\n---\r\n\r\n## Adding a Table to a Solution\r\n\r\nAfter creating a table via API, add it to your solution so it gets pulled on export:\r\n```\r\npac solution add-solution-component \\\r\n  --solutionUniqueName <SOLUTION_NAME> \\\r\n  --component <SchemaName> \\\r\n  --componentType 1 \\\r\n  --environment <url>\r\n```\r\nComponent type `1` = Entity (Table). See dv-solution for the full type code list.\r\n\r\nOr via Web API:\r\n```python\r\n# POST to /api/data/v9.2/AddSolutionComponent\r\nbody = {\r\n    \"ComponentId\": \"<entity-metadata-id>\",\r\n    \"ComponentType\": 1,       # 1 = Entity\r\n    \"SolutionUniqueName\": \"<SOLUTION_NAME>\",\r\n    \"AddRequiredComponents\": True\r\n}\r\n```\r\n\r\n---\r\n\r\n## Forms and Views\r\n\r\n`systemform` (forms) and `savedquery` (views) are **ordinary entities** — create/read/modify them with the **SDK's record CRUD** (no `urllib`). Only **publishing** (`PublishXml`, an unbound action) needs `dataverse api request`.\r\n\r\n**Quick reference:**\r\n- **Create form:** `client.records.create(\"systemform\", {...formxml..., \"type\": 2})` (`2`=Main, `7`=Quick Create, `6`=Quick View, `11`=Card).\r\n- **Modify form:** `records.list(\"systemform\", filter=...)` for a template → mutate `formxml` → `records.update(\"systemform\", id, {...})` → publish.\r\n- **Publish:** `dataverse api request` POST `PublishXml` — required for changes to take effect.\r\n- **Create view:** `client.records.create(\"savedquery\", {...fetchxml..., ...layoutxml...})` (`0`=standard, `1`=advanced find, `2`=associated, `4`=quick find).\r\n\r\nFull code, the template recipe, the `classid` table, and publish: [`references/forms-and-views.md`](references/forms-and-views.md).\r\n\r\nKey invariants:\r\n- All `id` attributes in form XML must be unique GUIDs (`str(uuid.uuid4()).upper()`).\r\n- Do not use `python -c` for GUID generation on Windows — write a `.py` file.\r\n- Forms must be published after every create or modify, otherwise changes are invisible to users.\r\n\r\n---\r\n\r\n## Business Rules\r\n\r\nCreate business rules in the Power Apps maker portal. They are too complex to write reliably as JSON/XAML. After creation, export+unpack the solution and commit the result.\r\n\r\n---\r\n\r\n## Publisher Prefix\r\n\r\nAll custom schema names must use your solution's publisher prefix (e.g., `new_`, `contoso_`). Find yours:\r\n```\r\npac solution list --environment <url>\r\n```\r\nOr check `solutions/<SOLUTION_NAME>/Other/Solution.xml` after the first pull — look for `<CustomizationPrefix>`.\r\n\r\n---\r\n\r\n## FormXml Pitfalls\r\n\r\n- **All `id` attributes must be valid GUIDs** in `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}` format. Do not use strings like `\"general\"`.\r\n- **`labelid` is also a GUID** — not a human-readable string.\r\n- **Subgrid controls require a valid `<ViewId>`** — must be the GUID of an existing SavedQuery. Create the view first.\r\n- **Cell, section, tab, and control IDs must all be unique** across the entire form.\r\n- **Control `classid` values** — see the classid table above.\r\n\r\n**Tip:** Create forms in the maker portal and pull via `pac solution export` — use the pulled XML as a template for programmatic creation.\r\n\r\n---\r\n\r\n## After Creating Columns: Report Logical Names\r\n\r\nAfter creating columns (via Web API or MCP), **always report the actual logical names** to the user. Column names may be normalized or prefixed in ways the user doesn't expect. Summarize in a table:\r\n\r\n| Display Name | Logical Name | Type |\r\n|---|---|---|\r\n| Email | cr9ac_email | String |\r\n| Tier | cr9ac_tier | Picklist |\r\n| Customer | cr9ac_customerid | Lookup |\r\n\r\nThis prevents downstream failures when the user tries to insert data using incorrect column names.\r\n\r\n---\r\n\r\n## Common Web API Error Codes\r\n\r\n| Error Code | Meaning | Recovery |\r\n|---|---|---|\r\n| `0x80040216` | Transient metadata cache error. Column or table metadata not yet propagated. | Wait 3-5 seconds and retry. Usually succeeds on second attempt. |\r\n| `0x80048d19` | Invalid property in payload. A field name doesn't match any column on the table. | Check logical column names — use `EntityDefinitions(LogicalName='...')/Attributes` to verify. |\r\n| `0x80040237` | Schema name already exists. | Verify the column/table exists before creating a new one — it may have been created by a previous timed-out call. |\r\n| `0x8004431a` | Publisher prefix mismatch. | Ensure all schema names use the solution's publisher prefix. |\r\n| `0x80060891` | Metadata cache not ready after table creation. | Call `GET EntityDefinitions(LogicalName='...')` first to force cache refresh, then retry. |\r\n\r\nAlways translate error codes to plain English before presenting them to the user.\r\n\r\n---\r\n\r\n## Metadata Propagation Delays and Lock Contention\r\n\r\nAfter creating tables / columns / alternate keys, Dataverse runs internal metadata operations (index build, cache propagation) for 3–30 seconds. Submitting another metadata operation while these run causes lock-contention errors.\r\n\r\n**Mitigation — phased creation, not interleaved.** Create ALL tables → wait 15–30s → create ALL alternate keys → wait 15–30s → create ALL lookups. Do NOT interleave operations on the same table.\r\n\r\n**Symptoms** (any of these means propagation isn't done):\r\n- Picklist column creation fails with `0x80040216`\r\n- Lookup `@odata.bind` fails with \"Invalid property\"\r\n- `update_table` (MCP) fails with \"EntityId not found in MetadataCache\"\r\n- Lookup or alternate-key creation fails with \"another customization operation is running\"\r\n\r\nFor the `retry_metadata` helper that catches transient lock errors and the full phased-creation sequence, see [`references/metadata-propagation.md`](references/metadata-propagation.md).\r\n\r\n## Inspect Existing Schema\r\n\r\nBefore changing a model, inspect what already exists. These read-only calls return raw\r\nmetadata dictionaries (PascalCase property names) and are safe to run anytime.\r\n\r\n> Assumes `client` from the auth setup shown earlier in this skill (`from auth import get_client`).\r\n\r\n```python\r\n# Columns on a table (optionally filtered / projected)\r\ncolumns = client.tables.list_columns(\"account\", select=[\"LogicalName\", \"AttributeType\", \"SchemaName\"])\r\nfor col in columns:\r\n    print(f\"{col['LogicalName']} ({col.get('AttributeType')})\")\r\n\r\n# All relationships for one table (1:N, N:1, and N:N combined)\r\nrels = client.tables.list_table_relationships(\"account\")\r\nfor rel in rels:\r\n    print(f\"{rel['SchemaName']} -> {rel.get('@odata.type')}\")\r\n\r\n# All relationships in the environment (optionally filtered)\r\nall_rels = client.tables.list_relationships(select=[\"SchemaName\", \"ReferencedEntity\", \"ReferencingEntity\"])\r\n```\r\n\r\nFor SQL-queryable column discovery (virtual/computed columns excluded), `dv-query` also has\r\n`client.query.sql_columns(table)`.\r\n\r\n## Session Closing: Pull to Repo\r\n\r\n**After every metadata session, perform the pull-to-repo sequence** — see dv-overview \"After Any Change: Pull to Repo\" for the full export/unpack/commit commands.\r\n\r\nIf you used the `MSCRM.SolutionName` header during creation, verify components were added before exporting:\r\n```python\r\nsol = client.records.list(\"solution\",\r\n    filter=\"uniquename eq '<SOLUTION_NAME>'\", select=[\"solutionid\"], top=1).first()\r\nif sol is not None:\r\n    components = client.records.list(\"solutioncomponent\",\r\n        filter=f\"_solutionid_value eq {sol['solutionid']}\",\r\n        select=[\"componenttype\", \"objectid\"])\r\n    print(f\"{len(components)} components in the solution\")\r\n```\r\n\r\n---\r\n\r\n## Idempotent Table Creation\r\n\r\nWhen creating tables programmatically (e.g., a schema setup script that may be re-run), use a check-first pattern — query `client.tables.get()` before creating. This is explicit, avoids masking unrelated errors, and lets you branch logic based on whether the table was created or reused:\r\n\r\n```python\r\ndef ensure_table(client, schema_name, columns, solution, primary_column=\"prefix_Name\", display_name=None):\r\n    existing = client.tables.get(schema_name)\r\n    if existing:\r\n        print(f\"Reusing: {schema_name}\")\r\n        return existing\r\n    info = client.tables.create(schema_name, columns, solution=solution,\r\n                                primary_column=primary_column, display_name=display_name)\r\n    print(f\"Created: {info['table_schema_name']}\")\r\n    return info\r\n```\r\n\r\n---\r\n\r\n## Alternate Keys (Required for Upsert)\r\n\r\n`UpsertMultiple` requires an alternate key on the column(s) Dataverse should use to identify existing records. Always create alternate keys on source-system ID columns (`prefix_Src*Id`) at schema-setup time so every import is idempotent.\r\n\r\n**Quick reference:**\r\n- SDK call: `client.tables.create_alternate_key(table, key_name, [columns], display_name=...)`. Composite keys: pass multiple columns.\r\n- Use a check-first pattern with `client.tables.get_alternate_keys(table)` to skip keys that already exist — see `references/alternate-keys.md` for the `ensure_alternate_key` helper.\r\n- Index creation is **async** — for large tables, poll `client.tables.get_alternate_keys(table)` until `status == \"Active\"` before using.\r\n- Constraints: max 16 columns / 900 bytes / 10 keys per table; valid types are Integer / Decimal / String / DateTime / Lookup / OptionSet.\r\n\r\nFor SDK code samples (single + composite + idempotent + status-check), the agent decision rules for which column to pick (DB source vs Excel/CSV), and the failure-handling notes, see [`references/alternate-keys.md`](references/alternate-keys.md).\r\n\r\n## EntityDefinitions Filter Limitation\r\n\r\n**`startswith()` is NOT supported as a filter on `EntityDefinitions`.** This query will return a 400 error:\r\n\r\n```\r\nGET /api/data/v9.2/EntityDefinitions?$filter=startswith(LogicalName,'new_')  # BROKEN\r\n```\r\n\r\nTo retrieve metadata for multiple custom tables, query each table individually:\r\n```python\r\nGET /api/data/v9.2/EntityDefinitions(LogicalName='new_projectbudget')?$select=LogicalName,EntitySetName\r\n```\r\n\r\nOr query all and filter client-side:\r\n```python\r\nGET /api/data/v9.2/EntityDefinitions?$select=LogicalName,EntitySetName\r\n```\r\n\r\n---\r\n\r\n## MCP Table Creation Notes\r\n\r\nWhen using MCP `create_table` or `update_table`:\r\n\r\n- **Column types.** MCP handles most types (text, numeric, boolean, datetime, choice/multiselect, lookup/customer, file/image); global option sets, N:N, alternate keys, forms, views need SDK/Web API.\r\n- **Timeouts / cache delays.** Creation may report a timeout or stale cache; always `describe('tables/{name}')` before retrying or a follow-up `update_table` (if the table exists, skip creation).\r\n- **Self-referential lookups** (Parent → same table) are added via `update_table` after creation.\r\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}