FinishTaskTool (tools/finish_task_tool.ts)

adk-js · core/src/tools/finish_task_tool.ts · typescript · Apache-2.0
ai

Allows developers to provide LLM agents with a tool to signal task completion and return structured results.

// Source: https://github.com/google/adk-js | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import {FunctionDeclaration, Schema, Type} from '@google/genai';

import {appendInstructions} from '../models/llm_request.js';
import {
  BaseTool,
  RunAsyncToolRequest,
  ToolProcessLlmRequest,
} from './base_tool.js';

/** The name of the finish_task tool. */
export const FINISH_TASK_TOOL_NAME = 'finish_task';

/**
 * The result returned by {@link FinishTaskTool.runAsync} when validation passes.
 * The task-mode wrapper uses this to distinguish a successful completion from a
 * validation-error retry

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key