/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import { aiConfigsList } from "../../funcs/aiConfigsList.js";
import * as operations from "../../models/operations/index.js";
import { formatResult, ToolDefinition } from "../tools.js";

const args = {
  request: operations.GetAIConfigsRequest$inboundSchema,
};

export const tool$aiConfigsList: ToolDefinition<typeof args> = {
  name: "list-ai-configs",
  description:
    `Retrieves AI configuration settings for a specific project. This endpoint allows agents to access and modify AI-related configurations, ensuring that the AI's behavior aligns with project requirements and user expectations.
`,
  scopes: ["read"],
  args,
  tool: async (client, args, ctx) => {
    const [result, apiCall] = await aiConfigsList(
      client,
      args.request,
      { fetchOptions: { signal: ctx.signal } },
    ).$inspect();

    if (!result.ok) {
      return {
        content: [{ type: "text", text: result.error.message }],
        isError: true,
      };
    }

    const value = result.value;

    return formatResult(value, apiCall);
  },
};
