You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'PORT-15928-track-status-of-ai-driven-pull-requests' of https://github.com/port-labs/port-docs into PORT-15928-track-status-of-ai-driven-pull-requests
Copy file name to clipboardExpand all lines: docs/actions-and-automations/setup-backend/create-update-entity/create-update-entity.md
+108-2Lines changed: 108 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,6 @@
1
+
import Tabs from "@theme/Tabs"
2
+
import TabItem from "@theme/TabItem"
3
+
1
4
# Create/update entity
2
5
3
6
In some cases, we don't want to run complex logic via a workflow or pipeline, but rather want our backend to simply create or update an entity in our software catalog.
@@ -33,15 +36,15 @@ To use this backend type, you will need to define the following fields:
33
36
| `team` | The team/s this entity will belong to. |
34
37
| `icon` | The icon of the entity. |
35
38
| `properties` | The properties of the entity, in `"key":"value"` pairs where the key is the property's identifier, and the value is its value. |
36
-
| `relations` | The relations of the entity, in `"key":"value"` pairs where the key is the relation's identifier, and the value is the related entity's identifier. |
39
+
| `relations` | The relations of the entity, in `"key":"value"` pairs where the key is the relation's identifier, and the value is the related entity's identifier (for single relations) or an array of identifiers (for "many" relations). |
37
40
38
41
### Use jq to map the entity
39
42
40
43
All fields in the `mapping` object can be mapped using `jq` expressions, by wrapping the value in double curly braces `{{ }}`.
41
44
42
45
For example, say we want to assign the initiator of the action to a new entity when it is created, we can take his email from the action run object and assign it to a property named `assignee`:
43
46
44
-
```json
47
+
```json showLineNumbers
45
48
{
46
49
"identifier": "someTaskEntity",
47
50
"title": "Some Task",
@@ -55,3 +58,106 @@ For example, say we want to assign the initiator of the action to a new entity w
55
58
:::tip Test your mapping
56
59
You can use the `Test JQ` button in the bottom-left corner to test your mapping against the action's schema.
57
60
:::
61
+
62
+
## Map entity relations
63
+
64
+
When creating or updating entities, you often need to establish relations with other entities. The mapping approach depends on whether you're dealing with single or multiple entity inputs.
For a single entity relation, map the entity identifier directly:
76
+
77
+
```json showLineNumbers
78
+
{
79
+
"identifier": "myServiceEntity",
80
+
"title": "My Service",
81
+
"properties": {},
82
+
"relations": {
83
+
"domain": "{{ .inputs.domain }}"
84
+
}
85
+
}
86
+
```
87
+
88
+
</TabItem>
89
+
90
+
<TabItemvalue="array">
91
+
92
+
When your action accepts [array entity inputs](/docs/actions-and-automations/create-self-service-experiences/setup-ui-for-action/user-inputs/entity.md#array), you need to extract the identifiers from the array using the `map(.identifier)` pattern:
When users select multiple entities from an [entity array input](/docs/actions-and-automations/create-self-service-experiences/setup-ui-for-action/user-inputs/entity.md#array), the input contains an array of entity objects. Each object includes both `identifier` and `title` properties, but relations can only reference entity identifiers.
107
+
:::
108
+
109
+
</TabItem>
110
+
111
+
<TabItemvalue="flexible">
112
+
113
+
For maximum flexibility, you can create a conditional mapping that handles both single entity and array entity inputs:
114
+
115
+
```json showLineNumbers
116
+
{
117
+
"identifier": "myProjectEntity",
118
+
"title": "My Project",
119
+
"properties": {},
120
+
"relations": {
121
+
"dependencies": "{{ .inputs.dependencies | if type == \"array\" then map(.identifier) else .identifier end }}"
122
+
}
123
+
}
124
+
```
125
+
126
+
This pattern automatically:
127
+
- Extracts identifiers from arrays when multiple entities are selected
128
+
- Uses the identifier directly when a single entity is selected
129
+
130
+
</TabItem>
131
+
132
+
</Tabs>
133
+
134
+
135
+
### Common use cases
136
+
137
+
Here are some typical scenarios for mapping array relations:
Relations can only reference entity **identifiers**, not titles. Even though entity objects contain both `identifier` and `title` properties, you must always use `.identifier` when mapping to relations.
Copy file name to clipboardExpand all lines: docs/ai-agents/port-mcp-server.md
+188Lines changed: 188 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -367,6 +367,194 @@ Refer to the [Claude custom connector documentation](https://support.anthropic.c
367
367
</TabItem>
368
368
</Tabs>
369
369
370
+
### Prompts
371
+
372
+
In Port, you can centrally manage reusable prompts and expose them to your users via the MCP Server. Once defined in Port, these prompts become available in supported MCP clients (for example, Cursor or Claude) where developers and AI agents can discover and run them with the required inputs.
373
+
374
+
#### Common use cases
375
+
376
+
- Automate on-call runbooks and incident triage guidance
377
+
- Standardize code review or deployment checklists
1. Go to the [Builder page](https://app.getport.io/settings/data-model) of your portal.
383
+
384
+
2. Click on "+ Blueprint".
385
+
386
+
3. Click on the `{...}` button in the top right corner, and choose "Edit JSON".
387
+
388
+
4. Paste the following JSON schema into the editor:
389
+
390
+
391
+
392
+
<details>
393
+
<summary>Prompt blueprint JSON (click to expand)</summary>
394
+
395
+
```json showLineNumbers
396
+
{
397
+
"identifier": "prompt",
398
+
"title": "Prompt",
399
+
"icon": "Microservice",
400
+
"schema": {
401
+
"properties": {
402
+
"description": {
403
+
"type": "string",
404
+
"title": "Description"
405
+
},
406
+
"arguments": {
407
+
"items": {
408
+
"type": "object",
409
+
"properties": {
410
+
"name": {
411
+
"type": "string",
412
+
"description": "The name of the argument parameter"
413
+
},
414
+
"description": {
415
+
"type": "string",
416
+
"description": "A description of what this argument is for"
417
+
},
418
+
"required": {
419
+
"type": "boolean",
420
+
"description": "Whether this argument is required or optional",
421
+
"default": false
422
+
}
423
+
},
424
+
"required": [
425
+
"name",
426
+
"description"
427
+
]
428
+
},
429
+
"type": "array",
430
+
"title": "Arguments"
431
+
},
432
+
"template": {
433
+
"icon": "DefaultProperty",
434
+
"type": "string",
435
+
"title": "Prompt Template",
436
+
"format": "markdown"
437
+
}
438
+
},
439
+
"required": [
440
+
"description",
441
+
"template"
442
+
]
443
+
},
444
+
"mirrorProperties": {},
445
+
"calculationProperties": {},
446
+
"aggregationProperties": {},
447
+
"relations": {}
448
+
}
449
+
```
450
+
</details>
451
+
452
+
:::info Where prompts appear
453
+
Once this blueprint exists and you create entities for it, prompts will show up in supported MCP clients connected to your Port organization. In clients that surface MCP prompts, you’ll see them listed and ready to run with arguments.
454
+
:::
455
+
456
+
#### Create prompts
457
+
458
+
Create entities of the `prompt` blueprint for each prompt you want to expose. At minimum, provide `description` and `template`. Optionally add `arguments` to parameterize the prompt.
459
+
460
+
1. Go to the [Prompts page](https://app.getport.io/prompts) in your portal.
461
+
2. Click `Create prompt`.
462
+
3. Fill out the form:
463
+
- Provide a title and description.
464
+
- Write the prompt template (supports markdown).
465
+
- Define any `arguments` (optional) with `name`, `description`, and whether they are `required`.
466
+
467
+

468
+
469
+
:::info Template and placeholders
470
+
The `template` supports markdown and variable placeholders. Each argument defined in `arguments` is exposed by its `name` and can be referenced as `{{name}}` inside the template. When you run the prompt, the MCP Server collects values for required arguments and substitutes them into the matching `{{}}` placeholders before execution.
Summarize on-call context for a team over a time window.
513
+
514
+
```markdown showLineNumbers
515
+
Create an on-call handoff for {{team}} for the last {{timeframe}}.
516
+
517
+
Include:
518
+
- Active incidents and current status
519
+
- Top risks and mitigations
520
+
- Pending actions and owners
521
+
- Upcoming maintenance windows
522
+
```
523
+
524
+
Arguments to define: `team` (required), `timeframe` (required).
525
+
526
+
</TabItem>
527
+
</Tabs>
528
+
529
+
After creating entities, reconnect or refresh your MCP client; your prompts will be available to run and will prompt for any defined arguments.
530
+
531
+
#### See prompts in your client
532
+
533
+
<TabsgroupId="prompt-ui"queryString>
534
+
<TabItemvalue="cursor"label="Cursor">
535
+
536
+
In Cursor, type "/" to open the prompts list. You'll see all `prompt` entities; selecting one opens an input form for its arguments.
537
+
538
+

539
+
540
+
When you select a prompt, Cursor renders fields for the defined `arguments`. Required ones are marked and must be provided. The MCP Server substitutes provided values into the matching `{{}}` placeholders in the template at runtime.
541
+
542
+

543
+
544
+
</TabItem>
545
+
<TabItemvalue="claude"label="Claude">
546
+
547
+
In Claude, click the "+" button and choose the prompts option to view the list from your Port organization. Selecting a prompt opens a parameter collection flow.
548
+
549
+

550
+
551
+
Claude will ask for any required arguments before running the prompt, and the MCP Server will replace the corresponding `{{}}` placeholders in the template with the provided values.
552
+
553
+

554
+
555
+
</TabItem>
556
+
</Tabs>
557
+
370
558
## Troubleshooting
371
559
372
560
If you encounter issues while setting up or using the Port MCP Server, expand the relevant section below:
0 commit comments