Guide · Amazon Bedrock · Prompt Management

Amazon Bedrock Prompt Management for MCP Servers — CreatePrompt, GetPrompt, and Variants

Amazon Bedrock Prompt Management lets you store, version, and retrieve prompts through an API, decoupling prompt engineering from MCP server code deployments. Instead of hardcoding prompt templates as string literals in TypeScript, you define them in Bedrock — with named variables like {{content}} and {{max_sentences}} — and fetch them at runtime via GetPromptCommand. When a prompt needs improvement, you edit it in Bedrock and create a new version; the MCP server reads the updated template on the next invocation without a code change. Bedrock Prompt Management is part of the management plane (@aws-sdk/client-bedrock), not the runtime plane (@aws-sdk/client-bedrock-runtime). The core API surface is small: CreatePromptCommand, GetPromptCommand, CreatePromptVersionCommand, ListPromptsCommand, and DeletePromptCommand. This guide covers the prompt anatomy, variant model, IAM setup, and the most common production mistakes. For variable syntax and rendering, see Prompt Variables. For versioning and CI/CD workflows, see Prompt Versions. For CHAT template structure, see CHAT vs TEXT Templates.

TL;DR

Use @aws-sdk/client-bedrock (not bedrock-runtime) for prompt CRUD. Each prompt has one or more variants — each variant has a templateType (TEXT or CHAT), a template with {{variable}} placeholders, an optional modelId, and optional inference configuration. GetPromptCommand without promptVersion returns the mutable draft; always pass promptVersion in production. Create a version via CreatePromptVersionCommand after every change you want to freeze.

Why centralized prompts matter for MCP servers

An MCP server often exposes multiple tools that each require a carefully tuned prompt. A summarize_content tool, an extract_entities tool, and a classify_intent tool each have prompts that evolve independently as the application matures. When those prompts live as string constants in source code, every tweak requires a code review, a CI run, and a deployment. For teams iterating on prompt quality — which requires many small experiments — this friction slows iteration dramatically.

Bedrock Prompt Management removes that friction. Prompts are stored as named, versioned resources in your AWS account. The MCP server fetches the prompt template at startup (or on first use), fills in the runtime variables, and calls the model. When the prompt needs improvement, an engineer edits the draft in the AWS Console or via the API, runs their own tests, and calls CreatePromptVersionCommand to freeze a new version. Updating production means changing an environment variable (PROMPT_VERSION=4) and restarting the server — not modifying source code.

Secondary benefits: prompts are centrally auditable (CloudTrail records every GetPrompt call), cost-attributable via tags, and shareable across multiple MCP servers that need the same underlying capability.

Package and client setup

Bedrock Prompt Management is in the management plane, not the runtime plane. Use @aws-sdk/client-bedrock and BedrockClient:

import {
  BedrockClient,
  CreatePromptCommand,
  GetPromptCommand,
  CreatePromptVersionCommand,
  ListPromptsCommand,
  DeletePromptCommand,
} from "@aws-sdk/client-bedrock";

// Management plane — for CRUD on prompt resources
const bedrockMgmt = new BedrockClient({ region: "us-east-1" });

// Runtime plane — for actually invoking the model (separate client)
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
const bedrockRuntime = new BedrockRuntimeClient({ region: "us-east-1" });

The common mistake is importing from @aws-sdk/client-bedrock-runtime for prompt management operations. That package has no CreatePromptCommand or GetPromptCommand — those are exclusively in @aws-sdk/client-bedrock. The two packages serve different APIs at different base URLs (bedrock.{region}.amazonaws.com vs bedrock-runtime.{region}.amazonaws.com).

Prompt anatomy

A Bedrock prompt resource has the following top-level structure:

FieldRequiredDescription
nameYesUnique within the account+region. Max 64 chars. Used to identify the prompt in ListPromptsCommand output.
descriptionNoHuman-readable note. Not shown to the model.
variantsYes (≥1)Array of PromptVariant objects. Each variant is an independently callable template with its own model and inference config.
defaultVariantNoName of the variant to use when none is specified. If omitted, the first variant is implicitly the default.
tagsNoKey-value pairs for cost allocation and resource grouping.

Each variant has:

FieldRequiredDescription
nameYesUnique within the prompt. Used to select a variant at runtime.
templateTypeYes"TEXT" — single string template; "CHAT" — messages array with roles.
templateConfigurationYesContains either text or chat sub-object depending on templateType.
modelIdNoBedrock model ID to invoke (e.g. anthropic.claude-3-5-haiku-20241022-v1:0). If omitted, the caller must supply the model when invoking.
inferenceConfigurationNoWrapped in a text sub-object: temperature, maxTokens, topP, stopSequences.

Creating a prompt with CreatePromptCommand

The following example creates a TEXT prompt with two variables and stores inference configuration alongside the template:

import {
  BedrockClient,
  CreatePromptCommand,
  type CreatePromptCommandInput,
} from "@aws-sdk/client-bedrock";

const client = new BedrockClient({ region: "us-east-1" });

