alita-sdk 0.3.423__py3-none-any.whl → 0.3.435__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of alita-sdk might be problematic. Click here for more details.

@@ -0,0 +1,57 @@
1
+ """
2
+ Models for MCP (Model Context Protocol) configuration.
3
+ Following MCP specification for remote HTTP servers only.
4
+ """
5
+
6
+ from typing import Optional, List, Dict, Any
7
+ from pydantic import BaseModel, Field, validator
8
+ from urllib.parse import urlparse
9
+
10
+
11
+ class McpConnectionConfig(BaseModel):
12
+ """
13
+ MCP connection configuration for remote HTTP servers.
14
+ Based on https://modelcontextprotocol.io/specification/2025-06-18
15
+ """
16
+
17
+ url: str = Field(description="MCP server HTTP URL (http:// or https://)")
18
+ headers: Optional[Dict[str, str]] = Field(
19
+ default=None,
20
+ description="HTTP headers for the connection (JSON object)"
21
+ )
22
+
23
+ @validator('url')
24
+ def validate_url(cls, v):
25
+ """Validate URL is HTTP/HTTPS."""
26
+ if not v:
27
+ raise ValueError("URL cannot be empty")
28
+
29
+ parsed = urlparse(v)
30
+ if parsed.scheme not in ['http', 'https']:
31
+ raise ValueError("URL must use http:// or https:// scheme for remote MCP servers")
32
+
33
+ if not parsed.netloc:
34
+ raise ValueError("URL must include host and port")
35
+
36
+ return v
37
+
38
+
39
+ class McpToolkitConfig(BaseModel):
40
+ """Configuration for a single remote MCP server toolkit."""
41
+
42
+ server_name: str = Field(description="MCP server name/identifier")
43
+ connection: McpConnectionConfig = Field(description="MCP connection configuration")
44
+ timeout: int = Field(default=60, description="Request timeout in seconds", ge=1, le=3600)
45
+ selected_tools: List[str] = Field(default_factory=list, description="Specific tools to enable (empty = all)")
46
+ enable_caching: bool = Field(default=True, description="Enable tool schema caching")
47
+ cache_ttl: int = Field(default=300, description="Cache TTL in seconds", ge=60, le=3600)
48
+
49
+
50
+ class McpToolMetadata(BaseModel):
51
+ """Metadata about an MCP tool."""
52
+
53
+ name: str = Field(description="Tool name")
54
+ description: str = Field(description="Tool description")
55
+ server: str = Field(description="Source server name")
56
+ input_schema: Dict[str, Any] = Field(description="Tool input schema")
57
+ enabled: bool = Field(default=True, description="Whether tool is enabled")
@@ -0,0 +1,24 @@
1
+ """
2
+ Runtime toolkits module for Alita SDK.
3
+ This module provides various toolkit implementations for LangGraph agents.
4
+ """
5
+
6
+ from .application import ApplicationToolkit
7
+ from .artifact import ArtifactToolkit
8
+ from .datasource import DatasourcesToolkit
9
+ from .prompt import PromptToolkit
10
+ from .subgraph import SubgraphToolkit
11
+ from .vectorstore import VectorStoreToolkit
12
+ from .mcp import McpToolkit
13
+ from ...tools.memory import MemoryToolkit
14
+
15
+ __all__ = [
16
+ "ApplicationToolkit",
17
+ "ArtifactToolkit",
18
+ "DatasourcesToolkit",
19
+ "PromptToolkit",
20
+ "SubgraphToolkit",
21
+ "VectorStoreToolkit",
22
+ "McpToolkit",
23
+ "MemoryToolkit"
24
+ ]