@squadbase/vite-server 0.1.17-dev.a107052 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/cli/index.js +3266 -730
  2. package/dist/connectors/airtable-oauth.js +48 -8
  3. package/dist/connectors/airtable.js +44 -8
  4. package/dist/connectors/amplitude.js +8 -8
  5. package/dist/connectors/anthropic.js +2 -2
  6. package/dist/connectors/asana.js +37 -10
  7. package/dist/connectors/attio.js +30 -13
  8. package/dist/connectors/aws-billing.js +8 -8
  9. package/dist/connectors/azure-sql.js +31 -7
  10. package/dist/connectors/backlog-api-key.js +40 -15
  11. package/dist/connectors/clickup.js +50 -10
  12. package/dist/connectors/cosmosdb.js +12 -12
  13. package/dist/connectors/customerio.js +8 -8
  14. package/dist/connectors/dbt.js +686 -25
  15. package/dist/connectors/freshdesk.js +82 -8
  16. package/dist/connectors/freshsales.js +8 -8
  17. package/dist/connectors/freshservice.js +8 -8
  18. package/dist/connectors/gamma.js +15 -15
  19. package/dist/connectors/gemini.js +2 -2
  20. package/dist/connectors/github.js +12 -12
  21. package/dist/connectors/gmail-oauth.js +10 -10
  22. package/dist/connectors/gmail.js +4 -4
  23. package/dist/connectors/google-ads.js +8 -8
  24. package/dist/connectors/google-analytics-oauth.js +152 -25
  25. package/dist/connectors/google-analytics.js +475 -95
  26. package/dist/connectors/google-audit-log.js +4 -4
  27. package/dist/connectors/google-calendar-oauth.js +61 -15
  28. package/dist/connectors/google-calendar.js +61 -11
  29. package/dist/connectors/google-docs.js +10 -10
  30. package/dist/connectors/google-drive.js +32 -10
  31. package/dist/connectors/google-search-console-oauth.js +126 -17
  32. package/dist/connectors/google-sheets.js +6 -6
  33. package/dist/connectors/google-slides.js +10 -10
  34. package/dist/connectors/grafana.js +45 -10
  35. package/dist/connectors/hubspot-oauth.js +41 -9
  36. package/dist/connectors/hubspot.js +25 -9
  37. package/dist/connectors/influxdb.js +8 -8
  38. package/dist/connectors/intercom-oauth.js +72 -12
  39. package/dist/connectors/intercom.js +12 -12
  40. package/dist/connectors/jdbc.js +6 -6
  41. package/dist/connectors/jira-api-key.js +68 -11
  42. package/dist/connectors/kintone-api-token.js +66 -18
  43. package/dist/connectors/kintone.js +54 -11
  44. package/dist/connectors/linear.js +54 -12
  45. package/dist/connectors/linkedin-ads.js +41 -14
  46. package/dist/connectors/mailchimp-oauth.js +6 -6
  47. package/dist/connectors/mailchimp.js +6 -6
  48. package/dist/connectors/meta-ads-oauth.js +33 -14
  49. package/dist/connectors/meta-ads.js +35 -14
  50. package/dist/connectors/mixpanel.js +8 -8
  51. package/dist/connectors/monday.js +9 -9
  52. package/dist/connectors/mongodb.js +8 -8
  53. package/dist/connectors/notion-oauth.js +60 -11
  54. package/dist/connectors/notion.js +60 -11
  55. package/dist/connectors/openai.js +2 -2
  56. package/dist/connectors/oracle.js +23 -7
  57. package/dist/connectors/outlook-oauth.js +20 -20
  58. package/dist/connectors/powerbi-oauth.js +12 -12
  59. package/dist/connectors/salesforce.js +42 -9
  60. package/dist/connectors/semrush.js +6 -6
  61. package/dist/connectors/sentry.js +36 -10
  62. package/dist/connectors/shopify-oauth.js +43 -10
  63. package/dist/connectors/shopify.js +8 -8
  64. package/dist/connectors/sqlserver.js +31 -7
  65. package/dist/connectors/stripe-api-key.js +66 -15
  66. package/dist/connectors/stripe-oauth.js +70 -19
  67. package/dist/connectors/supabase.js +22 -5
  68. package/dist/connectors/tableau.js +14 -14
  69. package/dist/connectors/tiktok-ads.js +37 -16
  70. package/dist/connectors/wix-store.js +8 -8
  71. package/dist/connectors/zendesk-oauth.js +55 -12
  72. package/dist/connectors/zendesk.js +12 -12
  73. package/dist/index.js +3284 -728
  74. package/dist/main.js +3284 -728
  75. package/dist/vite-plugin.js +3264 -728
  76. package/package.json +1 -1
@@ -275,7 +275,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
275
275
  /**
276
276
  * Create tools for connections that belong to this connector.
277
277
  * Filters connections by connectorKey internally.
278
- * Returns tools keyed as `${connectorKey}_${toolName}`.
278
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
279
279
  */
