MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / ActionConfig

Class ActionConfig

src/environment/types.py:165–229  ·  view source on GitHub ↗

Action configuration (equivalent to MCP tool)

Source from the content-addressed store, hash-verified

163 params: Optional[Dict[str, Any]] = None
164
165class ActionConfig(BaseModel):
166 """Action configuration (equivalent to MCP tool)"""
167 model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
168
169 env_name: str = Field(description="The name of the environment this action belongs to")
170 name: str = Field(description="The name of the action")
171 description: str = Field(description="The description of the action")
172 metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="The metadata of the action")
173 version: str = Field(default="1.0.0", description="Version of the action")
174
175 function: Optional[Callable] = Field(default=None, description="The function implementing the action")
176 code: Optional[str] = Field(default=None, description="The source code of the action")
177
178 # Default representations
179 args_schema: Optional[Type[BaseModel]] = Field(default=None, description="Default args schema (BaseModel type)")
180 function_calling: Optional[Dict[str, Any]] = Field(default=None, description="Default function calling representation")
181 text: Optional[str] = Field(default=None, description="Default text representation")
182
183 def model_dump(self, **kwargs) -> Dict[str, Any]:
184 """Dump the model to a dictionary, recursively serializing nested Pydantic models."""
185
186 result = {
187 "env_name": self.env_name,
188 "name": self.name,
189 "description": self.description,
190 "metadata": self.metadata,
191 "version": self.version,
192
193 "function": f"<{self.function.__name__}>",
194 "code": self.code,
195
196 "args_schema": dynamic_manager.serialize_args_schema(self.args_schema) if self.args_schema else None,
197 "function_calling": self.function_calling,
198 "text": self.text,
199 }
200
201 return result
202
203 @classmethod
204 def model_validate(cls, data: Dict[str, Any]) -> 'ActionConfig':
205 """Validate the model from a dictionary."""
206 env_name = data.get("env_name")
207 name = data.get("name")
208 description = data.get("description")
209 metadata = data.get("metadata")
210 version = data.get("version")
211
212 code = data.get("code")
213 function = None
214
215 args_schema = dynamic_manager.deserialize_args_schema(data.get("args_schema"))
216 function_calling = data.get("function_calling")
217 text = data.get("text")
218
219 return cls(env_name=env_name,
220 name=name,
221 description=description,
222 metadata=metadata,

Callers 7

registerMethod · 0.90
updateMethod · 0.90
copyMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected