Skip to content

Commit 0cbd4d2

Browse files
Update client for API v1.0.0-beta.25
Auto-generated from devgraph@3c38ba04a3bd97a65d31fc8d4f1dcbc8127bd8f8 Spec URL: https://github.com/arctir/devgraph-api/tree/v1.0.0-beta.25
1 parent b901dd2 commit 0cbd4d2

7 files changed

Lines changed: 460 additions & 2 deletions

File tree

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
from http import HTTPStatus
2+
from typing import Any, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.mcp_tools_response import MCPToolsResponse
9+
from ...types import Response
10+
11+
12+
def _get_kwargs() -> dict[str, Any]:
13+
_kwargs: dict[str, Any] = {
14+
"method": "get",
15+
"url": "/api/v1/mcp/tools",
16+
}
17+
18+
return _kwargs
19+
20+
21+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | MCPToolsResponse | None:
22+
if response.status_code == 200:
23+
response_200 = MCPToolsResponse.from_dict(response.json())
24+
25+
return response_200
26+
27+
if response.status_code == 404:
28+
response_404 = cast(Any, None)
29+
return response_404
30+
31+
if client.raise_on_unexpected_status:
32+
raise errors.UnexpectedStatus(response.status_code, response.content)
33+
else:
34+
return None
35+
36+
37+
def _build_response(
38+
*, client: AuthenticatedClient | Client, response: httpx.Response
39+
) -> Response[Any | MCPToolsResponse]:
40+
return Response(
41+
status_code=HTTPStatus(response.status_code),
42+
content=response.content,
43+
headers=response.headers,
44+
parsed=_parse_response(client=client, response=response),
45+
)
46+
47+
48+
def sync_detailed(
49+
*,
50+
client: AuthenticatedClient,
51+
) -> Response[Any | MCPToolsResponse]:
52+
"""List All Mcp Tools
53+
54+
List all available MCP tools grouped by server for the environment
55+
56+
Raises:
57+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
58+
httpx.TimeoutException: If the request takes longer than Client.timeout.
59+
60+
Returns:
61+
Response[Any | MCPToolsResponse]
62+
"""
63+
64+
kwargs = _get_kwargs()
65+
66+
response = client.get_httpx_client().request(
67+
**kwargs,
68+
)
69+
70+
return _build_response(client=client, response=response)
71+
72+
73+
def sync(
74+
*,
75+
client: AuthenticatedClient,
76+
) -> Any | MCPToolsResponse | None:
77+
"""List All Mcp Tools
78+
79+
List all available MCP tools grouped by server for the environment
80+
81+
Raises:
82+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
83+
httpx.TimeoutException: If the request takes longer than Client.timeout.
84+
85+
Returns:
86+
Any | MCPToolsResponse
87+
"""
88+
89+
return sync_detailed(
90+
client=client,
91+
).parsed
92+
93+
94+
async def asyncio_detailed(
95+
*,
96+
client: AuthenticatedClient,
97+
) -> Response[Any | MCPToolsResponse]:
98+
"""List All Mcp Tools
99+
100+
List all available MCP tools grouped by server for the environment
101+
102+
Raises:
103+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
104+
httpx.TimeoutException: If the request takes longer than Client.timeout.
105+
106+
Returns:
107+
Response[Any | MCPToolsResponse]
108+
"""
109+
110+
kwargs = _get_kwargs()
111+
112+
response = await client.get_async_httpx_client().request(**kwargs)
113+
114+
return _build_response(client=client, response=response)
115+
116+
117+
async def asyncio(
118+
*,
119+
client: AuthenticatedClient,
120+
) -> Any | MCPToolsResponse | None:
121+
"""List All Mcp Tools
122+
123+
List all available MCP tools grouped by server for the environment
124+
125+
Raises:
126+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127+
httpx.TimeoutException: If the request takes longer than Client.timeout.
128+
129+
Returns:
130+
Any | MCPToolsResponse
131+
"""
132+
133+
return (
134+
await asyncio_detailed(
135+
client=client,
136+
)
137+
).parsed

