Skip to main content
Glama

MCP Platform

by jck411
models.py•1.47 kB
#!/usr/bin/env python3 """ Chat History Data Models This module contains all Pydantic models for the chat history system. """ from __future__ import annotations import uuid from datetime import UTC, datetime from typing import Any, Literal from pydantic import BaseModel, Field # ---------- Type definitions ---------- Role = Literal["system", "user", "assistant", "tool"] # ---------- Content models ---------- class TextPart(BaseModel): type: Literal["text"] = "text" text: str Part = TextPart # extend later class ToolCall(BaseModel): id: str name: str arguments: dict[str, Any] # ---------- Main event model ---------- class ChatEvent(BaseModel): id: str = Field(default_factory=lambda: str(uuid.uuid4())) conversation_id: str # sequence must always be filled by the repo; start with None seq: int | None = None schema_version: int = 1 type: Literal[ "user_message", "assistant_message", "tool_call", "tool_result", "system_update", "meta", ] role: Role | None = None content: str | list[Part] | None = None tool_calls: list[ToolCall] = [] provider: str | None = None model: str | None = None stop_reason: str | None = None created_at: datetime = Field(default_factory=lambda: datetime.now(UTC)) extra: dict[str, Any] = Field(default_factory=dict) raw: Any | None = None # keep small; move big things elsewhere later

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jck411/MCP_BACKEND_OPENROUTER'

If you have feedback or need assistance with the MCP directory API, please join our Discord server