We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/heyibad/quickbook-mcp-'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import {
makeQuickBooksRequest,
queryQuickBooks,
extractAccessToken,
} from "../helpers/quickbooks-api.js";
import { getRequestHeaders } from "../helpers/request-context.js";
import { ToolResponse } from "../types/tool-response.js";
import { formatError } from "../helpers/format-error.js";
import { buildQuickbooksSearchCriteria } from "../helpers/build-quickbooks-search-criteria.js";
import { convertCriteriaToSQL } from "../helpers/criteria-to-sql.js";
/**
* Search estimates from QuickBooks Online using the supplied criteria.
* The criteria object is passed directly to node‑quickbooks `findEstimates`.
*/
export async function searchQuickbooksEstimates(
criteria: object | Array<Record<string, any>> = {}
): Promise<ToolResponse<any[]>> {
try {
// Get access token from request headers
const headers = getRequestHeaders();
const accessToken = extractAccessToken(headers);
if (!accessToken) {
return {
result: null,
isError: true,
error: "Missing Authorization header. Please provide: Authorization: Bearer <access_token>",
};
}
const normalizedCriteria = buildQuickbooksSearchCriteria(criteria);
const sqlQuery = convertCriteriaToSQL("Estimate", normalizedCriteria);
const response = await queryQuickBooks({
query: sqlQuery,
accessToken,
});
if (response.isError) {
return {
result: null,
isError: true,
error: response.error || "Search failed",
};
}
return {
result: response.result?.QueryResponse?.Estimate || [],
isError: false,
error: null,
};
} catch (error) {
return {
result: null,
isError: true,
error: formatError(error),
};
}
}