shipfastlabs/toolkit-database 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shipfastlabs/toolkit-database

Composer 安装命令:

composer require shipfastlabs/toolkit-database

包简介

Read-only database query tool for the Laravel AI SDK

README 文档

README

Latest Version Total Downloads

Read-only database query tool for the Laravel AI SDK

Part of the shipfastlabs/toolkit catalog of reusable AI tools for the Laravel AI SDK.

Installation

composer require shipfastlabs/toolkit-database

Usage

Instantiate the tool and pass it to an agent's tools():

use Shipfastlabs\Toolkit\Database\DatabaseQueryTool;

$tools = [new DatabaseQueryTool];

Input schema

Parameter Type Required Description
query string yes A single read-only SQL SELECT statement.

Matching rows are returned as pretty-printed JSON.

Configuration

This tool ships no config file or service provider. It reads its settings from the ai.toolkit.database key of the Laravel AI SDK's existing config/ai.php. Add the section manually:

// config/ai.php

return [

    // ... existing laravel/ai config ...

    'toolkit' => [
        'database' => [
            'connection' => env('TOOLKIT_DATABASE_CONNECTION'),
            'max_rows' => (int) env('TOOLKIT_DATABASE_MAX_ROWS', 100),
        ],
    ],

];
Key Default Description
ai.toolkit.database.connection null (default connection) The connection to query. Point at a read-only replica for extra safety.
ai.toolkit.database.max_rows 100 A LIMIT of this size is appended to any query that lacks one.

Safety

  • Read-only enforced: only a single statement beginning with SELECT (or a WITH … SELECT CTE) is allowed.
  • Write keywords rejected: INSERT, UPDATE, DELETE, DROP, ALTER and similar keywords are refused, even inside an otherwise-SELECT statement.
  • Single statement only: queries containing ; separators are refused.
  • Row cap: results are bounded by max_rows.
  • Query failures are returned to the model as strings, not thrown.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固