MCP API¶
The MCP API lets an assistant call tools exposed by connected MCP servers.
Use unique_sdk.MCP when you want to trigger one tool call from an assistant context and get normalized tool output content back.
Methods¶
unique_sdk.MCP.call_tool - Call an MCP tool
Call one MCP tool with arguments and message context.
Parameters:
user_id(str, required) - User identifiercompany_id(str, required) - Company identifiername(str, required) - Tool name exposed by MCPmessageId(str, required) - Message ID associated with the tool callchatId(str, required) - Chat ID associated with the tool callarguments(dict[str, Any], required) - Tool arguments payload
Returns:
Returns an MCP object that includes tool output content.
Example:
result = unique_sdk.MCP.call_tool(
user_id=user_id,
company_id=company_id,
name="search_documents",
messageId=message_id,
chatId=chat_id,
arguments={"query": "Q4 revenue"},
)
for item in result["content"]:
print(item["type"])
Async variant
Use unique_sdk.MCP.call_tool_async(...) for async workflows.
unique_sdk.MCP.list_servers - List MCP servers that can be attached to a space
List the company's MCP servers (connectors) with the tools the company has enabled. Use the ids and tool names in the mcpServers field of Space.create_space and Space.update_space. Never returns server URLs or credentials.
Requires a role that may configure spaces.
Parameters:
user_id(str, required) - User identifiercompany_id(str, required) - Company identifier
Returns:
Returns a McpServersResponse object.
Example:
servers = unique_sdk.MCP.list_servers(user_id=user_id, company_id=company_id)
for server in servers["mcpServers"]:
print(server["id"], server["name"], [tool["name"] for tool in server["tools"]])
Async variant
Use unique_sdk.MCP.list_servers_async(...) for async workflows.
Input Types¶
CallToolParams¶
The CallToolParams type defines parameters for MCP tool calls
Fields:
name(str, required) - Tool name to invokemessageId(str, required) - Source message IDchatId(str, required) - Source chat IDarguments(dict[str, Any], required) - Tool arguments
Used in: MCP.call_tool()
Return Types¶
MCP¶
The MCP object represents one tool call result
Fields:
content(list[CallToolContentDto]) - Tool output content itemsisError(bool | None) - Optional error marker from servermcpServerId(str | None) - Optional MCP server IDname(str | None) - Optional tool name echoed by server
Returned by: MCP.call_tool(), MCP.call_tool_async()
McpServersResponse¶
The McpServersResponse object lists the company's MCP servers
Fields:
mcpServers(list[McpServerDto]) - Servers sorted by name:id(str) - MCP server IDname(str) - MCP server namedescription(str | None) - MCP server descriptionrequiresOAuth(bool) - Whether each user has to sign in before the server's tools runisSpaceRestricted(bool) - Whether the server may only be attached to the spaces inallowedSpaceIdsallowedSpaceIds(list[str]) - Space IDs the server may be attached to. Empty when unrestricted.tools(list[McpServerToolDto]) - Tools the company has enabled, each withname(str) anddescription(str | None)
Returned by: MCP.list_servers(), MCP.list_servers_async()
CallToolContentDto¶
A single content item in MCP tool output
Fields:
type(Literal["text", "image", "audio", "resource_link", "resource"]) - Content kindtext(str | None, optional) - Text payload fortype="text"data(str | None, optional) - Base64 payload fortype="image"ortype="audio"mimeType(str | None, optional) - MIME type for binary/link contenturi(str | None, optional) - URI fortype="resource_link"name(str | None, optional) - Display name fortype="resource_link"description(str | None, optional) - Description fortype="resource_link"resource(CallToolTextResourceDto|CallToolBlobResourceDto| None, optional) - Inline resource payload fortype="resource"
CallToolTextResourceDto¶
Text resource payload
Fields:
uri(str) - Resource URImimeType(str | None) - Resource MIME typetext(str) - Resource text content
CallToolBlobResourceDto¶
Blob resource payload
Fields:
uri(str) - Resource URImimeType(str | None) - Resource MIME typeblob(str) - Base64-encoded blob payload