Applies to v1.3.18

Using The SDKs

Purpose

This page helps you choose a client library and shows the smallest working program in each language: authenticate, list the tools, invoke one. The SDK chapter is the reference for everything beyond that — options, logging, orchestrator integration and enterprise patterns — and this page links to it rather than repeating it.

What The SDKs Do

The SDKs are client libraries for the platform's MCP endpoint, in .NET, TypeScript, Python and Java. They take care of what a raw MCP client leaves to you:

  • the MCP handshake and the session, including starting a new session and replaying a request once when the platform no longer recognizes the old one;
  • paging through the tool catalog;
  • adding your credential to every request — an API key, OAuth2 client credentials with automatic renewal, or a bearer token you forward;
  • fetching the toolset's system prompt for you to give your model;
  • sending your correlation id and warning you when the platform did not accept it.

They call tools by name — the {toolset}-{endpoint} name a tool listing shows. They do not cover A2A; to call an agent, see Calling Agents Over A2A.

Every SDK, from version 1.3.0, can also start, read and cancel hosted-agent executions and sign webhook deliveries. See On-Demand Agent Runs.

Choosing A Language

Language Core package Orchestrator adapters Reference
.NET CodedProjects.AI.ApiMapper.Client Microsoft.Extensions.AI, Semantic Kernel, Azure AI Foundry Agents .NET SDK
TypeScript @codedprojects/api-mapper-client OpenAI, LangChain.js TypeScript SDK
Python api-mapper-client LangChain, LangGraph Python SDK
Java com.codedprojects:api-mapper-client Spring AI Java SDK

Pick the language your application is written in. If you use one of the listed orchestrators, add its adapter package: it turns the tool list into that framework's native tool type, so the framework's own tool loop calls the platform for you.

What You Need

The same values as any other caller — see Endpoints & Addressing:

  • the platform's base URL, for example https://apimapper.example.com;
  • the tenant id and the client id of a client application with a toolset assigned;
  • a credential. The examples use an API key read from an environment variable; see SDK Authentication for OAuth2 client credentials and forwarded bearer tokens.

Authenticate, List, Invoke

The tool name and its argument below are placeholders; use a name your own tool listing returns.

.NET

dotnet add package CodedProjects.AI.ApiMapper.Client
builder.Services
    .AddApiMapperClient(opts =>
    {
        opts.BaseUrl  = configuration["ApiMapper:BaseUrl"];
        opts.TenantId = Guid.Parse(configuration["ApiMapper:TenantId"]);
        opts.ClientId = "my-app";
    })
    .WithApiKey(configuration["ApiMapper:ApiKey"]);

// In a service that receives IAiApiMapperClient:
var tools  = await client.GetToolsAsync();
var result = await client.InvokeToolAsync("crm-get-customer", new { customerNumber = "C-1001" });
Console.WriteLine(result?.ToText());

TypeScript

npm install @codedprojects/api-mapper-client
import { ApiMapperClient, ApiKeyCredentialProvider, toolResultToText } from "@codedprojects/api-mapper-client";

const client = new ApiMapperClient({
  baseUrl:     process.env.APIMAPPER_BASE_URL!,
  tenantId:    process.env.APIMAPPER_TENANT_ID!,
  clientId:    "my-app",
  credentials: new ApiKeyCredentialProvider(process.env.APIMAPPER_API_KEY!),
});

const tools  = await client.getTools();
const result = await client.invokeTool("crm-get-customer", { customerNumber: "C-1001" });
console.log(toolResultToText(result!));

Python

pip install api-mapper-client
import os, uuid
from api_mapper_client import ApiMapperClient, ApiMapperClientOptions, ApiKeyCredentialProvider

async with ApiMapperClient(ApiMapperClientOptions(
    base_url=os.getenv("APIMAPPER_BASE_URL"),
    tenant_id=uuid.UUID(os.getenv("APIMAPPER_TENANT_ID")),
    client_id="my-app",
    credentials=ApiKeyCredentialProvider(os.getenv("APIMAPPER_API_KEY")),
)) as client:
    tools  = await client.get_tools()
    result = await client.invoke_tool("crm-get-customer", {"customerNumber": "C-1001"})
    print(result.to_text() if result else "")

Java

<dependency>
  <groupId>com.codedprojects</groupId>
  <artifactId>api-mapper-client</artifactId>
  <version>1.3.0</version>
</dependency>
var opts = ApiMapperClientOptions.builder()
    .baseUrl(System.getenv("APIMAPPER_BASE_URL"))
    .tenantId(UUID.fromString(System.getenv("APIMAPPER_TENANT_ID")))
    .clientId("my-app")
    .credentials(new ApiKeyCredentialProvider(System.getenv("APIMAPPER_API_KEY")))
    .build();

try (var client = new ApiMapperClient(opts)) {
    var tools  = client.getTools().get();
    var result = client.invokeTool("crm-get-customer", Map.of("customerNumber", "C-1001")).get();
    System.out.println(result != null ? result.toText() : "");
}

Giving The Model Its Instructions

A toolset can carry a system prompt written by its administrator, composed per client application. The SDKs fetch it for you when you configure the prompt's resource URI, and every orchestrator example in the SDK chapter injects it as the system message before the first model call. See System Prompt Injection.

When A Call Fails

  • A request the platform refused — an HTTP error or a JSON-RPC error — raises the SDK's request exception, which carries the method, the HTTP status and the JSON-RPC error code. An unauthorized caller therefore fails loudly rather than seeing an empty tool list.
  • A tool result with isError: true is a result, not an exception: the call reached the tool and the downstream system answered with an error, which the result's text describes.

See Errors And Session Recovery and Errors, Limits & Correlation.

Correlation

Each SDK can send your own trace or request id with every call, from an ambient provider or per call. See Correlation IDs.