devgraph_client/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
from .mcp_tool_entity_association_create_tool_config_type_0 import MCPToolEntityAssociationCreateToolConfigType0
9090
from .mcp_tool_entity_association_response import MCPToolEntityAssociationResponse
9191
from .mcp_tool_entity_association_response_tool_config_type_0 import MCPToolEntityAssociationResponseToolConfigType0
92+
from .mcp_tool_info import MCPToolInfo
93+
from .mcp_tools_response import MCPToolsResponse
94+
from .mcp_tools_response_tools import MCPToolsResponseTools
9295
from .message_role import MessageRole
9396
from .migration_result import MigrationResult
9497
from .migration_results_response import MigrationResultsResponse
@@ -224,6 +227,9 @@
224227
"MCPToolEntityAssociationCreateToolConfigType0",
225228
"MCPToolEntityAssociationResponse",
226229
"MCPToolEntityAssociationResponseToolConfigType0",
230+
"MCPToolInfo",
231+
"MCPToolsResponse",
232+
"MCPToolsResponseTools",
227233
"MessageRole",
228234
"MigrationResult",
229235
"MigrationResultsResponse",
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
from __future__ import annotations
2+
3+
from collections.abc import Mapping
4+
from typing import Any, TypeVar, cast
5+
6+
from attrs import define as _attrs_define
7+
from attrs import field as _attrs_field
8+
9+
from ..types import UNSET, Unset
10+
11+
T = TypeVar("T", bound="MCPToolInfo")
12+
13+
14+
@_attrs_define
15+
class MCPToolInfo:
16+
"""Information about a single MCP tool.
17+
18+
Attributes:
19+
name (str):
20+
original_name (str):
21+
description (None | str | Unset):
22+
"""
23+
24+
name: str
25+
original_name: str
26+
description: None | str | Unset = UNSET
27+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28+
29+
def to_dict(self) -> dict[str, Any]:
30+
name = self.name
31+
32+
original_name = self.original_name
33+
34+
description: None | str | Unset
35+
if isinstance(self.description, Unset):
36+
description = UNSET
37+
else:
38+
description = self.description
39+
40+
field_dict: dict[str, Any] = {}
41+
field_dict.update(self.additional_properties)
42+
field_dict.update(
43+
{
44+
"name": name,
45+
"original_name": original_name,
46+
}
47+
)
48+
if description is not UNSET:
49+
field_dict["description"] = description
50+
51+
return field_dict
52+
53+
@classmethod
54+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55+
d = dict(src_dict)
56+
name = d.pop("name")
57+
58+
original_name = d.pop("original_name")
59+
60+
def _parse_description(data: object) -> None | str | Unset:
61+
if data is None:
62+
return data
63+
if isinstance(data, Unset):
64+
return data
65+
return cast(None | str | Unset, data)
66+
67+
description = _parse_description(d.pop("description", UNSET))
68+
69+
mcp_tool_info = cls(
70+
name=name,
71+
original_name=original_name,
72+
description=description,
73+
)
74+
75+
mcp_tool_info.additional_properties = d
76+
return mcp_tool_info
77+
78+
@property
79+
def additional_keys(self) -> list[str]:
80+
return list(self.additional_properties.keys())
81+
82+
def __getitem__(self, key: str) -> Any:
83+
return self.additional_properties[key]
84+
85+
def __setitem__(self, key: str, value: Any) -> None:
86+
self.additional_properties[key] = value
87+
88+
def __delitem__(self, key: str) -> None:
89+
del self.additional_properties[key]
90+
91+
def __contains__(self, key: str) -> bool:
92+
return key in self.additional_properties
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
from __future__ import annotations
2+
3+
from collections.abc import Mapping
4+
from typing import TYPE_CHECKING, Any, TypeVar
5+
6+
from attrs import define as _attrs_define
7+
from attrs import field as _attrs_field
8+
9+
from ..types import UNSET, Unset
10+
11+
if TYPE_CHECKING:
12+
from ..models.mcp_tools_response_tools import MCPToolsResponseTools
13+
14+
15+
T = TypeVar("T", bound="MCPToolsResponse")
16+
17+
18+
@_attrs_define
19+
class MCPToolsResponse:
20+
"""Response containing all MCP tools grouped by server.
21+
22+
Attributes:
23+
tools (MCPToolsResponseTools):
24+
total_tools (int):
25+
total_endpoints (int):
26+
load_time (float | Unset): Default: 0.0.
27+
"""
28+
29+
tools: MCPToolsResponseTools
30+
total_tools: int
31+
total_endpoints: int
32+
load_time: float | Unset = 0.0
33+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
34+
35+
def to_dict(self) -> dict[str, Any]:
36+
tools = self.tools.to_dict()
37+
38+
total_tools = self.total_tools
39+
40+
total_endpoints = self.total_endpoints
41+
42+
load_time = self.load_time
43+
44+
field_dict: dict[str, Any] = {}
45+
field_dict.update(self.additional_properties)
46+
field_dict.update(
47+
{
48+
"tools": tools,
49+
"total_tools": total_tools,
50+
"total_endpoints": total_endpoints,
51+
}
52+
)
53+
if load_time is not UNSET:
54+
field_dict["load_time"] = load_time
55+
56+
return field_dict
57+
58+
@classmethod
59+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
60+
from ..models.mcp_tools_response_tools import MCPToolsResponseTools
61+
62+
d = dict(src_dict)
63+
tools = MCPToolsResponseTools.from_dict(d.pop("tools"))
64+
65+
total_tools = d.pop("total_tools")
66+
67+
total_endpoints = d.pop("total_endpoints")
68+
69+
load_time = d.pop("load_time", UNSET)
70+
71+
mcp_tools_response = cls(
72+
tools=tools,
73+
total_tools=total_tools,
74+
total_endpoints=total_endpoints,
75+
load_time=load_time,
76+
)
77+
78+
mcp_tools_response.additional_properties = d
79+
return mcp_tools_response
80+
81+
@property
82+
def additional_keys(self) -> list[str]:
83+
return list(self.additional_properties.keys())
84+
85+
def __getitem__(self, key: str) -> Any:
86+
return self.additional_properties[key]
87+
88+
def __setitem__(self, key: str, value: Any) -> None:
89+
self.additional_properties[key] = value
90+
91+
def __delitem__(self, key: str) -> None:
92+
del self.additional_properties[key]
93+
94+
def __contains__(self, key: str) -> bool:
95+
return key in self.additional_properties

0 commit comments

Comments
 (0)