const input: CreatePromptCommandInput = {
  name: "mcp-summarize",
  description: "Summarize tool output for MCP server responses",
  defaultVariant: "default",
  variants: [
    {
      name: "default",
      templateType: "TEXT",
      templateConfiguration: {
        text: {
          text: "Summarize the following content in {{max_sentences}} sentences or fewer. "
            + "Use plain language and omit technical jargon.\n\n{{content}}",
          inputVariables: [
            { name: "max_sentences" },
            { name: "content" },
          ],
        },
      },
      modelId: "anthropic.claude-3-5-haiku-20241022-v1:0",
      inferenceConfiguration: {
        text: {
          temperature: 0.3,
          maxTokens: 512,
          topP: 0.9,
        },
      },
    },
    {
      name: "concise",
      templateType: "TEXT",
      templateConfiguration: {
        text: {
          text: "In one sentence, summarize: {{content}}",
          inputVariables: [{ name: "content" }],
        },
      },
      modelId: "anthropic.claude-3-5-haiku-20241022-v1:0",
      inferenceConfiguration: {
        text: { temperature: 0.0, maxTokens: 128 },
      },
    },
  ],
  tags: { project: "alivemcp", environment: "production" },
};

const response = await client.send(new CreatePromptCommand(input));

const promptId = response.id!;      // e.g. "ABCDEF123456"
const promptArn = response.arn!;    // e.g. "arn:aws:bedrock:us-east-1:123456789012:prompt/ABCDEF123456"
const promptName = response.name!;  // "mcp-summarize"

console.log(`Created prompt: ${promptId}`);
// Store promptId in env var or config for later retrieval

The returned id is a short alphanumeric string (not a UUID). The arn follows the pattern arn:aws:bedrock:{region}:{account}:prompt/{promptId}. Store the id in your MCP server's configuration — it is stable and does not change when you edit the draft or create new versions.

Gotcha: creating a prompt does not create a version. After CreatePromptCommand, you have a draft only. To freeze the prompt for production use, call CreatePromptVersionCommand (covered in Prompt Versions). If you fetch the prompt by ID without specifying a version, you always get the current draft — including any unsaved changes you made since the last version.

Fetching a prompt with GetPromptCommand

GetPromptCommand accepts either the prompt ID or the full prompt ARN as promptIdentifier. Add promptVersion for a specific immutable version; omit it for the mutable draft:

import {
  BedrockClient,
  GetPromptCommand,
  type PromptVariant,
} from "@aws-sdk/client-bedrock";

const client = new BedrockClient({ region: "us-east-1" });

// Fetch draft (mutable — changes with every edit)
const draft = await client.send(new GetPromptCommand({
  promptIdentifier: process.env.PROMPT_ID!,
}));

// Fetch a specific immutable version
const v2 = await client.send(new GetPromptCommand({
  promptIdentifier: process.env.PROMPT_ID!,
  promptVersion: process.env.PROMPT_VERSION!, // e.g. "2"
}));

// Extract the default variant
function getDefaultVariant(response: typeof v2): PromptVariant {
  const defaultName = response.defaultVariant;
  const variant = defaultName
    ? response.variants?.find(v => v.name === defaultName)
    : response.variants?.[0];

  if (!variant) throw new Error(`No variant found in prompt ${response.id}`);
  return variant;
}

const variant = getDefaultVariant(v2);
console.log("templateType:", variant.templateType);       // "TEXT" or "CHAT"
console.log("modelId:", variant.modelId);
console.log("template:", variant.templateConfiguration?.text?.text);

The response includes the full prompt metadata: id, arn, name, description, defaultVariant, variants, version (the version fetched, or "DRAFT"), createdAt, and updatedAt.

Listing prompts with ListPromptsCommand

ListPromptsCommand without arguments returns all prompts in the account+region. With promptIdentifier, it returns all versions of a specific prompt:

// List all prompts in account
const allPrompts = await client.send(new ListPromptsCommand({}));
for (const p of allPrompts.promptSummaries ?? []) {
  console.log(p.id, p.name, p.updatedAt);
}

// Paginate if there are many prompts
let nextToken = allPrompts.nextToken;
while (nextToken) {
  const page = await client.send(new ListPromptsCommand({ nextToken }));
  for (const p of page.promptSummaries ?? []) {
    console.log(p.id, p.name);
  }
  nextToken = page.nextToken;
}

// List all versions of a specific prompt
const versions = await client.send(new ListPromptsCommand({
  promptIdentifier: process.env.PROMPT_ID!,
}));
for (const v of versions.promptSummaries ?? []) {
  console.log("version:", v.version, "updated:", v.updatedAt);
}
// version field values: "1", "2", "3", ... (integers as strings)
// The draft does not appear in this listing — only committed versions do

When called with promptIdentifier, the same promptSummaries array is returned but each entry represents a version. The entry's version field holds the version number as a string. The draft is never included in this listing — only immutable versions appear.

IAM permissions

