Aller au contenu principal

ctx.tools

Service type: ToolProxy (from apollia.context.tools).

The bridge may leave this service unattached; ctx.tools is then None.

ToolProxy​

Bases: Protocol

Tool invocation surface - native registry + MCP routing.

Tools prefixed with mcp:<server>/<name> are dispatched to a connected MCP server. All other tool names resolve through the native apollia-tools registry.

call​

async def call(self, tool_name: str, input: dict[str, Any]) -> dict[str, Any]

Invoke a tool and return its output.

Args: tool_name: Native tool name, or mcp:<server>/<name> to route the call to a connected MCP server. input: Payload, validated against the tool input schema.

Returns: The tool output, matching its declared output schema. An MCP tool returns {"content": "<text>"}, every text part joined, plus "structured" holding the object itself when the server sends a structured result, so an object never has to be parsed back from content.

list_tools​

def list_tools(self) -> list[str]

Return the names of every tool reachable from this context.

describe​

async def describe(self, name: str) -> dict[str, Any] | None

Return the descriptor for name, or None if no such tool.

tool_call_count​

def tool_call_count(self) -> int

Return how many tool calls this run has made so far.

ToolDescriptor​

Bases: Protocol

Metadata describing a registered tool.

FieldTypeDefault
namestr
versionstr
descriptionstr
input_schemadict[str, Any]
output_schemadict[str, Any]
tagslist[str]