Skip to main content
Glama

Kintone Book Management MCP Tool

apiClient.ts1.62 kB
import dotenv from "dotenv"; import { fileURLToPath } from "url"; import { dirname, resolve } from "path"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); dotenv.config({ path: resolve(__dirname, "../.env"), quiet: true, }); import { KintoneRestAPIClient } from "@kintone/rest-api-client"; import { BookRecord, KintoneResponse } from "./types.js"; const { KINTONE_BASE_URL, KINTONE_API_TOKEN, KINTONE_APP_ID, KINTONE_REQUEST_FIELDS, } = process.env; if ( !KINTONE_BASE_URL || !KINTONE_API_TOKEN || !KINTONE_APP_ID || !KINTONE_REQUEST_FIELDS ) { throw new Error("Required environment variables are not set."); } const client = new KintoneRestAPIClient({ baseUrl: KINTONE_BASE_URL, auth: { apiToken: KINTONE_API_TOKEN, }, }); const params = { app: KINTONE_APP_ID, fields: KINTONE_REQUEST_FIELDS.split(","), }; export async function getAllBookRecods(): Promise<KintoneResponse> { try { const response = await client.record.getAllRecords<BookRecord>(params); return response; } catch (error) { console.error("Error fetching book records:", error); throw error; } } export function formatBookRecord(record: BookRecord): string { return [ `Title: ${record.title_input.value || "Unknown"}`, `Description: ${record.description_input.value || "Unknown"}`, `Memo: ${record.memo_input.value || "Unknown"}`, `Publisher: ${record.publisher_input.value || "Unknown"}`, `Origin: ${KINTONE_BASE_URL}/k/${KINTONE_APP_ID}/show#record=${record["$id"].value || "No headline"}`, "---", ].join("\n"); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yamatairiku-dev/kintone-bookmanage-mcp-stdin'

If you have feedback or need assistance with the MCP directory API, please join our Discord server