Bedrock Prompt Management uses a separate IAM action namespace from model invocation. The MCP server runtime needs at minimum GetPrompt (read-only). CI/CD pipelines need the full set:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PromptManagementRuntime",
      "Effect": "Allow",
      "Action": [
        "bedrock:GetPrompt"
      ],
      "Resource": "arn:aws:bedrock:us-east-1:123456789012:prompt/*"
    },
    {
      "Sid": "PromptManagementCICD",
      "Effect": "Allow",
      "Action": [
        "bedrock:CreatePrompt",
        "bedrock:CreatePromptVersion",
        "bedrock:ListPrompts",
        "bedrock:DeletePrompt",
        "bedrock:TagResource",
        "bedrock:UntagResource"
      ],
      "Resource": "arn:aws:bedrock:us-east-1:123456789012:prompt/*"
    }
  ]
}

Key IAM notes: the Resource ARN can be scoped to specific prompt IDs if you have multiple teams sharing an account. The bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream permissions for the actual model call remain separate — they are granted on the model ARN, not the prompt ARN. GetPrompt does not require model access; it only retrieves the template resource.

CloudTrail records every GetPrompt call with the promptId, version, and caller identity. For audit-sensitive environments, this provides a complete history of which prompt version was used for every tool invocation.

Prompt ARN formats

Bedrock Prompt Management uses two distinct ARN formats depending on whether you are referencing the prompt resource or a specific version:

TargetARN formatExample
Prompt resource (all versions + draft)arn:aws:bedrock:{region}:{account}:prompt/{promptId}arn:aws:bedrock:us-east-1:123456789012:prompt/ABCDEF123456
Specific versionarn:aws:bedrock:{region}:{account}:prompt/{promptId}:{version}arn:aws:bedrock:us-east-1:123456789012:prompt/ABCDEF123456:3

The version suffix in the ARN is a colon-separated integer, not a slash. This is different from Lambda version ARNs (function:name:3 vs function/name:3 — note the different separator before the resource name). In GetPromptCommand, you pass the base ARN (without version suffix) in promptIdentifier and the version number separately in promptVersion. Passing the version ARN directly in promptIdentifier will return a ValidationException.

Startup caching pattern for MCP servers

Fetching a prompt on every tool call adds ~50–100ms of latency for a management plane API call. The recommended pattern is to fetch the prompt template once at server startup and cache it in memory. For MCP servers that run as long-lived processes, this is straightforward:

import { BedrockClient, GetPromptCommand, type PromptVariant } from "@aws-sdk/client-bedrock";

const bedrockMgmt = new BedrockClient({ region: "us-east-1" });

// Cache: promptId+version -> variant
const promptCache = new Map<string, PromptVariant>();

export async function getCachedVariant(
  promptId: string,
  promptVersion: string,
  variantName?: string,
): Promise<PromptVariant> {
  const cacheKey = `${promptId}:${promptVersion}:${variantName ?? "default"}`;

  if (promptCache.has(cacheKey)) {
    return promptCache.get(cacheKey)!;
  }

  const response = await bedrockMgmt.send(new GetPromptCommand({
    promptIdentifier: promptId,
    promptVersion,
  }));

  const variant = variantName
    ? response.variants?.find(v => v.name === variantName)
    : response.variants?.find(v => v.name === response.defaultVariant)
      ?? response.variants?.[0];

  if (!variant) throw new Error(`Variant not found: ${variantName ?? "default"}`);

  promptCache.set(cacheKey, variant);
  return variant;
}

// At server startup, warm the cache for all prompts used by this server
export async function warmPromptCache(): Promise<void> {
  const promptId = process.env.SUMMARIZE_PROMPT_ID!;
  const promptVersion = process.env.SUMMARIZE_PROMPT_VERSION!;

  await getCachedVariant(promptId, promptVersion);
  console.log(`Prompt cache warm: ${promptId}:${promptVersion}`);
}

Because versioned prompts are immutable, the cache never needs invalidation. If you upgrade to a new version (by updating the env var and restarting), the new instance starts fresh and caches the new version. The cache key includes the version number so a process upgrade never serves stale templates.

Do not cache the draft. If you omit promptVersion and cache the draft, the cache will serve stale content after the draft is edited, until the server restarts. Only cache versioned prompts.

Monitoring prompt fetches with AliveMCP

Bedrock Prompt Management is a dependency of your MCP server: if the prompt fetch fails at startup or first use, the tool will not work. AliveMCP monitors the health check endpoint of your MCP server and can alert you within 60 seconds of a startup failure caused by a ResourceNotFoundException (the prompt ID was deleted or mistyped), AccessDeniedException (the IAM role lacks bedrock:GetPrompt), or ThrottlingException (the management plane has lower throughput than the runtime plane and can throttle prompt fetches under load). Without active monitoring, prompt fetch failures surface as cold-start errors that are hard to distinguish from general server crashes.

Related pages in this arc

For related Bedrock features, see Bedrock Converse API, Bedrock Guardrails, and Bedrock Knowledge Base.