@devries-cameron20 / composio Mirror · read-only / commits / 128c63648
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 02:00 UTC

docs(python): align generated custom tool references

Dhawal Upadhyay committed Mar 25, 2026 at 16:41 UTC 128c6364849beaf784af533b17371529c4b5a260
5 files changed +85 -21
docs/content/reference/sdk-reference/python/session-context-impl.mdx
+6
@@ -3,6 +3,12 @@ title: SessionContextImpl
3 description: Concrete implementation of SessionContext. One instance is created per session (singleton) and shared across all custom tool invocations. When ``c...
4 ---
5
6 +## Properties
7 +
8 +| Name | Type | Description |
9 +|------|------|-------------|
10 +| `user_id` | `str` | The user ID for the current session. |
11 +
12 ## Methods
13
14 ### execute()
docs/content/reference/sdk-reference/python/tool-router-session.mdx
+19 -3
@@ -3,6 +3,14 @@ title: ToolRouterSession
3 description: "Tool router session containing session information and methods. Generic Parameters: TTool: The individual tool type returned by the provider. TToo..."
4 ---
5
6 +## Properties
7 +
8 +| Name | Type |
9 +|------|------|
10 +| `session_id` | `str` |
11 +| `mcp` | `Any` |
12 +| `experimental` | `'ToolRouterSessionExperimental'` |
13 +
14 ## Methods
15
16 ### tools()
@@ -51,7 +59,7 @@ def authorize(toolkit: str, callback_url: str | None = ...) -> ConnectionRequest
59 Get toolkit connection states for the session.
60
61 ```python
54 -def toolkits(toolkits: List[str | None] = ..., next_cursor: str | None = ..., limit: int | None = ..., is_connected: bool | None = ..., search: str | None = ...)
62 +def toolkits(toolkits: List[str | None] = ..., next_cursor: str | None = ..., limit: int | None = ..., is_connected: bool | None = ..., search: str | None = ...) -> ToolkitConnectionsDetails
63 ```
64
65 **Parameters**
@@ -64,6 +72,10 @@ def toolkits(toolkits: List[str | None] = ..., next_cursor: str | None = ..., li
72 | `is_connected?` | `bool \| None` |
73 | `search?` | `str \| None` |
74
75 +**Returns**
76 +
77 +`ToolkitConnectionsDetails`
78 +
79 ---
80
81 ### search()
@@ -71,7 +83,7 @@ def toolkits(toolkits: List[str | None] = ..., next_cursor: str | None = ..., li
83 Search for tools by semantic use case. Returns relevant tools for the given query with schemas and guidance.
84
85 ```python
74 -def search(query: str, model: str | None = ...)
86 +def search(query: str, model: str | None = ...) -> SessionSearchResponse
87 ```
88
89 **Parameters**
@@ -81,6 +93,10 @@ def search(query: str, model: str | None = ...)
93 | `query` | `str` |
94 | `model?` | `str \| None` |
95
96 +**Returns**
97 +
98 +`SessionSearchResponse`
99 +
100 ---
101
102 ### execute()
@@ -162,4 +178,4 @@ def proxy_execute(toolkit: str, endpoint: str, method: Literal['GET', 'POST', 'P
178
179 ---
180
165 -[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/tool_router_session.py#L47)
181 +[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/tool_router_session.py#L53)
python/composio/core/models/session_context.py
+1
@@ -107,6 +107,7 @@ class SessionContextImpl:
107
108 @property
109 def user_id(self) -> str:
110 + """The user ID for the current session."""
111 return self._user_id
112
113 def execute(
python/composio/core/models/tool_router_session.py
+16 -3
@@ -18,6 +18,9 @@ from composio_client.types.tool_router.session_execute_response import (
18 from composio_client.types.tool_router.session_proxy_execute_response import (
19 SessionProxyExecuteResponse,
20 )
21 +from composio_client.types.tool_router.session_search_response import (
22 + SessionSearchResponse,
23 +)
24
25 from composio.client import HttpClient
26 from composio.core.models.connected_accounts import ConnectionRequest
@@ -38,7 +41,10 @@ from composio.core.provider import TTool, TToolCollection
41 from composio.core.provider.base import BaseProvider
42
43 if t.TYPE_CHECKING:
41 - from composio.core.models.tool_router import ToolRouterSessionExperimental
44 + from composio.core.models.tool_router import (
45 + ToolRouterSessionExperimental,
46 + ToolkitConnectionsDetails,
47 + )
48
49 COMPOSIO_MULTI_EXECUTE_TOOL = "COMPOSIO_MULTI_EXECUTE_TOOL"
50 MAX_PARALLEL_WORKERS = 5
@@ -58,6 +64,13 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
64 experimental: Experimental features (files, assistive prompt, etc.)
65 """
66
67 + #: Unique session identifier.
68 + session_id: str
69 + #: MCP server configuration for this session.
70 + mcp: t.Any
71 + #: Experimental capabilities available on this session.
72 + experimental: "ToolRouterSessionExperimental"
73 +
74 def __init__(
75 self,
76 *,
@@ -399,7 +412,7 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
412 limit: t.Optional[int] = None,
413 is_connected: t.Optional[bool] = None,
414 search: t.Optional[str] = None,
402 - ) -> t.Any:
415 + ) -> ToolkitConnectionsDetails:
416 """
417 Get toolkit connection states for the session.
418 """
@@ -480,7 +493,7 @@ class ToolRouterSession(t.Generic[TTool, TToolCollection]):
493 *,
494 query: str,
495 model: t.Optional[str] = None,
483 - ) -> t.Any:
496 + ) -> SessionSearchResponse:
497 """
498 Search for tools by semantic use case.
499
python/scripts/generate-docs.py
+43 -15
@@ -272,23 +272,51 @@ def generate_class_mdx(
272
273 source_link = info.get("source_link", "")
274
275 - # Properties - as table for Composio class
276 - if prop_to_class:
277 - prop_rows = []
278 - for prop in info["properties"]:
279 - prop_name = prop["name"]
280 - if prop_name in prop_to_class:
281 - class_name = prop_to_class[prop_name]
282 - link = f"/reference/sdk-reference/python/{to_kebab_case(class_name)}"
283 - prop_rows.append(f"| [`{prop_name}`]({link}) | `{class_name}` |")
284 -
285 - if prop_rows:
286 - lines.append("## Properties")
287 - lines.append("")
275 + # Properties
276 + property_rows = []
277 + if info["properties"]:
278 + if prop_to_class:
279 + for prop in info["properties"]:
280 + prop_name = prop["name"]
281 + if prop_name in prop_to_class:
282 + class_name = prop_to_class[prop_name]
283 + link = (
284 + f"/reference/sdk-reference/python/{to_kebab_case(class_name)}"
285 + )
286 + property_rows.append(
287 + {
288 + "name": f"[`{prop_name}`]({link})",
289 + "type": f"`{class_name}`",
290 + "description": prop["description"],
291 + }
292 + )
293 + elif info["name"] in ADDITIONAL_CLASSES:
294 + for prop in info["properties"]:
295 + property_rows.append(
296 + {
297 + "name": f"`{prop['name']}`",
298 + "type": f"`{prop['type']}`",
299 + "description": prop["description"],
300 + }
301 + )
302 +
303 + if property_rows:
304 + include_descriptions = any(row["description"] for row in property_rows)
305 + lines.append("## Properties")
306 + lines.append("")
307 + if include_descriptions:
308 + lines.append("| Name | Type | Description |")
309 + lines.append("|------|------|-------------|")
310 + for row in property_rows:
311 + lines.append(
312 + f"| {row['name']} | {row['type']} | {row['description']} |"
313 + )
314 + else:
315 lines.append("| Name | Type |")
316 lines.append("|------|------|")
290 - lines.extend(prop_rows)
291 - lines.append("")
317 + for row in property_rows:
318 + lines.append(f"| {row['name']} | {row['type']} |")
319 + lines.append("")
320
321 # Methods
322 if info["methods"]: