Variable: PromptMessage
ts
const PromptMessage: {
assistant: PromptMessagePayload;
audio: PromptMessagePayload;
fromView: PromptMessagePayload[];
image: PromptMessagePayload;
resource: PromptMessagePayload;
system: PromptMessagePayload;
user: PromptMessagePayload;
};Defined in: packages/core/src/prompt/PromptMessage.ts:37
Factory for creating MCP prompt messages.
Note on system(): The MCP protocol only supports user and assistant roles in PromptMessage. System instructions are encoded as a user message (the first message) by convention — the MCP client prepends it to the conversation context.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
assistant() | (text) => PromptMessagePayload | Create an assistant message (for multi-turn seeding). Use this to pre-seed the assistant's initial response, guiding the LLM's first reasoning step. | packages/core/src/prompt/PromptMessage.ts:68 |
audio() | ( role, data, mimeType) => PromptMessagePayload | Create a message with embedded audio. | packages/core/src/prompt/PromptMessage.ts:90 |
fromView() | (builder) => PromptMessagePayload[] | Decompose a Presenter view into prompt messages. MVA-Driven Prompts — the bridge between the Presenter layer (MVA View for Tools) and the Prompt Engine. Extracts system rules, data, UI blocks, and action suggestions from a ResponseBuilder into composable PromptMessagePayload[] messages. Uses XML-tagged semantic blocks (<domain_rules>, <dataset>, <visual_context>, <system_guidance>) optimized for frontier LLM context handling — prevents context leakage between layers. Single Source of Truth: If a Presenter's systemRules() change, both Tools and Prompts update automatically — zero duplication. Example import { definePrompt, PromptMessage } from '@vinkius-core/mcp-fusion'; import { InvoicePresenter } from './presenters'; const AuditPrompt = definePrompt<AppContext>('audit', { args: { invoiceId: 'string' } as const, handler: async (ctx, { invoiceId }) => { const invoice = await ctx.db.getInvoice(invoiceId); return { messages: [ PromptMessage.system('You are a Senior Financial Auditor.'), ...PromptMessage.fromView(InvoicePresenter.make(invoice, ctx)), PromptMessage.user('Begin the audit for this invoice.'), ], }; }, }); See - Presenter for the MVA View layer - ResponseBuilder for the data source | packages/core/src/prompt/PromptMessage.ts:156 |
image() | ( role, data, mimeType) => PromptMessagePayload | Create a message with an embedded image. | packages/core/src/prompt/PromptMessage.ts:79 |
resource() | ( role, uri, options?) => PromptMessagePayload | Create a message with an embedded resource reference. | packages/core/src/prompt/PromptMessage.ts:101 |
system() | (text) => PromptMessagePayload | Create a system instruction message. Encoded as role: 'user' per MCP spec (MCP does not have a system role in PromptMessage — system instructions are conveyed as the first user message by convention). | packages/core/src/prompt/PromptMessage.ts:47 |
user() | (text) => PromptMessagePayload | Create a user message. | packages/core/src/prompt/PromptMessage.ts:56 |