Skip to content

Conversation

@HackedRico
Copy link

Description

This pull request adds Marshmallow schemas to the MCP plugin API and integrates them with aiohttp_apispec to enable automatic validation and OpenAPI documentation to work with core Caldera api/docs.

API Schema Definitions

  • Added new schema modules: base_schemas.py, execute_schemas.py, status_schemas.py, rag_schemas.py, and runs_schemas.py to define standardized request and response formats for error handling, execution, status, RAG file management, and run history.

API Endpoint Documentation and Validation

  • Updated app/mcp_api.py to import the new schemas and annotate all major endpoints (execute, status, upload_rag, list_rag, list_runs, get_run_detail) with OpenAPI documentation and request/response schema validation using aiohttp_apispec.

Endpoint Registration

  • Registered new run history endpoints (/plugin/mcp/runs, /plugin/mcp/runs/detail) in the plugin hook for full run listing and detail retrieval.
image

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Fresh install of Caldera with MCP Plugin to ensure proper population of MCP plugin Swagger Docs endpoints.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

  * Added /plugin/mcp/runs endpoint for list_runs()
  * Added /plugin/mcp/runs/detail endpoint for get_run_detail()
  * These methods were already implemented in mcp_api.py but not registered as routes
- Created comprehensive API schemas using Marshmallow in app/api/v2/schemas/:
  * base_schemas.py: Common schemas (ErrorResponse, ModelConfigSchema)
  * execute_schemas.py: AI agent execution request/response schemas
  * status_schemas.py: Run status tracking schemas
  * rag_schemas.py: RAG file upload/list schemas
  * runs_schemas.py: MLflow run listing and detail schemas

- Updated mcp_api.py with aiohttp_apispec decorators:
  * Added @docs() tags for Swagger UI organization
  * Added @request_schema() for request validation
  * Added @response_schema() for response documentation
  * Decorated all 6 endpoints: execute, status, upload_rag, list_rag, list_runs, get_run_detail
@HackedRico HackedRico changed the title feat(swaagger): swagger docs for mcp endpoints feat(swagger): swagger docs for mcp endpoints Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant