POST
/
{tenant}
/
mcp
curl --request POST \
  --url https://api.kambrium.com/{tenant}/mcp \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": "init-123",
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-03-26",
    "capabilities": {
      "roots": {
        "listChanged": true
      },
      "sampling": {}
    },
    "clientInfo": {
      "name": "my-mcp-client",
      "version": "1.0.0"
    }
  }
}'
{
  "jsonrpc": "2.0",
  "id": "prompts-get-123",
  "result": {
    "description": "Deal analysis prompt with contextual data",
    "messages": [
      {
        "role": "user",
        "content": {
          "type": "text",
          "text": "Please analyze deal #12345 and provide recommendations for improving the conversion probability. Consider the current stage, timeline, and stakeholder engagement.\n\nDeal Context:\n- ID: 12345\n- Current Stage: Negotiation\n- Value: $50,000\n- Timeline: 30 days remaining\n- Last Activity: 2 days ago"
        }
      }
    ]
  }
}

Overview

The prompts/get method retrieves a specific prompt template by name and processes it with provided arguments. The result contains structured messages ready for language model consumption.

Prerequisites

  1. Session Initialization: Complete initializenotifications/initialized flow
  2. Authentication: Valid OAuth token or PAT with mcp.read scope
  3. Session ID: Include Mcp-Session-Id header from initialization
  4. Prompt Discovery: Use prompts/list to discover available prompts and their arguments

Request Format

{
  "jsonrpc": "2.0",
  "id": "prompts-get-123",
  "method": "prompts/get",
  "params": {
    "name": "deal_analysis",
    "arguments": {
      "context_type": "deal",
      "context_id": "12345"
    }
  }
}

Request Parameters

jsonrpc
string
required

Must be "2.0" (JSON-RPC version)

id
string
required

Unique request identifier (cannot be null)

method
string
required

Must be "prompts/get"

params
object
required

Prompt retrieval parameters

Response Format

jsonrpc
string
required

Always "2.0"

id
string
required

Matches the request ID exactly

result
object
required

Prompt content result

Example Responses

{
  "jsonrpc": "2.0",
  "id": "prompts-get-123",
  "result": {
    "description": "Deal analysis prompt with contextual data",
    "messages": [
      {
        "role": "user",
        "content": {
          "type": "text",
          "text": "Please analyze deal #12345 and provide recommendations for improving the conversion probability. Consider the current stage, timeline, and stakeholder engagement.\n\nDeal Context:\n- ID: 12345\n- Current Stage: Negotiation\n- Value: $50,000\n- Timeline: 30 days remaining\n- Last Activity: 2 days ago"
        }
      }
    ]
  }
}

Argument Processing

Required Arguments

All arguments marked as required: true in the prompt definition must be provided:

// From prompts/list response
const prompt = {
  name: "deal_analysis",
  arguments: [
    { name: "context_type", required: true },
    { name: "context_id", required: true },
  ],
};

// Must provide all required arguments
const request = {
  name: "deal_analysis",
  arguments: {
    context_type: "deal", // Required
    context_id: "12345", // Required
  },
};

Optional Arguments

Optional arguments can be omitted and may have default values:

// Optional arguments in prompt definition
const prompt = {
  name: "sales_summary",
  arguments: [
    { name: "person_id", required: true },
    { name: "time_period", required: false }, // Optional
  ],
};

// Can omit optional arguments
const request = {
  name: "sales_summary",
  arguments: {
    person_id: "789",
    // time_period omitted - will use default
  },
};

Argument Validation

Arguments are validated for:

  • Presence: Required arguments must be provided
  • Type: String values expected for most arguments
  • Context: References to valid CRM entities (deals, contacts, etc.)

Message Structure

Role-Based Messages

Messages follow conversational structure:

  • user: Instructions or questions for the language model
  • assistant: Pre-filled responses or examples

Content Types

TypeDescriptionUse Case
textPlain text contentInstructions, questions, analysis requests
imageBase64-encoded imagesVisual context, charts, screenshots
audioBase64-encoded audioVoice instructions, recorded context

Template Processing

Our implementation processes templates with provided arguments:

  1. Argument Substitution: Replace placeholders with actual values
  2. Context Loading: Fetch relevant data from CRM/database
  3. Message Assembly: Construct structured messages
  4. Validation: Ensure all required data is available

Content Validation Patterns

Based on our test implementation, message content is validated as follows:

// Content can be string or object
const content = message["content"];
assert(typeof content === "string" || typeof content === "object");

if (typeof content === "object") {
  // Object content must have type and appropriate fields
  assert("type" in content);
  assert(["text", "image", "audio"].includes(content.type));

  if (content.type === "text") {
    assert("text" in content);
    assert(typeof content.text === "string");
  }
}

Valid Content Examples:

// String content (simple format)
"content": "Please analyze this deal and provide recommendations"

// Object content (structured format)
"content": {
  "type": "text",
  "text": "Please analyze this deal and provide recommendations"
}

OAuth and Permissions

Prompt Access Control

  • User-specific: Users see only prompts they have permission to access
  • Database-driven: Prompt permissions stored and validated in database
  • Session-bound: Permissions validated per session and prompt request

Context Data Access

  • Reference Validation: Context IDs validated against user’s accessible data
  • Permission Checking: User must have access to referenced CRM entities
  • Data Filtering: Only authorized data included in prompt context

Error Handling

Common Error Codes

CodeMeaningRecovery
-32000Authentication failureRefresh token, reinitialize session
-32001Prompt not foundCheck prompts/list for available prompts
-32602Invalid argumentsValidate required arguments and types
-32603Internal server errorRetry or contact support

Argument Validation Errors

// Missing required argument
{
  code: -32602,
  message: "Invalid params",
  data: {
    parameter: "context_id",
    error: "Missing required argument",
    prompt_name: "deal_analysis"
  }
}

// Invalid context reference
{
  code: -32602,
  message: "Invalid params",
  data: {
    parameter: "context_id",
    error: "Invalid context reference",
    context_id: "999999"
  }
}

Implementation Notes

Request ID Requirements

  • Must be unique within session
  • Cannot be null (enforced by implementation)
  • Used for error correlation and response matching

Session Validation

  • Mcp-Session-Id header required after initialization
  • Session must be active and authenticated
  • Invalid session returns authentication error

Template Caching

  • Prompt templates cached for performance
  • Argument processing optimized for common patterns
  • Context data fetched efficiently from database

Performance Considerations

  • Complex prompts may take longer to process
  • Context data fetching optimized per prompt type
  • Results not cached (dynamic content with arguments)

This method provides the core functionality for retrieving personalized, context-aware prompt templates that can be directly used with language models for various CRM and business analysis tasks.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

Mcp-Session-Id
string

MCP session ID (required after initialization)

Example:

"session_abc123"

Path Parameters

tenant
string
required

Tenant identifier (e.g., 'pipedrive', 'salesforce', 'hubspot')

Example:

"pipedrive"

Body

application/json

Response

200
application/json

JSON-RPC 2.0 response

The response is of type object.