liveBook · Manning

Tool execution

As explained in Designing AI Systems

Tool execution is the invocation of an externally defined function, API, or service on behalf of an AI application.

Tool execution lets an AI application move from generating text to requesting externally defined functions, APIs, or services. The model selects a function from a JSON description; the application or platform executes it. Because actions can book appointments or trigger insurance processes, execution requires stronger controls than ordinary response generation. section 6.0

A managed Tool Service acts as the execution boundary. Applications discover authorized tools and submit execution requests through an SDK instead of calling external systems directly. The service validates arguments, injects credentials, performs the external API call, and standardizes results while keeping secrets out of application code and logs. section 6.1.1

A tool execution contract separates discovery, checking, and runtime execution:

  • RegisterTool adds a tool definition and metadata to the registry; RegisterMcpServer imports tools exposed by an MCP server. section 6.1.1
  • DiscoverTools returns definitions and capabilities that applications can pass to model APIs for function calling. section 6.1.1
  • ValidateTool checks schemas and business constraints before an action reaches an external system. section 6.1.1
  • ExecuteTool performs the call; ExecuteToolAsync starts long-running work, and GetTask reports its progress. section 6.1.1
Listing 6.1 The tool service gRPC contract
service ToolService {
  rpc RegisterTool(RegisterToolRequest)
      returns (RegisterToolResponse);    #A
  rpc DiscoverTools(DiscoverToolsRequest)
      returns (DiscoverToolsResponse);    #B
  rpc ExecuteTool(ExecuteToolRequest)
      returns (ExecuteToolResponse);    #C
  rpc ValidateTool(ValidateToolRequest)
      returns (ValidateToolResponse);    #D
 
  // Long-running executions
  rpc ExecuteToolAsync(ExecuteToolRequest)
      returns (ExecuteToolAsyncResponse);    #E
  rpc GetTask(GetTaskRequest) returns (GetTaskResponse);    #E
 
  // MCP integration
  rpc RegisterMcpServer(RegisterMcpServerRequest)
      returns (RegisterMcpServerResponse);    #F
}

The gRPC contract makes the service boundary concrete by listing registration, discovery, validation, synchronous execution, asynchronous execution, task retrieval, and MCP integration. section 6.1.1

How Designing AI Systems covers it

How deep it goes
Defines a managed gRPC contract and execution flow, but defers detailed implementation of external integrations and safety policies.
Examples
Uses appointment scheduling, intake submission, insurance verification, availability checks, and a Tool Service gRPC contract.
What it assumes
Assumes familiarity with AI applications, model APIs, external APIs, JSON function descriptions, and service-mediated execution.
What you can do after
Operate tool integrations through discovery, pre-flight validation, synchronous or asynchronous execution, and managed credential injection.
How it connects
Connects function calling, API integration, tool discovery, validation, credential injection, MCP, and guardrails.

Also explained in

Compare how 2 books explain tool execution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.