yr.tool_creds

tool_creds() → ToolCreds

Return the active tool's credentials.

Call from inside a @tool-decorated function to read the credentials the tool declared with creds=.... The returned ToolCreds is a read-only snapshot of the configured credential groups, flattened to dotted keys.

Examples

@yr.tool(creds=["my_api"])
def call_api(prompt: str) -> str:
    api_key = yr.tool_creds().require("my_api.api_key")
    ...

Returns

type: ToolCreds

The active tool's credential snapshot.

Raises

RuntimeError

When called outside an active tool invocation.