Skip to content

API Reference

Martin Schultheiss edited this page Nov 25, 2025 · 1 revision

API Reference

Complete documentation of all Context Processor tools.

Table of Contents


MCP Tools

Context Processor exposes 6 tools via the Model Context Protocol:

Tool Purpose
save_context Create/update context with optional preprocessing
load_context Retrieve context by ID
list_contexts List all contexts with optional filtering
list_models List available pre-processing models
get_model_info Get detailed model configuration
delete_context Remove context permanently

save_context

Creates a new context or updates an existing one.

Parameters

{
  "title": "My Document",
  "content": "Document content...",
  "tags": ["tag1", "tag2"],
  "metadata": { "custom": "data" },
  "model": "comprehensive"
}
  • title (string, required) - Context title (max 200 chars)
  • content (string, required) - Main content to store
  • tags (string[], optional) - Organizational tags
  • metadata (object, optional) - Custom metadata
  • model (string, optional) - Pre-processing model to apply

Models

  • clarify - Improve clarity and readability
  • search_optimized - Extract keywords for search
  • analysis - Content metrics and analysis
  • comprehensive - All strategies combined
  • web_enhanced - URL detection and analysis
  • null - No preprocessing (default)

Response

Returns a ContextItem with the saved data and metadata.


load_context

Retrieves a specific context by ID.

Parameters

{
  "contextId": "ctx-12345-abcde"
}
  • contextId (string, required) - ID to retrieve

Response

Returns the ContextItem or null if not found.


list_contexts

Lists all contexts with optional filtering.

Parameters

{
  "tags": ["react"],
  "limit": 10,
  "offset": 0
}
  • tags (string[], optional) - Filter by tags (AND logic)
  • limit (number, optional) - Max results (default: 100)
  • offset (number, optional) - Pagination offset (default: 0)

Response

Returns array of ContextItems matching filters.


list_models

Lists all available pre-processing models.

Response

{
  "models": [
    {
      "name": "clarify",
      "description": "Improves clarity",
      "strategies": ["clarify"]
    }
  ]
}

get_model_info

Gets detailed information about a specific model.

Parameters

{
  "modelName": "comprehensive"
}

Response

Returns model configuration and strategy details.


delete_context

Removes a context permanently.

Parameters

{
  "contextId": "ctx-12345-abcde"
}

Response

{
  "deleted": true,
  "id": "ctx-12345-abcde"
}

Data Types

ContextItem

interface ContextItem {
  id: string;
  title: string;
  content: string;
  tags: string[];
  metadata?: Record<string, any>;
  createdAt: number;
  updatedAt: number;
}

Error Handling

Errors are returned as structured objects:

{
  "code": "INVALID_INPUT",
  "message": "Context title is required",
  "details": { "field": "title" }
}

Common Error Codes

  • INVALID_INPUT - Missing or invalid parameters
  • CONTEXT_NOT_FOUND - Context ID doesn't exist
  • STORAGE_ERROR - File system issue
  • PROCESSING_ERROR - Pre-processing failed
  • VALIDATION_ERROR - Content validation failed

Best Practices

  1. Use meaningful tags - 3-5 per context
  2. Limit content size - Prefer multiple smaller contexts
  3. Batch operations - Process multiple items efficiently
  4. Cache models - Load model info once
  5. Use pagination - For large datasets
  6. Add metadata - For filtering and organization
  7. Clean up - Delete obsolete contexts regularly

See Also

Clone this wiki locally