280
280
  createTools(connections, config, opts) {
281
281
  const myConnections = connections.filter(
@@ -285,7 +285,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
285
285
  for (const t of Object.values(this.tools)) {
286
286
  const tool = t.createTool(myConnections, config);
287
287
  const originalToModelOutput = tool.toModelOutput;
288
- result[`${this.connectorKey}_${t.name}`] = {
288
+ result[`connector_${this.connectorKey}_${t.name}`] = {
289
289
  ...tool,
290
290
  toModelOutput: async (options) => {
291
291
  if (!originalToModelOutput) {
@@ -415,14 +415,14 @@ var AUTH_TYPES = {
415
415
  // ../connectors/src/connectors/intercom/setup.ts
416
416
  var intercomOnboarding = new ConnectorOnboarding({
417
417
  dataOverviewInstructions: {
418
- en: `1. Call intercom_request with GET /contacts?per_page=5 to explore contacts structure
419
- 2. Call intercom_request with GET /conversations?per_page=5 to explore conversations structure
420
- 3. Call intercom_request with GET /data_attributes?model=contact to list contact data attributes
421
- 4. Call intercom_request with GET /companies?per_page=5 to explore company structure`,
422
- ja: `1. intercom_request \u3067 GET /contacts?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
423
- 2. intercom_request \u3067 GET /conversations?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306E\u69CB\u9020\u3092\u78BA\u8A8D
424
- 3. intercom_request \u3067 GET /data_attributes?model=contact \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u30C7\u30FC\u30BF\u5C5E\u6027\u3092\u78BA\u8A8D
425
- 4. intercom_request \u3067 GET /companies?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F01\u696D\u306E\u69CB\u9020\u3092\u78BA\u8A8D`
418
+ en: `1. Call connector_intercom_request with GET /contacts?per_page=5 to explore contacts structure
419
+ 2. Call connector_intercom_request with GET /conversations?per_page=5 to explore conversations structure
420
+ 3. Call connector_intercom_request with GET /data_attributes?model=contact to list contact data attributes
421
+ 4. Call connector_intercom_request with GET /companies?per_page=5 to explore company structure`,
422
+ ja: `1. connector_intercom_request \u3067 GET /contacts?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u69CB\u9020\u3092\u78BA\u8A8D
423
+ 2. connector_intercom_request \u3067 GET /conversations?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F1A\u8A71\u306E\u69CB\u9020\u3092\u78BA\u8A8D
424
+ 3. connector_intercom_request \u3067 GET /data_attributes?model=contact \u3092\u547C\u3073\u51FA\u3057\u3001\u30B3\u30F3\u30BF\u30AF\u30C8\u306E\u30C7\u30FC\u30BF\u5C5E\u6027\u3092\u78BA\u8A8D
425
+ 4. connector_intercom_request \u3067 GET /companies?per_page=5 \u3092\u547C\u3073\u51FA\u3057\u3001\u4F01\u696D\u306E\u69CB\u9020\u3092\u78BA\u8A8D`
426
426
  }
427
427
  });
428
428
 
@@ -619,7 +619,7 @@ var intercomConnector = new ConnectorPlugin({
619
619
  systemPrompt: {
620
620
  en: `### Tools
621
621
 
622
- - \`intercom_request\`: The only way to call the Intercom API. Use it to query contacts, conversations, companies, articles, tags, segments, and more. Authentication (Bearer token) and API version header (Intercom-Version: 2.11) are configured automatically. Intercom uses cursor-based pagination with the \`starting_after\` parameter from \`pages.next.starting_after\` in the response. Use search endpoints (POST) for complex queries with filters.
622
+ - \`connector_intercom_request\`: The only way to call the Intercom API. Use it to query contacts, conversations, companies, articles, tags, segments, and more. Authentication (Bearer token) and API version header (Intercom-Version: 2.11) are configured automatically. Intercom uses cursor-based pagination with the \`starting_after\` parameter from \`pages.next.starting_after\` in the response. Use search endpoints (POST) for complex queries with filters.
623
623
 
624
624
  ### Business Logic
625
625
 
@@ -715,7 +715,7 @@ export default async function handler(c: Context) {
715
715
  - Date fields use Unix timestamps`,
716
716
  ja: `### \u30C4\u30FC\u30EB
717
717
 
718
- - \`intercom_request\`: Intercom API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u4F1A\u8A71\u3001\u4F01\u696D\u3001\u8A18\u4E8B\u3001\u30BF\u30B0\u3001\u30BB\u30B0\u30E1\u30F3\u30C8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3068API\u30D0\u30FC\u30B8\u30E7\u30F3\u30D8\u30C3\u30C0\u30FC\uFF08Intercom-Version: 2.11\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Intercom\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`pages.next.starting_after\` \u304B\u3089\u306E \`starting_after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30AF\u30A8\u30EA\u306B\u306Fsearch\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08POST\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
718
+ - \`connector_intercom_request\`: Intercom API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30B3\u30F3\u30BF\u30AF\u30C8\u3001\u4F1A\u8A71\u3001\u4F01\u696D\u3001\u8A18\u4E8B\u3001\u30BF\u30B0\u3001\u30BB\u30B0\u30E1\u30F3\u30C8\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u3068API\u30D0\u30FC\u30B8\u30E7\u30F3\u30D8\u30C3\u30C0\u30FC\uFF08Intercom-Version: 2.11\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Intercom\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E \`pages.next.starting_after\` \u304B\u3089\u306E \`starting_after\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002\u8907\u96D1\u306A\u30AF\u30A8\u30EA\u306B\u306Fsearch\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\uFF08POST\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
719
719
 
720
720
  ### Business Logic
721
721
 
@@ -1023,7 +1023,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
1023
1023
  /**
1024
1024
  * Create tools for connections that belong to this connector.
1025
1025
  * Filters connections by connectorKey internally.
1026
- * Returns tools keyed as `${connectorKey}_${toolName}`.
1026
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
1027
1027
  */
1028
1028
  createTools(connections, config, opts) {
1029
1029
  const myConnections = connections.filter(
@@ -1033,7 +1033,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
1033
1033
  for (const t of Object.values(this.tools)) {
1034
1034
  const tool = t.createTool(myConnections, config);
1035
1035
  const originalToModelOutput = tool.toModelOutput;
1036
- result[`${this.connectorKey}_${t.name}`] = {
1036
+ result[`connector_${this.connectorKey}_${t.name}`] = {
1037
1037
  ...tool,
1038
1038
  toModelOutput: async (options) => {
1039
1039
  if (!originalToModelOutput) {
@@ -1171,13 +1171,13 @@ init_utils2();
1171
1171
  // ../connectors/src/connectors/jdbc/setup.ts
1172
1172
  var jdbcOnboarding = new ConnectorOnboarding({
1173
1173
  dataOverviewInstructions: {
1174
- en: `1. Use \`jdbc_executeQuery\` to detect the database flavor: \`SELECT version()\` (works on PostgreSQL/MySQL/MariaDB)
1174
+ en: `1. Use \`connector_jdbc_executeQuery\` to detect the database flavor: \`SELECT version()\` (works on PostgreSQL/MySQL/MariaDB)
1175
1175
  2. List tables:
1176
1176
  - PostgreSQL: \`SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'\`
1177
1177
  - MySQL/MariaDB: \`SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()\`
1178
1178
  3. For key tables, fetch column info from \`information_schema.columns\`
1179
1179
  4. Sample up to 3 tables with \`SELECT * FROM <table_name> LIMIT 5\` if column info alone is insufficient`,
1180
- ja: `1. \`jdbc_executeQuery\` \u3067DB\u30D5\u30EC\u30FC\u30D0\u30FC\u3092\u5224\u5B9A: \`SELECT version()\` (PostgreSQL/MySQL/MariaDB \u3067\u52D5\u4F5C)
1180
+ ja: `1. \`connector_jdbc_executeQuery\` \u3067DB\u30D5\u30EC\u30FC\u30D0\u30FC\u3092\u5224\u5B9A: \`SELECT version()\` (PostgreSQL/MySQL/MariaDB \u3067\u52D5\u4F5C)
1181
1181
  2. \u30C6\u30FC\u30D6\u30EB\u4E00\u89A7\u3092\u53D6\u5F97:
1182
1182
  - PostgreSQL: \`SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'\`
1183
1183
  - MySQL/MariaDB: \`SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()\`
@@ -1697,7 +1697,7 @@ var jdbcConnector = new ConnectorPlugin({
1697
1697
  systemPrompt: {
1698
1698
  en: `### Tools
1699
1699
 
1700
- - \`jdbc_executeQuery\`: Executes a SQL query through a JDBC URL and returns rows. The connector dispatches by URL prefix to the matching native driver, so use the dialect that matches the connection. Use this for schema exploration via \`information_schema\` (or vendor equivalent) and for sampling data. See the SQL Reference below.
1700
+ - \`connector_jdbc_executeQuery\`: Executes a SQL query through a JDBC URL and returns rows. The connector dispatches by URL prefix to the matching native driver, so use the dialect that matches the connection. Use this for schema exploration via \`information_schema\` (or vendor equivalent) and for sampling data. See the SQL Reference below.
1701
1701
 
1702
1702
  ### Business Logic
1703
1703
 
@@ -1729,7 +1729,7 @@ Explicitly **not** supported via this connector \u2014 use the dedicated connect
1729
1729
  The platform's server-logic schema inference may wrap your query as \`SELECT * FROM (<inner>) AS _sq LIMIT N\` (PostgreSQL/MySQL syntax). For PostgreSQL / Redshift / MySQL routes this executes natively. For \`jdbc:sqlserver://\` and \`jdbc:oracle:thin:\` routes, the connector detects this exact wrapper at \`query()\` time, executes \`<inner>\` directly via the dialect-specific driver, and slices the first N rows in JS. You do not need to handle this \u2014 but in queries **you author**, do not use \`LIMIT\` for the SQL Server / Oracle routes; use \`TOP\` / \`FETCH FIRST\` as listed above.`,
1730
1730
  ja: `### \u30C4\u30FC\u30EB
1731
1731
 
1732
- - \`jdbc_executeQuery\`: JDBC URL \u7D4C\u7531\u3067 SQL \u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\u30B3\u30CD\u30AF\u30BF\u306F URL \u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304B\u3089\u5BFE\u5FDC\u3059\u308B\u30CD\u30A4\u30C6\u30A3\u30D6\u30C9\u30E9\u30A4\u30D0\u3078\u632F\u308A\u5206\u3051\u308B\u305F\u3081\u3001\u63A5\u7D9A\u5148\u306B\u5408\u3063\u305F\u65B9\u8A00\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\`information_schema\`\uFF08\u307E\u305F\u306F\u5404 DB \u306E\u540C\u7B49\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u30D3\u30E5\u30FC\uFF09\u3092\u4F7F\u3063\u305F\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3084\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u306B\u4F7F\u3044\u307E\u3059\u3002\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
1732
+ - \`connector_jdbc_executeQuery\`: JDBC URL \u7D4C\u7531\u3067 SQL \u30AF\u30A8\u30EA\u3092\u5B9F\u884C\u3057\u3001\u884C\u30C7\u30FC\u30BF\u3092\u8FD4\u3057\u307E\u3059\u3002\u30B3\u30CD\u30AF\u30BF\u306F URL \u30D7\u30EC\u30D5\u30A3\u30C3\u30AF\u30B9\u304B\u3089\u5BFE\u5FDC\u3059\u308B\u30CD\u30A4\u30C6\u30A3\u30D6\u30C9\u30E9\u30A4\u30D0\u3078\u632F\u308A\u5206\u3051\u308B\u305F\u3081\u3001\u63A5\u7D9A\u5148\u306B\u5408\u3063\u305F\u65B9\u8A00\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\`information_schema\`\uFF08\u307E\u305F\u306F\u5404 DB \u306E\u540C\u7B49\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u30D3\u30E5\u30FC\uFF09\u3092\u4F7F\u3063\u305F\u30B9\u30AD\u30FC\u30DE\u63A2\u7D22\u3084\u30C7\u30FC\u30BF\u306E\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0\u306B\u4F7F\u3044\u307E\u3059\u3002\u4E0B\u90E8\u306E\u300CSQL \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
1733
1733
 
1734
1734
  ### Business Logic
1735
1735
 
@@ -224,7 +224,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
224
224
  /**
225
225
  * Create tools for connections that belong to this connector.
226
226
  * Filters connections by connectorKey internally.
227
- * Returns tools keyed as `${connectorKey}_${toolName}`.
227
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
228
228
  */
229
229
  createTools(connections, config, opts) {
230
230
  const myConnections = connections.filter(
@@ -234,7 +234,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
234
234
  for (const t of Object.values(this.tools)) {
235
235
  const tool = t.createTool(myConnections, config);
236
236
  const originalToModelOutput = tool.toModelOutput;
237
- result[`${this.connectorKey}_${t.name}`] = {
237
+ result[`connector_${this.connectorKey}_${t.name}`] = {
238
238
  ...tool,
239
239
  toModelOutput: async (options) => {
240
240
  if (!originalToModelOutput) {
@@ -364,12 +364,12 @@ var AUTH_TYPES = {
364
364
  // ../connectors/src/connectors/jira/setup.ts
365
365
  var jiraOnboarding = new ConnectorOnboarding({
366
366
  dataOverviewInstructions: {
367
- en: `1. Call jira-api-key_request with GET project to list all accessible projects
368
- 2. For key projects, call jira-api-key_request with POST search to search issues using JQL (e.g., body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] })
369
- 3. Call jira-api-key_request with GET issue/{issueKey} to inspect a sample issue's full details`,
370
- ja: `1. jira-api-key_request \u3067 GET project \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
371
- 2. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 jira-api-key_request \u3067 POST search \u3092\u4F7F\u7528\u3057\u3066JQL\u3067\u30A4\u30B7\u30E5\u30FC\u3092\u691C\u7D22\uFF08\u4F8B: body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] }\uFF09
372
- 3. jira-api-key_request \u3067 GET issue/{issueKey} \u3092\u547C\u3073\u51FA\u3057\u3001\u30B5\u30F3\u30D7\u30EB\u30A4\u30B7\u30E5\u30FC\u306E\u8A73\u7D30\u3092\u78BA\u8A8D`
367
+ en: `1. Call connector_jira-api-key_request with GET project to list all accessible projects
368
+ 2. For key projects, call connector_jira-api-key_request with POST search to search issues using JQL (e.g., body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] })
369
+ 3. Call connector_jira-api-key_request with GET issue/{issueKey} to inspect a sample issue's full details`,
370
+ ja: `1. connector_jira-api-key_request \u3067 GET project \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
371
+ 2. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 connector_jira-api-key_request \u3067 POST search \u3092\u4F7F\u7528\u3057\u3066JQL\u3067\u30A4\u30B7\u30E5\u30FC\u3092\u691C\u7D22\uFF08\u4F8B: body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] }\uFF09
372
+ 3. connector_jira-api-key_request \u3067 GET issue/{issueKey} \u3092\u547C\u3073\u51FA\u3057\u3001\u30B5\u30F3\u30D7\u30EB\u30A4\u30B7\u30E5\u30FC\u306E\u8A73\u7D30\u3092\u78BA\u8A8D`
373
373
  }
374
374
  });
375
375
 
@@ -431,6 +431,43 @@ async function getProject(params, keyOrId) {
431
431
  }
432
432
  return await res.json();
433
433
  }
434
+ async function fetchProjectIssueCount(params, projectKey) {
435
+ try {
436
+ const jql = encodeURIComponent(`project = ${projectKey}`);
437
+ const res = await apiFetch(
438
+ params,
439
+ `search?jql=${jql}&maxResults=0`
440
+ );
441
+ if (!res.ok) return null;
442
+ const data = await res.json();
443
+ return typeof data.total === "number" ? data.total : null;
444
+ } catch {
445
+ return null;
446
+ }
447
+ }
448
+ async function fetchStatusBreakdown(params, projectKey) {
449
+ try {
450
+ const jql = encodeURIComponent(
451
+ `project = ${projectKey} ORDER BY created DESC`
452
+ );
453
+ const res = await apiFetch(
454
+ params,
455
+ `search?jql=${jql}&maxResults=100&fields=status`
456
+ );
457
+ if (!res.ok) return null;
458
+ const data = await res.json();
459
+ const issues = data.issues ?? [];
460
+ if (issues.length === 0) return null;
461
+ const breakdown = {};
462
+ for (const issue of issues) {
463
+ const category = issue.fields?.status?.statusCategory?.name ?? "Unknown";
464
+ breakdown[category] = (breakdown[category] ?? 0) + 1;
465
+ }
466
+ return breakdown;
467
+ } catch {
468
+ return null;
469
+ }
470
+ }
434
471
  var jiraSetupFlow = {
435
472
  initialState: () => ({}),
436
473
  steps: [
@@ -471,17 +508,37 @@ var jiraSetupFlow = {
471
508
  const sections = ["## Jira", ""];
472
509
  for (const key of targetKeys) {
473
510
  const project = await getProject(rt.params, key);
474
- sections.push(`### Project: ${project.name} (${project.key})`, "");
511
+ const issueCount = await fetchProjectIssueCount(rt.params, key);
512
+ const countLabel = issueCount == null ? "" : ` - ${issueCount.toLocaleString()} issues`;
513
+ sections.push(
514
+ `### Project: ${project.name} (${project.key})${countLabel}`,
515
+ ""
516
+ );
475
517
  const lead = project.lead?.displayName ?? "-";
476
518
  const typeKey = project.projectTypeKey ?? "-";
477
519
  sections.push(`- Lead: ${lead}`);
478
520
  sections.push(`- Project type: ${typeKey}`);
521
+ if (issueCount != null) {
522
+ sections.push(`- Total issues: ${issueCount.toLocaleString()}`);
523
+ }
479
524
  const issueTypes = project.issueTypes ?? [];
480
525
  sections.push(`- Issue types (${issueTypes.length}):`);
481
526
  for (const it of issueTypes) {
482
527
  const suffix = it.subtask ? " (sub-task)" : "";
483
528
  sections.push(` - ${it.name}${suffix}`);
484
529
  }
530
+ const breakdown = await fetchStatusBreakdown(rt.params, key);
531
+ if (breakdown && Object.keys(breakdown).length > 0) {
532
+ sections.push("");
533
+ sections.push("**Status category breakdown (from recent 100 issues):**", "");
534
+ sections.push("| Status category | Count |");
535
+ sections.push("|-----------------|-------|");
536
+ for (const [category, count] of Object.entries(breakdown).sort(
537
+ (a, b) => b[1] - a[1]
538
+ )) {
539
+ sections.push(`| ${category} | ${count} |`);
540
+ }
541
+ }
485
542
  sections.push("");
486
543
  }
487
544
  return sections.join("\n");
@@ -580,7 +637,7 @@ var jiraConnector = new ConnectorPlugin({
580
637
  systemPrompt: {
581
638
  en: `### Tools
582
639
 
583
- - \`jira-api-key_request\`: The only way to call the Jira Cloud REST API (v3). Use it to list projects, search issues with JQL, get issue details, create/update issues, manage transitions, and add comments. Authentication (Basic Auth with email + API token) and instance URL are configured automatically.
640
+ - \`connector_jira-api-key_request\`: The only way to call the Jira Cloud REST API (v3). Use it to list projects, search issues with JQL, get issue details, create/update issues, manage transitions, and add comments. Authentication (Basic Auth with email + API token) and instance URL are configured automatically.
584
641
 
585
642
  ### Business Logic
586
643
 
@@ -650,7 +707,7 @@ await jira.request("/rest/api/3/issue", {
650
707
  - Text search: summary ~ "keyword"`,
651
708
  ja: `### \u30C4\u30FC\u30EB
652
709
 
653
- - \`jira-api-key_request\`: Jira Cloud REST API\uFF08v3\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001JQL\u306B\u3088\u308B\u30A4\u30B7\u30E5\u30FC\u691C\u7D22\u3001\u30A4\u30B7\u30E5\u30FC\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u30A4\u30B7\u30E5\u30FC\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001\u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u7BA1\u7406\u3001\u30B3\u30E1\u30F3\u30C8\u8FFD\u52A0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Basic Auth: \u30E1\u30FC\u30EB + API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
710
+ - \`connector_jira-api-key_request\`: Jira Cloud REST API\uFF08v3\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001JQL\u306B\u3088\u308B\u30A4\u30B7\u30E5\u30FC\u691C\u7D22\u3001\u30A4\u30B7\u30E5\u30FC\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u30A4\u30B7\u30E5\u30FC\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001\u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u7BA1\u7406\u3001\u30B3\u30E1\u30F3\u30C8\u8FFD\u52A0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Basic Auth: \u30E1\u30FC\u30EB + API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
654
711
 
655
712
  ### Business Logic
656
713
 
@@ -253,7 +253,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
253
253
  /**
254
254
  * Create tools for connections that belong to this connector.
255
255
  * Filters connections by connectorKey internally.
256
- * Returns tools keyed as `${connectorKey}_${toolName}`.
256
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
257
257
  */
258
258
  createTools(connections, config, opts) {
259
259
  const myConnections = connections.filter(
@@ -263,7 +263,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
263
263
  for (const t of Object.values(this.tools)) {
264
264
  const tool = t.createTool(myConnections, config);
265
265
  const originalToModelOutput = tool.toModelOutput;
266
- result[`${this.connectorKey}_${t.name}`] = {
266
+ result[`connector_${this.connectorKey}_${t.name}`] = {
267
267
  ...tool,
268
268
  toModelOutput: async (options) => {
269
269
  if (!originalToModelOutput) {
@@ -390,14 +390,14 @@ var kintoneApiTokenOnboarding = new ConnectorOnboarding({
390
390
  dataOverviewInstructions: {
391
391
  en: `Each connection is scoped to a single kintone app (configured via the "app-id" parameter). The request tool auto-injects the configured app id, so you do NOT need to specify "app=" in paths or "app" in bodies. apps.json is NOT available with API Token auth.
392
392
 
393
- 1. Call kintone-api-key_request with GET app.json to fetch the scoped app's metadata (name, description, creator)
394
- 2. Call kintone-api-key_request with GET app/form/fields.json to get field definitions
395
- 3. Call kintone-api-key_request with GET records.json with query=limit 5 to sample records`,
393
+ 1. Call connector_kintone-api-key_request with GET app.json to fetch the scoped app's metadata (name, description, creator)
394
+ 2. Call connector_kintone-api-key_request with GET app/form/fields.json to get field definitions
395
+ 3. Call connector_kintone-api-key_request with GET records.json with query=limit 5 to sample records`,
396
396
  ja: `\u5404\u63A5\u7D9A\u306F1\u3064\u306Ekintone\u30A2\u30D7\u30EA\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\uFF08"app-id" \u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u8A2D\u5B9A\uFF09\u3002request \u30C4\u30FC\u30EB\u306F\u8A2D\u5B9A\u3055\u308C\u305F\u30A2\u30D7\u30EAID\u3092\u81EA\u52D5\u6CE8\u5165\u3059\u308B\u305F\u3081\u3001\u30D1\u30B9\u306B "app=" \u3084 body \u306B "app" \u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u306F\u3042\u308A\u307E\u305B\u3093\u3002API Token \u8A8D\u8A3C\u3067\u306F apps.json \u306F\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002
397
397
 
398
- 1. kintone-api-key_request \u3067 GET app.json \u3092\u547C\u3073\u51FA\u3057\u3001\u30B9\u30B3\u30FC\u30D7\u5BFE\u8C61\u30A2\u30D7\u30EA\u306E\u30E1\u30BF\u60C5\u5831\uFF08\u30A2\u30D7\u30EA\u540D\u3001\u8AAC\u660E\u3001\u4F5C\u6210\u8005\uFF09\u3092\u53D6\u5F97
399
- 2. kintone-api-key_request \u3067 GET app/form/fields.json \u3092\u547C\u3073\u51FA\u3057\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u3092\u53D6\u5F97
400
- 3. kintone-api-key_request \u3067 GET records.json \u3092 query=limit 5 \u3067\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
398
+ 1. connector_kintone-api-key_request \u3067 GET app.json \u3092\u547C\u3073\u51FA\u3057\u3001\u30B9\u30B3\u30FC\u30D7\u5BFE\u8C61\u30A2\u30D7\u30EA\u306E\u30E1\u30BF\u60C5\u5831\uFF08\u30A2\u30D7\u30EA\u540D\u3001\u8AAC\u660E\u3001\u4F5C\u6210\u8005\uFF09\u3092\u53D6\u5F97
399
+ 2. connector_kintone-api-key_request \u3067 GET app/form/fields.json \u3092\u547C\u3073\u51FA\u3057\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u3092\u53D6\u5F97
400
+ 3. connector_kintone-api-key_request \u3067 GET records.json \u3092 query=limit 5 \u3067\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
401
401
  }
402
402
  });
403
403
 
@@ -421,6 +421,7 @@ async function apiFetch(params, path2, init) {
421
421
  }
422
422
 
423
423
  // ../connectors/src/connectors/kintone-api-token/setup-flow.ts
424
+ var SAMPLE_RECORD_LIMIT = 5;
424
425
  async function getAppMetadata(params, appId) {
425
426
  const res = await apiFetch(
426
427
  params,
@@ -447,15 +448,28 @@ async function getFormFields(params, appId) {
447
448
  }
448
449
  return await res.json();
449
450
  }
451
+ async function getSampleRecords(params, appId) {
452
+ const res = await apiFetch(
453
+ params,
454
+ `records.json?app=${encodeURIComponent(appId)}&query=${encodeURIComponent(`limit ${SAMPLE_RECORD_LIMIT}`)}&totalCount=true`
455
+ );
456
+ if (!res.ok) return { records: [], totalCount: null };
457
+ return await res.json();
458
+ }
459
+ function formatRecordValue(val) {
460
+ if (val == null) return "";
461
+ if (typeof val === "string") return val.length > 50 ? `${val.slice(0, 50)}\u2026` : val;
462
+ if (Array.isArray(val)) return `[${val.length} items]`;
463
+ if (typeof val === "object") return JSON.stringify(val).slice(0, 50);
464
+ return String(val);
465
+ }
450
466
  var kintoneApiTokenSetupFlow = {
451
467
  initialState: () => ({}),
452
468
  steps: [],
453
469
  async finalize(_state, rt) {
454
- const appId = rt.params[parameters.appId.slug];
470
+ const appId = rt.params["app-id"];
455
471
  if (!appId) {
456
- throw new Error(
457
- "kintone-api-token setup: missing app-id parameter on finalize"
458
- );
472
+ return "## kintone\n\n_App ID \u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002_\n";
459
473
  }
460
474
  const sections = ["## kintone", ""];
461
475
  const app = await getAppMetadata(rt.params, appId);
@@ -465,15 +479,39 @@ var kintoneApiTokenSetupFlow = {
465
479
  sections.push(app.description, "");
466
480
  }
467
481
  const fields = await getFormFields(rt.params, appId);
482
+ const fieldEntries = Object.entries(fields.properties ?? {});
483
+ sections.push("#### Fields", "");
468
484
  sections.push("| Field code | Label | Type | Required |");
469
485
  sections.push("|------------|-------|------|----------|");
470
- for (const [code, def] of Object.entries(fields.properties ?? {})) {
486
+ for (const [code, def] of fieldEntries) {
471
487
  const escapedLabel = (def.label ?? "").replace(/\|/g, "\\|");
472
488
  sections.push(
473
489
  `| ${code} | ${escapedLabel || "-"} | ${def.type} | ${def.required ? "yes" : "no"} |`
474
490
  );
475
491
  }
476
492
  sections.push("");
493
+ const sampleData = await getSampleRecords(rt.params, appId);
494
+ const totalCount = sampleData.totalCount ? Number(sampleData.totalCount) : null;
495
+ if (totalCount != null) {
496
+ sections.push(`#### Record count: ${totalCount.toLocaleString()}`, "");
497
+ }
498
+ const records = sampleData.records ?? [];
499
+ if (records.length > 0) {
500
+ const sampleFields = fieldEntries.slice(0, 8).map(([code]) => code);
501
+ if (sampleFields.length > 0) {
502
+ sections.push(`#### Sample records (${records.length})`, "");
503
+ sections.push(`| ${sampleFields.join(" | ")} |`);
504
+ sections.push(`| ${sampleFields.map(() => "---").join(" | ")} |`);
505
+ for (const record of records) {
506
+ const cells = sampleFields.map((code) => {
507
+ const cell = record[code];
508
+ return formatRecordValue(cell?.value).replace(/\|/g, "\\|");
509
+ });
510
+ sections.push(`| ${cells.join(" | ")} |`);
511
+ }
512
+ sections.push("");
513
+ }
514
+ }
477
515
  return sections.join("\n");
478
516
  }
479
517
  };
@@ -596,7 +634,7 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
596
634
  systemPrompt: {
597
635
  en: `### Tools
598
636
 
599
- - \`kintone-api-key_request\`: The only way to call the kintone REST API. Use it to fetch app metadata/field definitions and read/write records. Authentication (API Token), base URL, and the connection's app id are configured automatically. Each connection is scoped to exactly one app (kintone API tokens are per-app).
637
+ - \`connector_kintone-api-key_request\`: The only way to call the kintone REST API. Use it to fetch app metadata/field definitions and read/write records. Authentication (API Token), base URL, and the connection's app id are configured automatically. Each connection is scoped to exactly one app (kintone API tokens are per-app).
600
638
 
601
639
  ### App scoping (important)
602
640
 
@@ -669,7 +707,7 @@ export default async function handler(c: Context) {
669
707
  - String: \`like "partial match"\``,
670
708
  ja: `### \u30C4\u30FC\u30EB
671
709
 
672
- - \`kintone-api-key_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u306E\u30E1\u30BF\u60C5\u5831\u30FB\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u8AAD\u307F\u66F8\u304D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30C8\u30FC\u30AF\u30F3\uFF09\u3001\u30D9\u30FC\u30B9URL\u3001\u304A\u3088\u3073\u63A5\u7D9A\u306E\u30A2\u30D7\u30EAID\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u5404\u63A5\u7D9A\u306F\u3061\u3087\u3046\u30691\u3064\u306E\u30A2\u30D7\u30EA\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\uFF08kintone API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u5358\u4F4D\u306E\u305F\u3081\uFF09\u3002
710
+ - \`connector_kintone-api-key_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u306E\u30E1\u30BF\u60C5\u5831\u30FB\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u8AAD\u307F\u66F8\u304D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30C8\u30FC\u30AF\u30F3\uFF09\u3001\u30D9\u30FC\u30B9URL\u3001\u304A\u3088\u3073\u63A5\u7D9A\u306E\u30A2\u30D7\u30EAID\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u5404\u63A5\u7D9A\u306F\u3061\u3087\u3046\u30691\u3064\u306E\u30A2\u30D7\u30EA\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\uFF08kintone API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u5358\u4F4D\u306E\u305F\u3081\uFF09\u3002
673
711
 
674
712
  ### \u30A2\u30D7\u30EA\u30B9\u30B3\u30FC\u30D7\uFF08\u91CD\u8981\uFF09
675
713
 
@@ -747,14 +785,15 @@ export default async function handler(c: Context) {
747
785
  const baseUrl = params[parameters.baseUrl.slug];
748
786
  const apiToken = params[parameters.apiToken.slug];
749
787
  const appId = params[parameters.appId.slug];
750
- if (!baseUrl || !apiToken || !appId) {
788
+ if (!baseUrl || !apiToken) {
751
789
  return {
752
790
  success: false,
753
- error: `Missing required parameters: ${parameters.baseUrl.slug}, ${parameters.apiToken.slug}, and ${parameters.appId.slug}`
791
+ error: `Missing required parameters: ${parameters.baseUrl.slug}, ${parameters.apiToken.slug}`
754
792
  };
755
793
  }
756
794
  try {
757
- const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/app.json?id=${encodeURIComponent(appId)}`;
795
+ const path2 = appId ? `app.json?id=${encodeURIComponent(appId)}` : `app/form/fields.json?app=0`;
796
+ const url = `${baseUrl.replace(/\/+$/, "")}/k/v1/${path2}`;
758
797
  const res = await fetch(url, {
759
798
  method: "GET",
760
799
  headers: {
@@ -762,6 +801,15 @@ export default async function handler(c: Context) {
762
801
  Accept: "application/json"
763
802
  }
764
803
  });
804
+ if (!appId) {
805
+ if (res.status === 401 || res.status === 403) {
806
+ return {
807
+ success: false,
808
+ error: "kintone API failed: invalid API token"
809
+ };
810
+ }
811
+ return { success: true };
812
+ }
765
813
  if (!res.ok) {
766
814
  const data = await res.json().catch(() => null);
767
815
  const message = data?.message ?? `HTTP ${res.status} ${res.statusText}`;
@@ -262,7 +262,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
262
262
  /**
263
263
  * Create tools for connections that belong to this connector.
264
264
  * Filters connections by connectorKey internally.
265
- * Returns tools keyed as `${connectorKey}_${toolName}`.
265
+ * Returns tools keyed as `connector_${connectorKey}_${toolName}`.
266
266
  */
267
267
  createTools(connections, config, opts) {
268
268
  const myConnections = connections.filter(
@@ -272,7 +272,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
272
272
  for (const t of Object.values(this.tools)) {
273
273
  const tool = t.createTool(myConnections, config);
274
274
  const originalToModelOutput = tool.toModelOutput;
275
- result[`${this.connectorKey}_${t.name}`] = {
275
+ result[`connector_${this.connectorKey}_${t.name}`] = {
276
276
  ...tool,
277
277
  toModelOutput: async (options) => {
278
278
  if (!originalToModelOutput) {
@@ -402,12 +402,12 @@ var AUTH_TYPES = {
402
402
  // ../connectors/src/connectors/kintone/setup.ts
403
403
  var kintoneOnboarding = new ConnectorOnboarding({
404
404
  dataOverviewInstructions: {
405
- en: `1. Call kintone_request with GET apps.json to list available apps
406
- 2. For key apps, call kintone_request with GET app/form/fields.json?app={appId} to get field definitions
407
- 3. Call kintone_request with GET records.json?app={appId}&query=limit 5 to sample records`,
408
- ja: `1. kintone_request \u3067 GET apps.json \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30D7\u30EA\u4E00\u89A7\u3092\u53D6\u5F97
409
- 2. \u4E3B\u8981\u30A2\u30D7\u30EA\u306B\u3064\u3044\u3066 kintone_request \u3067 GET app/form/fields.json?app={appId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u3092\u53D6\u5F97
410
- 3. kintone_request \u3067 GET records.json?app={appId}&query=limit 5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
405
+ en: `1. Call connector_kintone_request with GET apps.json to list available apps
406
+ 2. For key apps, call connector_kintone_request with GET app/form/fields.json?app={appId} to get field definitions
407
+ 3. Call connector_kintone_request with GET records.json?app={appId}&query=limit 5 to sample records`,
408
+ ja: `1. connector_kintone_request \u3067 GET apps.json \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30D7\u30EA\u4E00\u89A7\u3092\u53D6\u5F97
409
+ 2. \u4E3B\u8981\u30A2\u30D7\u30EA\u306B\u3064\u3044\u3066 connector_kintone_request \u3067 GET app/form/fields.json?app={appId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u3092\u53D6\u5F97
410
+ 3. connector_kintone_request \u3067 GET records.json?app={appId}&query=limit 5 \u3092\u547C\u3073\u51FA\u3057\u3001\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
411
411
  }
412
412
  });
413
413
 
@@ -435,6 +435,7 @@ async function apiFetch(params, path2, init) {
435
435
  // ../connectors/src/connectors/kintone/setup-flow.ts
436
436
  var ALL_APPS = "__ALL_APPS__";
437
437
  var KINTONE_SETUP_MAX_APPS = 20;
438
+ var SAMPLE_RECORD_LIMIT = 5;
438
439
  async function listApps(params) {
439
440
  const results = [];
440
441
  let offset = 0;
@@ -468,6 +469,25 @@ async function getFormFields(params, appId) {
468
469
  }
469
470
  return await res.json();
470
471
  }
472
+ async function getSampleRecords(params, appId) {
473
+ try {
474
+ const res = await apiFetch(
475
+ params,
476
+ `records.json?app=${encodeURIComponent(appId)}&query=${encodeURIComponent(`limit ${SAMPLE_RECORD_LIMIT}`)}&totalCount=true`
477
+ );
478
+ if (!res.ok) return { records: [], totalCount: null };
479
+ return await res.json();
480
+ } catch {
481
+ return { records: [], totalCount: null };
482
+ }
483
+ }
484
+ function formatRecordValue(val) {
485
+ if (val == null) return "";
486
+ if (typeof val === "string") return val.length > 50 ? `${val.slice(0, 50)}\u2026` : val;
487
+ if (Array.isArray(val)) return `[${val.length} items]`;
488
+ if (typeof val === "object") return JSON.stringify(val).slice(0, 50);
489
+ return String(val);
490
+ }
471
491
  var kintoneSetupFlow = {
472
492
  initialState: () => ({}),
473
493
  steps: [
@@ -513,15 +533,38 @@ var kintoneSetupFlow = {
513
533
  sections.push(app.description, "");
514
534
  }
515
535
  const fields = await getFormFields(rt.params, appId);
536
+ const fieldEntries = Object.entries(fields.properties ?? {});
516
537
  sections.push("| Field code | Label | Type | Required |");
517
538
  sections.push("|------------|-------|------|----------|");
518
- for (const [code, def] of Object.entries(fields.properties ?? {})) {
539
+ for (const [code, def] of fieldEntries) {
519
540
  const escapedLabel = (def.label ?? "").replace(/\|/g, "\\|");
520
541
  sections.push(
521
542
  `| ${code} | ${escapedLabel || "-"} | ${def.type} | ${def.required ? "yes" : "no"} |`
522
543
  );
523
544
  }
524
545
  sections.push("");
546
+ const sampleData = await getSampleRecords(rt.params, appId);
547
+ const totalCount = sampleData.totalCount ? Number(sampleData.totalCount) : null;
548
+ if (totalCount != null) {
549
+ sections.push(`#### Record count: ${totalCount.toLocaleString()}`, "");
550
+ }
551
+ const records = sampleData.records ?? [];
552
+ if (records.length > 0) {
553
+ const sampleFields = fieldEntries.slice(0, 8).map(([code]) => code);
554
+ if (sampleFields.length > 0) {
555
+ sections.push(`#### Sample records (${records.length})`, "");
556
+ sections.push(`| ${sampleFields.join(" | ")} |`);
557
+ sections.push(`| ${sampleFields.map(() => "---").join(" | ")} |`);
558
+ for (const record of records) {
559
+ const cells = sampleFields.map((code) => {
560
+ const cell = record[code];
561
+ return formatRecordValue(cell?.value).replace(/\|/g, "\\|");
562
+ });
563
+ sections.push(`| ${cells.join(" | ")} |`);
564
+ }
565
+ sections.push("");
566
+ }
567
+ }
525
568
  }
526
569
  return sections.join("\n");
527
570
  }
@@ -614,7 +657,7 @@ var kintoneConnector = new ConnectorPlugin({
614
657
  systemPrompt: {
615
658
  en: `### Tools
616
659
 
617
- - \`kintone_request\`: The only way to call the kintone REST API. Use it to list apps, fetch field definitions, and read/write records. The base URL (e.g., \`https://example.cybozu.com\`) is automatically resolved. See the kintone REST API Reference below for endpoints and the kintone query syntax.
660
+ - \`connector_kintone_request\`: The only way to call the kintone REST API. Use it to list apps, fetch field definitions, and read/write records. The base URL (e.g., \`https://example.cybozu.com\`) is automatically resolved. See the kintone REST API Reference below for endpoints and the kintone query syntax.
618
661
 
619
662
  ### Business Logic
620
663
 
@@ -681,7 +724,7 @@ export default async function handler(c: Context) {
681
724
  - String: \`like "partial match"\``,
682
725
  ja: `### \u30C4\u30FC\u30EB
683
726
 
684
- - \`kintone_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u8AAD\u307F\u66F8\u304D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D9\u30FC\u30B9URL\uFF08\u4F8B: \`https://example.cybozu.com\`\uFF09\u306F\u81EA\u52D5\u7684\u306B\u89E3\u6C7A\u3055\u308C\u307E\u3059\u3002\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u304A\u3088\u3073kintone\u30AF\u30A8\u30EA\u69CB\u6587\u306F\u4E0B\u90E8\u306E\u300Ckintone REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
727
+ - \`connector_kintone_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u8AAD\u307F\u66F8\u304D\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D9\u30FC\u30B9URL\uFF08\u4F8B: \`https://example.cybozu.com\`\uFF09\u306F\u81EA\u52D5\u7684\u306B\u89E3\u6C7A\u3055\u308C\u307E\u3059\u3002\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u304A\u3088\u3073kintone\u30AF\u30A8\u30EA\u69CB\u6587\u306F\u4E0B\u90E8\u306E\u300Ckintone REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
685
728
 
686
729
  ### Business Logic
687
730