Skip to main content

Tool Calls

When you’d rather not wire up your own MCP client, the SDK exposes igris.mcp — a small JSON-RPC client that speaks to the Igris gateway directly. Every call is policy-evaluated, identity-tagged, and audit-logged exactly the same way external MCP clients are.

When to use this

Both paths route through the same gateway, hit the same policies, and produce the same audit events.

API

All three accept the same McpConfigOptions:

Quick Start

Every call hits https://api.igrisecurity.com/v1/mcp/<slug>, carries Authorization: Bearer <apiKey>, and is policy-evaluated server-side before being forwarded to the upstream MCP server with its real credential injected.

Threading multiple calls under one trace

If a single user request triggers several tool calls, share the trace id so Lens can show the whole chain as one operation:
Both rows in the audit trail will share traceId = "trace-...", which lets you filter Lens to the full sequence.

Error handling

igris.mcp methods (igris.mcp.initialize, igris.mcp.listTools, igris.mcp.callTool) throw plain Error instances — not the typed IgrisError subclasses. The error message includes the HTTP status and response body:
The typed error classes (IgrisPolicyDeniedError, IgrisRateLimitError, IgrisAuthError) apply only to igris.chat.completions, igris.embeddings, and igris.connections — resources that use fetchWithRetry internally. igris.mcp uses a plain fetch call. Handle igris.mcp errors with a standard try/catch:
igris.mcp does not auto-retry. Unlike the LLM gateway resources, igris.mcp makes a single fetch call with no retry logic. If you need resilience against transient errors or rate limits, implement your own retry loop with exponential backoff.

What gets logged

Every initialize, listTools, and callTool produces an audit event with:
  • The actor (user, derived from X-Igris-User)
  • The connection slug
  • The tool name and arguments (for callTool)
  • The policy decision (allow / deny / alert)
  • Any matched rule and conditions
  • The trace id (X-Igris-Trace-Id)
  • All metadata fields (X-Igris-Metadata)
  • The timing and outcome
All of this surfaces in Lens and is queryable via the audit-events API.
  • Connections — how to register the upstream MCP server and store its credential
  • Identity & Metadata — what the gateway does with user, traceId, and metadata
  • Policies — how to gate tools/call by tool name, user, or metadata
  • MCP Client Config — the alternative path: drive an external MCP client