Skip to content

Add MCP Prompts support #65

@7tg

Description

@7tg

Description

The MCP protocol supports Prompts as a primitive for providing templated messages/instructions to AI agents. This package currently only implements Tools.

MCP Prompts Overview

Prompts are reusable templates that help agents understand how to interact with the system. They can include:

  • Pre-defined instructions for common operations
  • Contextual guidance based on model metadata
  • Best practices for CRUD operations

Proposed Prompts

Discovery & Understanding

  • explore_models - Guide agent through discovering available models and their relationships
  • understand_model - Detailed walkthrough of a specific model's fields, constraints, and admin config

CRUD Operations

  • create_guide - Step-by-step guidance for creating objects with validation hints
  • update_guide - Best practices for updating objects, handling inlines
  • bulk_operations_guide - How to efficiently perform bulk create/update/delete

Relationships

  • navigate_relationships - How to traverse and understand model relationships
  • manage_inlines - Working with inline objects effectively

Admin Actions

  • execute_action - Guide for discovering and executing admin actions safely

Implementation

  1. Add prompts to ServerCapabilities
  2. Implement prompts/list handler
  3. Implement prompts/get handler with dynamic argument substitution
  4. Create prompt templates (possibly as Django templates or Python strings)

MCP Protocol Reference

# prompts/list response
{
    "prompts": [
        {
            "name": "explore_models",
            "description": "Guide for discovering Django admin models",
            "arguments": []
        },
        {
            "name": "understand_model", 
            "description": "Deep dive into a specific model",
            "arguments": [{"name": "model_name", "required": true}]
        }
    ]
}

# prompts/get request
{"method": "prompts/get", "params": {"name": "understand_model", "arguments": {"model_name": "user"}}}

Benefits

  • Reduces agent trial-and-error
  • Provides consistent guidance across different AI models
  • Self-documenting API usage patterns
  • Can be dynamically generated based on actual model configuration

Labels

enhancement, feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions