@chill-sharp/ui-core 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/chillsharp-current-user-preferences/SKILL.md +70 -0
- package/.agents/skills/chillsharp-ui-template/SKILL.md +18 -0
- package/README.md +103 -0
- package/chill-sharp-ui-core.d.ts.map +1 -0
- package/doc/AIAssistedDevelopment/README.md +185 -0
- package/doc/AttachmentModel/README.md +173 -0
- package/doc/AuthenticationModel/README.md +213 -0
- package/doc/AuthenticationModel/how-to-integreate-auth-minimal-api.md +293 -0
- package/doc/ChillSharpClient.md +464 -0
- package/doc/ClientGeneration/README.md +172 -0
- package/doc/ComplianceGuide/README.md +178 -0
- package/doc/Configuration/README.md +94 -0
- package/doc/CurrentUserPreferences.md +114 -0
- package/doc/DateTimePolicy/README.md +154 -0
- package/doc/DateTimeSerialization.md +423 -0
- package/doc/Endpoints.md +260 -0
- package/doc/HowTo/01-simple-blog-sqlite.md +153 -0
- package/doc/HowTo/02-blog-schema-labels.md +140 -0
- package/doc/HowTo/03-authentication.md +218 -0
- package/doc/HowTo/04-blog-posts-one-to-many.md +194 -0
- package/doc/HowTo/05-docker-env-variables.md +274 -0
- package/doc/HowTo/06-chunk-transactions-autocomplete.md +196 -0
- package/doc/Mcp/ChatGPT.md +291 -0
- package/doc/Mcp/README.md +799 -0
- package/doc/MenuGuide/README.md +49 -0
- package/doc/ModelPreparation.md +255 -0
- package/doc/PermissionModel/README.md +277 -0
- package/doc/README.md +228 -0
- package/doc/ReferenceExistence.md +130 -0
- package/doc/RegisterContext.md +217 -0
- package/doc/UiCore/CRUD.md +170 -0
- package/doc/UiCore/README.md +13 -0
- package/doc/ValidationModel/README.md +117 -0
- package/doc/it/AIAssistedDevelopment/README.md +185 -0
- package/doc/it/AttachmentModel/README.md +173 -0
- package/doc/it/AuthenticationModel/README.md +171 -0
- package/doc/it/AuthenticationModel/how-to-integreate-auth-minimal-api.md +292 -0
- package/doc/it/ChillSharpClient.md +464 -0
- package/doc/it/ClientGeneration/README.md +152 -0
- package/doc/it/ComplianceGuide/README.md +178 -0
- package/doc/it/Configuration/README.md +94 -0
- package/doc/it/CurrentUserPreferences.md +114 -0
- package/doc/it/DateTimePolicy/README.md +154 -0
- package/doc/it/DateTimeSerialization.md +423 -0
- package/doc/it/Endpoints.md +260 -0
- package/doc/it/HowTo/01-simple-blog-sqlite.md +152 -0
- package/doc/it/HowTo/02-blog-schema-labels.md +139 -0
- package/doc/it/HowTo/03-authentication.md +221 -0
- package/doc/it/HowTo/04-blog-posts-one-to-many.md +193 -0
- package/doc/it/HowTo/05-docker-env-variables.md +268 -0
- package/doc/it/HowTo/06-chunk-transactions-autocomplete.md +196 -0
- package/doc/it/Mcp/ChatGPT.md +291 -0
- package/doc/it/Mcp/README.md +799 -0
- package/doc/it/MenuGuide/README.md +49 -0
- package/doc/it/ModelPreparation.md +254 -0
- package/doc/it/PermissionModel/README.md +190 -0
- package/doc/it/README.md +172 -0
- package/doc/it/ReferenceExistence.md +130 -0
- package/doc/it/RegisterContext.md +218 -0
- package/doc/it/UiCore/CRUD.md +170 -0
- package/doc/it/UiCore/README.md +13 -0
- package/doc/it/ValidationModel/README.md +117 -0
- package/fesm2022/chill-sharp-ui-core.mjs +16725 -0
- package/fesm2022/chill-sharp-ui-core.mjs.map +1 -0
- package/index.d.ts +6 -0
- package/lib/chill-sharp-ui-root.component.d.ts +6 -0
- package/lib/chill-sharp-ui-root.component.d.ts.map +1 -0
- package/lib/chill-sharp-ui.routes.d.ts +3 -0
- package/lib/chill-sharp-ui.routes.d.ts.map +1 -0
- package/lib/chill.config.d.ts +5 -0
- package/lib/chill.config.d.ts.map +1 -0
- package/lib/layouts/auth-shell.component.d.ts +8 -0
- package/lib/layouts/auth-shell.component.d.ts.map +1 -0
- package/lib/layouts/workspace-page.component.d.ts +49 -0
- package/lib/layouts/workspace-page.component.d.ts.map +1 -0
- package/lib/lib/chill-form.component.d.ts +151 -0
- package/lib/lib/chill-form.component.d.ts.map +1 -0
- package/lib/lib/chill-i18n-button-label.component.d.ts +27 -0
- package/lib/lib/chill-i18n-button-label.component.d.ts.map +1 -0
- package/lib/lib/chill-i18n-label.component.d.ts +30 -0
- package/lib/lib/chill-i18n-label.component.d.ts.map +1 -0
- package/lib/lib/chill-json-input.component.d.ts +31 -0
- package/lib/lib/chill-json-input.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts +12 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-boolean-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts +17 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-editor-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts +45 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-lookup-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts +19 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-scalar-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts +12 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-select-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts +13 -0
- package/lib/lib/chill-polymorphic-input-controls/chill-polymorphic-textarea-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-input.component.d.ts +452 -0
- package/lib/lib/chill-polymorphic-input.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-boolean-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-lookup-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-number-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts +8 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-temporal-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts +7 -0
- package/lib/lib/chill-polymorphic-output-controls/chill-polymorphic-output-value-control.component.d.ts.map +1 -0
- package/lib/lib/chill-polymorphic-output.component.d.ts +75 -0
- package/lib/lib/chill-polymorphic-output.component.d.ts.map +1 -0
- package/lib/lib/chill-table.component.d.ts +434 -0
- package/lib/lib/chill-table.component.d.ts.map +1 -0
- package/lib/lib/chill-text-editor-dialog.component.d.ts +14 -0
- package/lib/lib/chill-text-editor-dialog.component.d.ts.map +1 -0
- package/lib/lib/crud-configuration.utils.d.ts +4 -0
- package/lib/lib/crud-configuration.utils.d.ts.map +1 -0
- package/lib/lib/culture-name-options.d.ts +3 -0
- package/lib/lib/culture-name-options.d.ts.map +1 -0
- package/lib/lib/date-format-options.d.ts +3 -0
- package/lib/lib/date-format-options.d.ts.map +1 -0
- package/lib/lib/iana-time-zone-options.d.ts +3 -0
- package/lib/lib/iana-time-zone-options.d.ts.map +1 -0
- package/lib/lib/notice-transition.directive.d.ts +17 -0
- package/lib/lib/notice-transition.directive.d.ts.map +1 -0
- package/lib/lib/schema-property-dialog.component.d.ts +74 -0
- package/lib/lib/schema-property-dialog.component.d.ts.map +1 -0
- package/lib/models/chill-auth.models.d.ts +176 -0
- package/lib/models/chill-auth.models.d.ts.map +1 -0
- package/lib/models/chill-menu.models.d.ts +12 -0
- package/lib/models/chill-menu.models.d.ts.map +1 -0
- package/lib/models/chill-schema.models.d.ts +141 -0
- package/lib/models/chill-schema.models.d.ts.map +1 -0
- package/lib/models/workspace-dialog.models.d.ts +16 -0
- package/lib/models/workspace-dialog.models.d.ts.map +1 -0
- package/lib/models/workspace-task.models.d.ts +36 -0
- package/lib/models/workspace-task.models.d.ts.map +1 -0
- package/lib/pages/confirm-reset-page.component.d.ts +21 -0
- package/lib/pages/confirm-reset-page.component.d.ts.map +1 -0
- package/lib/pages/crud/attachment-upload-dialog.component.d.ts +24 -0
- package/lib/pages/crud/attachment-upload-dialog.component.d.ts.map +1 -0
- package/lib/pages/crud/crud-page.component.d.ts +244 -0
- package/lib/pages/crud/crud-page.component.d.ts.map +1 -0
- package/lib/pages/login-page.component.d.ts +21 -0
- package/lib/pages/login-page.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-role-dialog.component.d.ts +29 -0
- package/lib/pages/permissions/auth-role-dialog.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-search-select.component.d.ts +28 -0
- package/lib/pages/permissions/auth-search-select.component.d.ts.map +1 -0
- package/lib/pages/permissions/auth-user-dialog.component.d.ts +35 -0
- package/lib/pages/permissions/auth-user-dialog.component.d.ts.map +1 -0
- package/lib/pages/permissions/permission-editor.component.d.ts +55 -0
- package/lib/pages/permissions/permission-editor.component.d.ts.map +1 -0
- package/lib/pages/permissions/permissions-page.component.d.ts +38 -0
- package/lib/pages/permissions/permissions-page.component.d.ts.map +1 -0
- package/lib/pages/permissions/role-permission.component.d.ts +43 -0
- package/lib/pages/permissions/role-permission.component.d.ts.map +1 -0
- package/lib/pages/permissions/user-permission.component.d.ts +43 -0
- package/lib/pages/permissions/user-permission.component.d.ts.map +1 -0
- package/lib/pages/register-page.component.d.ts +24 -0
- package/lib/pages/register-page.component.d.ts.map +1 -0
- package/lib/pages/reset-password-page.component.d.ts +18 -0
- package/lib/pages/reset-password-page.component.d.ts.map +1 -0
- package/lib/provide-chill-sharp-ui-core.d.ts +8 -0
- package/lib/provide-chill-sharp-ui-core.d.ts.map +1 -0
- package/lib/services/chill.service.d.ts +249 -0
- package/lib/services/chill.service.d.ts.map +1 -0
- package/lib/services/workspace-dialog.service.d.ts +22 -0
- package/lib/services/workspace-dialog.service.d.ts.map +1 -0
- package/lib/services/workspace-layout.service.d.ts +13 -0
- package/lib/services/workspace-layout.service.d.ts.map +1 -0
- package/lib/services/workspace-task-registry.service.d.ts +35 -0
- package/lib/services/workspace-task-registry.service.d.ts.map +1 -0
- package/lib/services/workspace-toolbar.service.d.ts +23 -0
- package/lib/services/workspace-toolbar.service.d.ts.map +1 -0
- package/lib/services/workspace.service.d.ts +114 -0
- package/lib/services/workspace.service.d.ts.map +1 -0
- package/lib/storage-keys.d.ts +5 -0
- package/lib/storage-keys.d.ts.map +1 -0
- package/lib/tasks/crud-task/crud-task.component.d.ts +33 -0
- package/lib/tasks/crud-task/crud-task.component.d.ts.map +1 -0
- package/lib/tasks/goto-url-task/goto-url-task.component.d.ts +31 -0
- package/lib/tasks/goto-url-task/goto-url-task.component.d.ts.map +1 -0
- package/lib/workspace/confirm-message-dialog.component.d.ts +16 -0
- package/lib/workspace/confirm-message-dialog.component.d.ts.map +1 -0
- package/lib/workspace/entity-options-dialog.component.d.ts +29 -0
- package/lib/workspace/entity-options-dialog.component.d.ts.map +1 -0
- package/lib/workspace/external-task-api.d.ts +2 -0
- package/lib/workspace/external-task-api.d.ts.map +1 -0
- package/lib/workspace/user-profile-dialog.component.d.ts +30 -0
- package/lib/workspace/user-profile-dialog.component.d.ts.map +1 -0
- package/lib/workspace/workspace-dialog-host.component.d.ts +26 -0
- package/lib/workspace/workspace-dialog-host.component.d.ts.map +1 -0
- package/lib/workspace/workspace-menu-item-dialog.component.d.ts +61 -0
- package/lib/workspace/workspace-menu-item-dialog.component.d.ts.map +1 -0
- package/lib/workspace/workspace-menu.component.d.ts +104 -0
- package/lib/workspace/workspace-menu.component.d.ts.map +1 -0
- package/lib/workspace/workspace-taskbar.component.d.ts +14 -0
- package/lib/workspace/workspace-taskbar.component.d.ts.map +1 -0
- package/package.json +54 -0
- package/public-api.d.ts +56 -0
- package/public-api.d.ts.map +1 -0
- package/service-worker/chill-sharp-service-worker.js +166 -0
- package/styles/core-theme.scss +1268 -0
- package/template-customization/upgrade.ps1.template +342 -0
- package/template-customization/upgrade.sh.template +271 -0
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
# ChillSharp MCP Module
|
|
2
|
+
|
|
3
|
+
Versione italiana: [Italiano](../it/Mcp/README.md)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
This document describes the `ChillSharp.Mcp` module, how to register it in an ASP.NET Core host, and how to prepare a `DbContext` and model so AI agents can consume the exposed schema and query surface efficiently.
|
|
7
|
+
|
|
8
|
+
`ChillSharp.Mcp` uses the official MCP C# SDK and exposes a Model Context Protocol server backed by your ChillSharp context.
|
|
9
|
+
|
|
10
|
+
For a focused guide to connecting this MCP server from ChatGPT, see [HOW-TO: Connect ChillSharp MCP to ChatGPT](ChatGPT.md).
|
|
11
|
+
|
|
12
|
+
## Goals
|
|
13
|
+
|
|
14
|
+
After setup, an MCP client can:
|
|
15
|
+
|
|
16
|
+
- discover the MCP-enabled schemas exposed by your host
|
|
17
|
+
- inspect full entity and query schemas before sending requests
|
|
18
|
+
- read schema-level and property-level MCP descriptions
|
|
19
|
+
- execute only the queries that you explicitly expose through `EnableMCP`
|
|
20
|
+
- run DTO operations such as lookup, find, create, update, delete, autocomplete, validate, and chunk
|
|
21
|
+
- operate under bearer-authenticated user permissions and API-key limitations
|
|
22
|
+
|
|
23
|
+
## Registered Tools
|
|
24
|
+
|
|
25
|
+
The module registers these MCP tools:
|
|
26
|
+
|
|
27
|
+
- `ChillSharp get-schema-list`
|
|
28
|
+
- `ChillSharp get-schema`
|
|
29
|
+
- `ChillSharp query`
|
|
30
|
+
- `ChillSharp lookup`
|
|
31
|
+
- `ChillSharp find`
|
|
32
|
+
- `ChillSharp create`
|
|
33
|
+
- `ChillSharp update`
|
|
34
|
+
- `ChillSharp delete`
|
|
35
|
+
- `ChillSharp autocomplete-entity`
|
|
36
|
+
- `ChillSharp autocomplete-query`
|
|
37
|
+
- `ChillSharp validate-entity`
|
|
38
|
+
- `ChillSharp validate-query`
|
|
39
|
+
- `ChillSharp chunk`
|
|
40
|
+
|
|
41
|
+
### `ChillSharp get-schema-list`
|
|
42
|
+
|
|
43
|
+
Returns only the schemas that are MCP-enabled.
|
|
44
|
+
|
|
45
|
+
Use this as the discovery entry point. It tells the AI which entities and queries are intended to be consumed through MCP.
|
|
46
|
+
|
|
47
|
+
### `ChillSharp get-schema`
|
|
48
|
+
|
|
49
|
+
Returns the full `ChillDtoSchema` for one MCP-enabled entity or query type.
|
|
50
|
+
|
|
51
|
+
This is the most important introspection tool. It includes:
|
|
52
|
+
|
|
53
|
+
- schema metadata
|
|
54
|
+
- query related type information
|
|
55
|
+
- relation metadata inferred from collections annotated with `ChillRelationAttribute`
|
|
56
|
+
- schema-level `MCPDescription`
|
|
57
|
+
- all schema properties
|
|
58
|
+
- property-level `MCPDescription` for each property
|
|
59
|
+
- reference type information
|
|
60
|
+
- `simplePropertyType`, an agent-friendly type string for payload construction
|
|
61
|
+
|
|
62
|
+
In practice, this is how an AI learns:
|
|
63
|
+
|
|
64
|
+
- what the object represents
|
|
65
|
+
- what each property means
|
|
66
|
+
- which query returns which entity type
|
|
67
|
+
- which properties are references to other Chill types
|
|
68
|
+
- which value shape each request property requires
|
|
69
|
+
|
|
70
|
+
Agents should not invent request objects. Use `get-schema` as the contract, copy exact property names from the schema, and send values that match each property's `simplePropertyType`.
|
|
71
|
+
|
|
72
|
+
For entity schemas, `Relations` describes child relation collections that the UI can wire automatically at runtime. Each relation entry includes:
|
|
73
|
+
|
|
74
|
+
- `ChillType`, the child or relation-entity type exposed by the collection
|
|
75
|
+
- `ChillQuery`, the query type to use for filtered child lookup when one can be resolved
|
|
76
|
+
- `FixedValues`, default values to inject when creating a child entity
|
|
77
|
+
- `FixedQueryValues`, default query filters to apply when browsing existing related entities
|
|
78
|
+
- `RelationLabel`, the label GUID and default texts derived from the collection's `ChillRelationAttribute`
|
|
79
|
+
|
|
80
|
+
When a relation can be tied back to the current parent through an annotated child reference, ChillSharp emits the magic value `@{mock}` inside `FixedValues` and `FixedQueryValues`. UI clients replace that token with the current parent entity for the matching FK/reference property name.
|
|
81
|
+
|
|
82
|
+
Common `simplePropertyType` values are:
|
|
83
|
+
|
|
84
|
+
| simplePropertyType | Payload value |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `guid` | GUID string |
|
|
87
|
+
| `int` | JSON number without decimals |
|
|
88
|
+
| `decimal` | JSON number |
|
|
89
|
+
| `date` | date string |
|
|
90
|
+
| `time` | time string |
|
|
91
|
+
| `datetime` | date-time string |
|
|
92
|
+
| `duration` | duration string or numeric value accepted by the host |
|
|
93
|
+
| `bool` | JSON boolean |
|
|
94
|
+
| `string`, `text` | JSON string |
|
|
95
|
+
| `json` | JSON object, array, or JSON string according to the field contract |
|
|
96
|
+
| `chill-entity` | `ChillDtoEntity` reference with `ChillType` and `Guid` |
|
|
97
|
+
| `chill-entity-collection` | array of `ChillDtoEntity` references |
|
|
98
|
+
| `chill-query` | query DTO matching the referenced query schema |
|
|
99
|
+
|
|
100
|
+
### `ChillSharp query`
|
|
101
|
+
|
|
102
|
+
Executes a ChillSharp query only when its related returned entity is MCP-enabled.
|
|
103
|
+
|
|
104
|
+
The recommended workflow is:
|
|
105
|
+
|
|
106
|
+
1. call `ChillSharp get-schema-list`
|
|
107
|
+
2. call `ChillSharp get-schema` on the selected query type
|
|
108
|
+
3. read descriptions, properties, and returned type
|
|
109
|
+
4. send a `ChillDtoQuery` payload to `ChillSharp query`
|
|
110
|
+
|
|
111
|
+
The `Properties` object must contain only accepted input property names from the query schema. For each value, follow `simplePropertyType`; for example, send a string for `string`, a number for `int` or `decimal`, and a `ChillDtoEntity` reference for `chill-entity`.
|
|
112
|
+
|
|
113
|
+
Read each query property's `MCPDescription` to infer how that input searches. Descriptions should tell the agent whether a property behaves as an exact value, contains-style text search, range boundary, lookup reference, status selector, or another custom query rule. If the description is missing or does not specify matching behavior, assume exact-match equals.
|
|
114
|
+
|
|
115
|
+
Every Chill query also supports `Properties.FullTextSearch`. Use it for broad keyword search across the query target when the user is not asking for a specific structured filter.
|
|
116
|
+
|
|
117
|
+
`FullTextSearch` searches against the entity `FullTextContent` generated by ChillSharp. Unquoted text without advanced selectors is normalized, split on whitespace, and AND-matched, so every token must be present. Brackets plus standalone `and`/`or` operators outside quotes enable grouped boolean search. Search the literal words `and` or `or` by wrapping them in matching quotes. Text enclosed by matching single or double quotes is searched as one normalized phrase with word boundaries:
|
|
118
|
+
|
|
119
|
+
| Search text | Meaning |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| `la nazione` | Match records containing both `la` and `nazione` as tokens, in any position. |
|
|
122
|
+
| `[la and nazione] or roma` | Match records containing both `la` and `nazione`, or records containing `roma`. |
|
|
123
|
+
| `"and"` | Search the literal keyword `and` instead of the boolean operator. |
|
|
124
|
+
| `"la nazione"` | Match the exact phrase as whole words, for example `bla bla la nazione bla bla`, but not `bla bla della nazione bla bla`. |
|
|
125
|
+
| `"*la nazione"` or `"%la nazione"` | Relax the left boundary, so `della nazione` can match. |
|
|
126
|
+
| `"la nazione*"` or `"la nazione%"` | Relax the right boundary, so a suffix can match. |
|
|
127
|
+
| `"la*nazione"` or `"la%nazione"` | Treat the middle wildcard as a token separator and apply normal AND token matching. |
|
|
128
|
+
|
|
129
|
+
### `ChillSharp lookup`
|
|
130
|
+
|
|
131
|
+
Executes a generic full-text lookup against an MCP-enabled entity schema.
|
|
132
|
+
|
|
133
|
+
Use a `ChillDtoQuery` payload with:
|
|
134
|
+
|
|
135
|
+
- `ChillType` set to an entity type such as `Model.Blog`
|
|
136
|
+
- `Properties.FullTextSearch` containing the search text
|
|
137
|
+
- optional `ResultProperties`, `Pagination`, and `Ordering`
|
|
138
|
+
|
|
139
|
+
`Properties.FullTextSearch` uses the same quoted phrase and wildcard rules described under `ChillSharp query`.
|
|
140
|
+
|
|
141
|
+
### `ChillSharp find`
|
|
142
|
+
|
|
143
|
+
Finds one MCP-enabled entity by `ChillType` and `Guid`.
|
|
144
|
+
|
|
145
|
+
Use a `ChillDtoEntity` payload with:
|
|
146
|
+
|
|
147
|
+
- `ChillType` set to an entity type such as `Model.Blog`
|
|
148
|
+
- `Guid` set to the record identifier
|
|
149
|
+
|
|
150
|
+
The tool returns `null` when no matching record exists.
|
|
151
|
+
|
|
152
|
+
### `ChillSharp create`
|
|
153
|
+
|
|
154
|
+
Creates a new MCP-enabled entity and returns the persisted `ChillDtoEntity`.
|
|
155
|
+
|
|
156
|
+
Use `ChillSharp get-schema` first, then send a `ChillDtoEntity` payload with:
|
|
157
|
+
|
|
158
|
+
- `ChillType` set to an entity type such as `Model.Blog`
|
|
159
|
+
- optional `Guid` when the client chooses the identifier
|
|
160
|
+
- `Properties` containing annotated field values
|
|
161
|
+
|
|
162
|
+
### `ChillSharp update`
|
|
163
|
+
|
|
164
|
+
Updates an existing MCP-enabled entity and returns the updated `ChillDtoEntity`.
|
|
165
|
+
|
|
166
|
+
Use a `ChillDtoEntity` payload with:
|
|
167
|
+
|
|
168
|
+
- `ChillType` set to an entity type such as `Model.Blog`
|
|
169
|
+
- `Guid` set to an existing record
|
|
170
|
+
- `Properties` containing the fields to update
|
|
171
|
+
|
|
172
|
+
### `ChillSharp delete`
|
|
173
|
+
|
|
174
|
+
Deletes an existing MCP-enabled entity identified by `ChillType` and `Guid`.
|
|
175
|
+
|
|
176
|
+
This is a mutating operation. A client should normally call `ChillSharp find` first to confirm the exact record before deletion.
|
|
177
|
+
|
|
178
|
+
### `ChillSharp autocomplete-entity`
|
|
179
|
+
|
|
180
|
+
Applies ChillSharp entity autocomplete logic without persisting changes.
|
|
181
|
+
|
|
182
|
+
Use this before `create` or `update` when the entity model calculates labels, URLs, references, or other derived values.
|
|
183
|
+
|
|
184
|
+
### `ChillSharp autocomplete-query`
|
|
185
|
+
|
|
186
|
+
Applies ChillSharp query autocomplete logic without executing the query.
|
|
187
|
+
|
|
188
|
+
Use this when query inputs have dependent or calculated values.
|
|
189
|
+
|
|
190
|
+
### `ChillSharp validate-entity`
|
|
191
|
+
|
|
192
|
+
Validates an MCP-enabled entity DTO and returns ChillSharp validation errors without persisting changes.
|
|
193
|
+
|
|
194
|
+
Use this before `create` or `update` when the host model exposes validation rules.
|
|
195
|
+
|
|
196
|
+
### `ChillSharp validate-query`
|
|
197
|
+
|
|
198
|
+
Validates an MCP-enabled query DTO and returns ChillSharp validation errors without executing the query.
|
|
199
|
+
|
|
200
|
+
Use this before `query` when the query type exposes validation rules.
|
|
201
|
+
|
|
202
|
+
### `ChillSharp chunk`
|
|
203
|
+
|
|
204
|
+
Executes a list of `ChillOperation` items and returns the updated operation list.
|
|
205
|
+
|
|
206
|
+
Supported verbs are:
|
|
207
|
+
|
|
208
|
+
- `transaction`
|
|
209
|
+
- `query`
|
|
210
|
+
- `find`
|
|
211
|
+
- `create`
|
|
212
|
+
- `update`
|
|
213
|
+
- `delete`
|
|
214
|
+
- `autocomplete`
|
|
215
|
+
- `validate`
|
|
216
|
+
- `commit`
|
|
217
|
+
|
|
218
|
+
Each operation is checked for MCP visibility before any operation executes. If one operation targets a non-MCP-enabled schema, the whole chunk is rejected.
|
|
219
|
+
|
|
220
|
+
For `query`, `autocomplete`, and `validate` operations that use a query payload, set `Query`. For entity operations, set `Entity`.
|
|
221
|
+
|
|
222
|
+
## Basic host setup
|
|
223
|
+
|
|
224
|
+
```csharp
|
|
225
|
+
using ChillSharp.Api;
|
|
226
|
+
using Microsoft.EntityFrameworkCore;
|
|
227
|
+
|
|
228
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
229
|
+
|
|
230
|
+
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
231
|
+
options.UseSqlite("Data Source=app.db"));
|
|
232
|
+
|
|
233
|
+
builder.Services.AddChillApi<AppDbContext>(options =>
|
|
234
|
+
{
|
|
235
|
+
options.ProtectedApi = true;
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
var app = builder.Build();
|
|
239
|
+
|
|
240
|
+
app.UseAuthentication();
|
|
241
|
+
app.UseAuthorization();
|
|
242
|
+
app.MapChillApi();
|
|
243
|
+
app.Run();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
When `EnableMcpApi` remains `true`, the MCP module is enabled by default as part of `AddChillApi<TContext>()`.
|
|
247
|
+
|
|
248
|
+
## Agent connection URL
|
|
249
|
+
|
|
250
|
+
Agents and MCP clients connect to the MCP HTTP transport endpoint, not to the normal ChillSharp REST endpoints.
|
|
251
|
+
|
|
252
|
+
With the default configuration, use:
|
|
253
|
+
|
|
254
|
+
```text
|
|
255
|
+
{host}/api/chill-mcp
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Local examples:
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
http://localhost:5000/api/chill-mcp
|
|
262
|
+
https://localhost:5001/api/chill-mcp
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Do not configure agents to use `/api/chill`, `/api/chill/query`, or the Swagger URL. Those are regular REST API endpoints. The MCP SDK endpoint is `/api/chill-mcp` by default.
|
|
266
|
+
|
|
267
|
+
The final URL is based on two settings:
|
|
268
|
+
|
|
269
|
+
- `ChillApiOptions.ApiBasePath`, default `/api`
|
|
270
|
+
- `ChillMcpOptions.RoutePattern`, default `/api/chill-mcp`
|
|
271
|
+
|
|
272
|
+
The default MCP route is normalized to the current API base path. That means:
|
|
273
|
+
|
|
274
|
+
| API base path | MCP route to use |
|
|
275
|
+
| --- | --- |
|
|
276
|
+
| `/api` | `/api/chill-mcp` |
|
|
277
|
+
| `/backend` | `/backend/chill-mcp` |
|
|
278
|
+
| empty base path | `/chill-mcp` |
|
|
279
|
+
|
|
280
|
+
If you configure a custom MCP route:
|
|
281
|
+
|
|
282
|
+
```csharp
|
|
283
|
+
builder.Services.AddChillMcpApi<AppDbContext>(options =>
|
|
284
|
+
{
|
|
285
|
+
options.RoutePattern = "mcp";
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
then the route is relative to the ChillSharp API base path, so the default API base path produces:
|
|
290
|
+
|
|
291
|
+
```text
|
|
292
|
+
{host}/api/mcp
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
If you configure an absolute route:
|
|
296
|
+
|
|
297
|
+
```csharp
|
|
298
|
+
builder.Services.AddChillMcpApi<AppDbContext>(options =>
|
|
299
|
+
{
|
|
300
|
+
options.RoutePattern = "/mcp";
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
then agents should connect to:
|
|
305
|
+
|
|
306
|
+
```text
|
|
307
|
+
{host}/mcp
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
When `ProtectedApi = true`, the MCP endpoint requires authentication. Configure the agent or MCP client to send:
|
|
311
|
+
|
|
312
|
+
```http
|
|
313
|
+
Authorization: Bearer <access-token>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Disable MCP globally
|
|
317
|
+
|
|
318
|
+
```csharp
|
|
319
|
+
builder.Services.AddChillApi<AppDbContext>(options =>
|
|
320
|
+
{
|
|
321
|
+
options.EnableMcpApi = false;
|
|
322
|
+
});
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Register the module directly
|
|
326
|
+
|
|
327
|
+
If you need direct module registration:
|
|
328
|
+
|
|
329
|
+
```csharp
|
|
330
|
+
using ChillSharp.Mcp.Api;
|
|
331
|
+
|
|
332
|
+
builder.Services.AddChillMcpApi<AppDbContext>(options =>
|
|
333
|
+
{
|
|
334
|
+
options.Enabled = true;
|
|
335
|
+
options.RoutePattern = "/api/chill-mcp";
|
|
336
|
+
});
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Context requirements
|
|
340
|
+
|
|
341
|
+
Your host context must:
|
|
342
|
+
|
|
343
|
+
- inherit from `DbContext`
|
|
344
|
+
- implement `IChillContext`
|
|
345
|
+
- implement `IChillSchemaDbContext`
|
|
346
|
+
- include the Chill schema model in `OnModelCreating`
|
|
347
|
+
|
|
348
|
+
Typical shape:
|
|
349
|
+
|
|
350
|
+
```csharp
|
|
351
|
+
using ChillSharp;
|
|
352
|
+
using ChillSharp.Schema;
|
|
353
|
+
using Microsoft.EntityFrameworkCore;
|
|
354
|
+
|
|
355
|
+
public class AppDbContext : DbContext, IChillContext, IChillSchemaDbContext
|
|
356
|
+
{
|
|
357
|
+
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
|
358
|
+
|
|
359
|
+
public string GetChillTypePrefix()
|
|
360
|
+
{
|
|
361
|
+
return "MyCompany.MyProduct.Data";
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
public string GetPrimaryCultureName()
|
|
365
|
+
{
|
|
366
|
+
return "en-US";
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
public string GetSecondaryCultureName()
|
|
370
|
+
{
|
|
371
|
+
return "it-IT";
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
public string GetCurrentUserName()
|
|
375
|
+
{
|
|
376
|
+
return Environment.UserName;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
380
|
+
{
|
|
381
|
+
base.OnModelCreating(modelBuilder);
|
|
382
|
+
modelBuilder.AddChillSchemaModel();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Authentication
|
|
388
|
+
|
|
389
|
+
The MCP endpoint is meant to run behind bearer authentication.
|
|
390
|
+
|
|
391
|
+
If the host uses:
|
|
392
|
+
|
|
393
|
+
```csharp
|
|
394
|
+
builder.Services.AddChillApi<AppDbContext>(options =>
|
|
395
|
+
{
|
|
396
|
+
options.ProtectedApi = true;
|
|
397
|
+
});
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
then the mapped MCP endpoint also requires authentication.
|
|
401
|
+
|
|
402
|
+
This is important because MCP exposure should usually be scoped to a user or API key, not to anonymous callers.
|
|
403
|
+
|
|
404
|
+
## ChatGPT OAuth Connection
|
|
405
|
+
|
|
406
|
+
When connecting ChatGPT to a protected remote MCP server, configure ChatGPT with the public HTTPS MCP endpoint:
|
|
407
|
+
|
|
408
|
+
```text
|
|
409
|
+
https://your-domain.example/api/chill-mcp
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
If you use the ASP.NET Core Identity-backed ChillSharp auth module, ChillSharp exposes a built-in OAuth authorization-code flow with PKCE for ChatGPT and other remote MCP clients.
|
|
413
|
+
|
|
414
|
+
The default OAuth endpoints are:
|
|
415
|
+
|
|
416
|
+
| Purpose | URL |
|
|
417
|
+
| --- | --- |
|
|
418
|
+
| OAuth authorization-server metadata | `https://your-domain.example/.well-known/oauth-authorization-server` |
|
|
419
|
+
| MCP protected-resource metadata | `https://your-domain.example/.well-known/oauth-protected-resource` |
|
|
420
|
+
| Dynamic client registration | `https://your-domain.example/api/chill-auth/oauth/register` |
|
|
421
|
+
| User authorization and consent | `https://your-domain.example/api/chill-auth/oauth/authorize` |
|
|
422
|
+
| Token exchange | `https://your-domain.example/api/chill-auth/oauth/token` |
|
|
423
|
+
|
|
424
|
+
The flow is:
|
|
425
|
+
|
|
426
|
+
1. ChatGPT discovers the protected-resource and authorization-server metadata.
|
|
427
|
+
2. ChatGPT dynamically registers itself as a public OAuth client.
|
|
428
|
+
3. The user is redirected to the ChillSharp authorization page.
|
|
429
|
+
4. The user signs in with the ASP.NET Core Identity account.
|
|
430
|
+
5. ChillSharp redirects ChatGPT back with an authorization code.
|
|
431
|
+
6. ChatGPT exchanges the code and PKCE verifier for a ChillSharp bearer access token.
|
|
432
|
+
7. ChatGPT calls the MCP endpoint with:
|
|
433
|
+
|
|
434
|
+
```http
|
|
435
|
+
Authorization: Bearer <access-token>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
So OAuth is used for user consent and token acquisition. The MCP server itself still validates the resulting bearer token through the normal ChillSharp bearer authentication handler.
|
|
439
|
+
|
|
440
|
+
Typical protected setup:
|
|
441
|
+
|
|
442
|
+
```csharp
|
|
443
|
+
builder.Services.AddIdentityCore<IdentityUser>()
|
|
444
|
+
.AddEntityFrameworkStores<AppDbContext>()
|
|
445
|
+
.AddSignInManager()
|
|
446
|
+
.AddDefaultTokenProviders();
|
|
447
|
+
|
|
448
|
+
builder.Services.AddAuthentication(ChillAuthIdentityDefaults.AuthenticationScheme)
|
|
449
|
+
.AddChillAuthBearer();
|
|
450
|
+
|
|
451
|
+
builder.Services.AddAuthorization();
|
|
452
|
+
|
|
453
|
+
builder.Services.AddChillApi<AppDbContext, IdentityUser>(options =>
|
|
454
|
+
{
|
|
455
|
+
options.ProtectedApi = true;
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
The OAuth endpoints are enabled by default for the Identity-backed auth module. You can configure them through `ChillIdentityApiOptions`:
|
|
460
|
+
|
|
461
|
+
```csharp
|
|
462
|
+
builder.Services.AddChillApi<AppDbContext, IdentityUser>(options =>
|
|
463
|
+
{
|
|
464
|
+
options.ProtectedApi = true;
|
|
465
|
+
options.OAuthBasePath = "/api/chill-auth/oauth";
|
|
466
|
+
options.OAuthProtectedResourcePath = "/api/chill-mcp";
|
|
467
|
+
options.OAuthAuthorizationCodeLifetime = TimeSpan.FromMinutes(5);
|
|
468
|
+
});
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
If you disable or replace the built-in OAuth endpoints, you can still use ChillSharp as the MCP resource server as long as your authentication handler validates the final bearer token and ChatGPT can complete an OAuth authorization-code flow elsewhere.
|
|
472
|
+
|
|
473
|
+
## How `EnableMCP` Works
|
|
474
|
+
|
|
475
|
+
The MCP tools only expose schemas whose MCP visibility is enabled.
|
|
476
|
+
|
|
477
|
+
A schema is considered MCP-enabled when either:
|
|
478
|
+
|
|
479
|
+
- `schema.EnableMCP` is `true`
|
|
480
|
+
- runtime entity options enable MCP for that Chill type
|
|
481
|
+
|
|
482
|
+
For query schemas, MCP visibility is controlled by the related returned entity. A query that returns `Model.Invoice` is visible and executable through MCP only when `Model.Invoice` is MCP-enabled. Enabling only the query type does not publish a hidden entity.
|
|
483
|
+
|
|
484
|
+
That means:
|
|
485
|
+
|
|
486
|
+
- `get-schema-list` shows only enabled schemas
|
|
487
|
+
- `get-schema` returns only enabled schemas
|
|
488
|
+
- `query` executes only queries whose related returned entity is enabled
|
|
489
|
+
- entity tools operate only on enabled entity schemas
|
|
490
|
+
- `chunk` checks every targeted query or entity before executing the batch
|
|
491
|
+
|
|
492
|
+
This gives you an explicit publish/unpublish mechanism for AI-facing database capabilities.
|
|
493
|
+
|
|
494
|
+
## Preparing A DbContext For Efficient AI Consumption
|
|
495
|
+
|
|
496
|
+
This is the most important part of the module.
|
|
497
|
+
|
|
498
|
+
An AI does not understand your model the way a human teammate does. It depends heavily on metadata, naming, descriptions, and a constrained query surface. A database can be technically exposed through MCP and still be hard for an AI to use well.
|
|
499
|
+
|
|
500
|
+
If you want an AI to consume a ChillSharp host efficiently, prepare the model intentionally.
|
|
501
|
+
|
|
502
|
+
## 1. Use clear Chill type names
|
|
503
|
+
|
|
504
|
+
Short type names like `Model.Blog`, `Model.Invoice`, and `Query.PostSearchQuery` are easier for an AI to reason about than opaque names.
|
|
505
|
+
|
|
506
|
+
Prefer:
|
|
507
|
+
|
|
508
|
+
- `Model.Customer`
|
|
509
|
+
- `Model.Invoice`
|
|
510
|
+
- `Query.InvoiceSearchQuery`
|
|
511
|
+
- `Query.ActiveCustomerQuery`
|
|
512
|
+
|
|
513
|
+
Avoid names that require internal team knowledge to decode.
|
|
514
|
+
|
|
515
|
+
Less efficient:
|
|
516
|
+
|
|
517
|
+
- `Model.TbAnag`
|
|
518
|
+
- `Query.Q1`
|
|
519
|
+
- `Query.RunDefault`
|
|
520
|
+
|
|
521
|
+
## 2. Annotate every exposed property intentionally
|
|
522
|
+
|
|
523
|
+
Use `[ChillProperty]` consistently on the properties you want in the AI-facing surface.
|
|
524
|
+
|
|
525
|
+
This affects:
|
|
526
|
+
|
|
527
|
+
- schema generation
|
|
528
|
+
- query payload expectations
|
|
529
|
+
- DTO mapping
|
|
530
|
+
- the list of fields an AI sees when it inspects a schema
|
|
531
|
+
|
|
532
|
+
If a property matters to queries, search, filtering, or results, it should usually be explicitly annotated.
|
|
533
|
+
|
|
534
|
+
## 3. Write strong `MCPDescription` text on entities
|
|
535
|
+
|
|
536
|
+
Entity and query descriptions are not decoration. They are how an AI learns business meaning.
|
|
537
|
+
|
|
538
|
+
Good entity-level descriptions explain:
|
|
539
|
+
|
|
540
|
+
- what the object is
|
|
541
|
+
- when it should be queried
|
|
542
|
+
- what it represents in business terms
|
|
543
|
+
- whether it is a primary record, a lookup table, or a derived/query-only surface
|
|
544
|
+
|
|
545
|
+
Example:
|
|
546
|
+
|
|
547
|
+
```csharp
|
|
548
|
+
[ChillEntity(
|
|
549
|
+
UniquePropertyKeyString: "4E16F6C0-6B95-4D67-98BC-9F4D0D63EAF1",
|
|
550
|
+
PrimaryLanguageLabel: "Invoice",
|
|
551
|
+
SecondaryLanguageLabel: "Fattura",
|
|
552
|
+
EnableMCP = true,
|
|
553
|
+
MCPDescription = "Customer invoice header. Use this schema to inspect invoice number, issue date, customer, total amount, and payment state.")]
|
|
554
|
+
public class Invoice : ChillEntity
|
|
555
|
+
{
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
That is much more useful than:
|
|
560
|
+
|
|
561
|
+
- `"Invoice entity"`
|
|
562
|
+
- `"Main table"`
|
|
563
|
+
|
|
564
|
+
## 4. Write strong `MCPDescription` text on properties
|
|
565
|
+
|
|
566
|
+
Property descriptions matter even more.
|
|
567
|
+
|
|
568
|
+
When an AI receives `get-schema`, each property can carry its own `MCPDescription`. This is often the difference between a correct query and a wrong one.
|
|
569
|
+
|
|
570
|
+
Good property descriptions explain:
|
|
571
|
+
|
|
572
|
+
- the business meaning
|
|
573
|
+
- allowed or expected content
|
|
574
|
+
- units or format
|
|
575
|
+
- whether the field is a lookup, reference, status, code, or free text
|
|
576
|
+
- whether the field is returned, filterable, computed, or informational
|
|
577
|
+
- for query properties, whether matching is exact, contains-style, range-based, lookup-based, or custom
|
|
578
|
+
|
|
579
|
+
When a query property's `MCPDescription` does not explain matching behavior, agents should assume exact-match equals. If you want contains, prefix, range, fuzzy, or domain-specific behavior, say so explicitly in the description.
|
|
580
|
+
|
|
581
|
+
Example:
|
|
582
|
+
|
|
583
|
+
```csharp
|
|
584
|
+
[ChillProperty(
|
|
585
|
+
UniquePropertyKeyString: "50B1BB6C-D794-41E4-A85C-D4F9D7A6FA7E",
|
|
586
|
+
PrimaryLanguageLabel: "Invoice number",
|
|
587
|
+
SecondaryLanguageLabel: "Numero fattura",
|
|
588
|
+
MCPDescription = "Human-readable accounting document number shown to users and used in external communication.")]
|
|
589
|
+
public string InvoiceNumber { get; set; } = string.Empty;
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
And:
|
|
593
|
+
|
|
594
|
+
```csharp
|
|
595
|
+
[ChillProperty(
|
|
596
|
+
UniquePropertyKeyString: "A18E7754-D8F7-45FE-B8A8-EA762A4EC9E6",
|
|
597
|
+
PrimaryLanguageLabel: "Payment status",
|
|
598
|
+
SecondaryLanguageLabel: "Stato pagamento",
|
|
599
|
+
MCPDescription = "Current payment lifecycle status. Expected values are Draft, Issued, PartiallyPaid, Paid, and Cancelled.")]
|
|
600
|
+
public string PaymentStatus { get; set; } = string.Empty;
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
These descriptions are returned by `ChillSharp get-schema`.
|
|
604
|
+
|
|
605
|
+
## 5. Prefer purpose-built query types over exposing everything
|
|
606
|
+
|
|
607
|
+
AI works better when it has a small number of well-described queries instead of one giant ambiguous surface.
|
|
608
|
+
|
|
609
|
+
Prefer several clear query types such as:
|
|
610
|
+
|
|
611
|
+
- `Query.OpenInvoiceQuery`
|
|
612
|
+
- `Query.InvoiceByCustomerQuery`
|
|
613
|
+
- `Query.ActiveSubscriptionQuery`
|
|
614
|
+
|
|
615
|
+
instead of forcing the AI to infer everything from one generic catch-all query.
|
|
616
|
+
|
|
617
|
+
Each query should have:
|
|
618
|
+
|
|
619
|
+
- a clear name
|
|
620
|
+
- a clear purpose
|
|
621
|
+
- well-described input properties
|
|
622
|
+
- a predictable related entity type
|
|
623
|
+
|
|
624
|
+
## 6. Keep query inputs narrow and meaningful
|
|
625
|
+
|
|
626
|
+
A query with twenty optional inputs and vague meanings is hard for humans and harder for AI.
|
|
627
|
+
|
|
628
|
+
Prefer a query surface where each input has a strong purpose.
|
|
629
|
+
|
|
630
|
+
Good:
|
|
631
|
+
|
|
632
|
+
- `Customer`
|
|
633
|
+
- `FromIssueDate`
|
|
634
|
+
- `ToIssueDate`
|
|
635
|
+
- `PaymentStatus`
|
|
636
|
+
|
|
637
|
+
Less good:
|
|
638
|
+
|
|
639
|
+
- `Key1`
|
|
640
|
+
- `Filter`
|
|
641
|
+
- `Mode`
|
|
642
|
+
- `ExtraData`
|
|
643
|
+
|
|
644
|
+
## 7. Expose references intentionally
|
|
645
|
+
|
|
646
|
+
References are useful because they tell an AI how tables and entities relate.
|
|
647
|
+
|
|
648
|
+
If a property references another Chill type, make sure that:
|
|
649
|
+
|
|
650
|
+
- the reference is represented through Chill metadata
|
|
651
|
+
- the target type has a useful schema
|
|
652
|
+
- the property description explains the relationship
|
|
653
|
+
|
|
654
|
+
Example:
|
|
655
|
+
|
|
656
|
+
- `"Customer that owns the invoice."`
|
|
657
|
+
- `"Warehouse from which this shipment is fulfilled."`
|
|
658
|
+
|
|
659
|
+
This helps an AI navigate the graph of your database instead of treating every object as isolated.
|
|
660
|
+
|
|
661
|
+
## 8. Keep labels useful
|
|
662
|
+
|
|
663
|
+
`Label`, `ShortLabel`, and schema display names help an AI choose the right object when many related types exist.
|
|
664
|
+
|
|
665
|
+
A good label is:
|
|
666
|
+
|
|
667
|
+
- stable
|
|
668
|
+
- human-readable
|
|
669
|
+
- derived from the business identity of the record
|
|
670
|
+
|
|
671
|
+
Examples:
|
|
672
|
+
|
|
673
|
+
- invoice number
|
|
674
|
+
- customer name
|
|
675
|
+
- product code and title
|
|
676
|
+
|
|
677
|
+
This improves both UI behavior and AI comprehension.
|
|
678
|
+
|
|
679
|
+
## 9. Separate internal-only objects from AI-facing objects
|
|
680
|
+
|
|
681
|
+
Not every entity should be MCP-enabled.
|
|
682
|
+
|
|
683
|
+
A good rule is:
|
|
684
|
+
|
|
685
|
+
- enable MCP only for objects that are understandable and safe to expose to an AI workflow
|
|
686
|
+
- keep low-level infrastructure entities, log tables, or sensitive internals disabled unless there is a real reason to publish them
|
|
687
|
+
|
|
688
|
+
This reduces confusion, token waste, and accidental misuse.
|
|
689
|
+
|
|
690
|
+
## 10. Design with permission boundaries in mind
|
|
691
|
+
|
|
692
|
+
The authenticated API-key user can be restricted by permissions and other limitations.
|
|
693
|
+
|
|
694
|
+
That means a good AI-facing host should align:
|
|
695
|
+
|
|
696
|
+
- MCP-enabled schemas
|
|
697
|
+
- query visibility
|
|
698
|
+
- auth permissions
|
|
699
|
+
- API key ownership
|
|
700
|
+
|
|
701
|
+
If different clients need different visibility, use different identities or permission profiles rather than one global unrestricted MCP surface.
|
|
702
|
+
|
|
703
|
+
## 11. Think in “AI reading order”
|
|
704
|
+
|
|
705
|
+
A typical agent workflow is:
|
|
706
|
+
|
|
707
|
+
1. list schemas
|
|
708
|
+
2. choose one by name and description
|
|
709
|
+
3. inspect schema and property descriptions
|
|
710
|
+
4. infer related entity type
|
|
711
|
+
5. build a query
|
|
712
|
+
6. read results
|
|
713
|
+
|
|
714
|
+
So the model should support that sequence cleanly.
|
|
715
|
+
|
|
716
|
+
Ask yourself:
|
|
717
|
+
|
|
718
|
+
- can the agent identify the right schema by reading the name and description?
|
|
719
|
+
- can it understand the properties without hidden tribal knowledge?
|
|
720
|
+
- can it tell which query returns which entity?
|
|
721
|
+
- can it avoid irrelevant schemas?
|
|
722
|
+
|
|
723
|
+
If not, enrich the metadata.
|
|
724
|
+
|
|
725
|
+
## 12. Optimize for fewer round trips
|
|
726
|
+
|
|
727
|
+
AI systems pay a price for each discovery step.
|
|
728
|
+
|
|
729
|
+
To keep consumption efficient:
|
|
730
|
+
|
|
731
|
+
- provide rich schema descriptions
|
|
732
|
+
- describe properties well the first time
|
|
733
|
+
- keep query surfaces focused
|
|
734
|
+
- expose the result properties that are commonly needed
|
|
735
|
+
- avoid forcing the agent to guess meanings and retry
|
|
736
|
+
|
|
737
|
+
Good metadata lowers token usage, lowers retries, and produces more reliable results.
|
|
738
|
+
|
|
739
|
+
## Practical AI-Ready Checklist
|
|
740
|
+
|
|
741
|
+
Before exposing a model through `ChillSharp.Mcp`, check that:
|
|
742
|
+
|
|
743
|
+
- entity names are clear
|
|
744
|
+
- query names are clear
|
|
745
|
+
- all AI-facing properties are annotated with `[ChillProperty]`
|
|
746
|
+
- MCP-enabled schemas have useful `MCPDescription`
|
|
747
|
+
- important properties have useful `MCPDescription`
|
|
748
|
+
- queries are focused and purpose-built
|
|
749
|
+
- references are described
|
|
750
|
+
- labels are meaningful
|
|
751
|
+
- sensitive or noisy schemas remain non-MCP
|
|
752
|
+
- auth and permission boundaries match the intended AI use case
|
|
753
|
+
|
|
754
|
+
## Example AI-Friendly Model Fragment
|
|
755
|
+
|
|
756
|
+
```csharp
|
|
757
|
+
using ChillSharp.Annotations;
|
|
758
|
+
using ChillSharp.EF;
|
|
759
|
+
|
|
760
|
+
[ChillEntity(
|
|
761
|
+
UniquePropertyKeyString: "4E16F6C0-6B95-4D67-98BC-9F4D0D63EAF1",
|
|
762
|
+
PrimaryLanguageLabel: "Invoice",
|
|
763
|
+
SecondaryLanguageLabel: "Fattura",
|
|
764
|
+
EnableMCP = true,
|
|
765
|
+
MCPDescription = "Customer invoice header. Use it to inspect invoice identity, customer, dates, totals, and payment state.")]
|
|
766
|
+
public class Invoice : ChillEntity
|
|
767
|
+
{
|
|
768
|
+
[ChillProperty(
|
|
769
|
+
UniquePropertyKeyString: "50B1BB6C-D794-41E4-A85C-D4F9D7A6FA7E",
|
|
770
|
+
PrimaryLanguageLabel: "Invoice number",
|
|
771
|
+
SecondaryLanguageLabel: "Numero fattura",
|
|
772
|
+
MCPDescription = "Human-readable invoice number used by accountants and customers.")]
|
|
773
|
+
public string InvoiceNumber { get; set; } = string.Empty;
|
|
774
|
+
|
|
775
|
+
[ChillProperty(
|
|
776
|
+
UniquePropertyKeyString: "A18E7754-D8F7-45FE-B8A8-EA762A4EC9E6",
|
|
777
|
+
PrimaryLanguageLabel: "Customer",
|
|
778
|
+
SecondaryLanguageLabel: "Cliente",
|
|
779
|
+
MCPDescription = "Customer that owns this invoice.",
|
|
780
|
+
ReferenceChillTypeQuery = "Query.CustomerQuery")]
|
|
781
|
+
public Customer? Customer { get; set; }
|
|
782
|
+
|
|
783
|
+
[ChillProperty(
|
|
784
|
+
UniquePropertyKeyString: "D6A6A0B6-3C22-4E18-B2AE-34D6EBE56EC8",
|
|
785
|
+
PrimaryLanguageLabel: "Payment status",
|
|
786
|
+
SecondaryLanguageLabel: "Stato pagamento",
|
|
787
|
+
MCPDescription = "Current payment lifecycle status such as Draft, Issued, Paid, or Cancelled.")]
|
|
788
|
+
public string PaymentStatus { get; set; } = string.Empty;
|
|
789
|
+
}
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
## Related Documents
|
|
793
|
+
|
|
794
|
+
- [ChatGPT connection how-to](ChatGPT.md)
|
|
795
|
+
- [../README.md](../README.md)
|
|
796
|
+
- [../RegisterContext.md](../RegisterContext.md)
|
|
797
|
+
- [../ModelPreparation.md](../ModelPreparation.md)
|
|
798
|
+
- [../AIAssistedDevelopment/README.md](../AIAssistedDevelopment/README.md)
|
|
799
|
+
- [../../ChillSharp.Mcp/README.md](../../ChillSharp.Mcp/README.md)
|