Skip to main content
Glama

listMyProjects

Retrieve projects from ZenTao where you're involved as PM, PO, QD, RD, or team member. Filter by name keyword and set item limits.

Instructions

List projects related to the current account (PM/PO/QD/RD/assigned/team).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordNoFilter by project name keyword
limitNoMax items

Implementation Reference

  • Registration of the 'listMyProjects' tool in the ListToolsRequestSchema response, including name, description, and input schema.
    name: "listMyProjects", description: "List projects related to the current account (PM/PO/QD/RD/assigned/team).", inputSchema: { type: "object", properties: { keyword: { type: "string", description: "Filter by project name keyword" }, limit: { type: "number", description: "Max items", default: 50 }, }, required: [], additionalProperties: false, }, },
  • Tool handler in CallToolRequestSchema: extracts arguments, calls listProjectsForAccount, and returns JSON response.
    if (name === "listMyProjects") { const { keyword, limit } = args; const projects = await listProjectsForAccount({ keyword, limit }); return { content: [ { type: "text", text: JSON.stringify({ projects }, null, 2), }, ], }; }
  • Main implementation logic: fetches projects via API, filters by keyword and current account involvement (roles/team), limits results.
    async function listProjectsForAccount({ keyword, limit = 50 } = {}) { const res = await callZenTao({ path: "projects", query: { page: 1, limit }, }); const projects = extractArray(res.data, ["projects"]); const accountLower = (account || "").trim().toLowerCase(); const filtered = projects.filter((p) => { const name = `${p.name || ""}`.toLowerCase(); const matchKeyword = keyword ? name.includes(keyword.toLowerCase()) : true; if (!accountLower) return matchKeyword; const fields = [ p.PM, p.PO, p.QD, p.RD, p.openedBy, p.lastEditedBy, p.assignedTo, ] .filter(Boolean) .map((v) => `${v}`.toLowerCase()); const team = Array.isArray(p.teamMembers) ? p.teamMembers : []; const teamMatch = team.some((m) => `${m.account || m.name || ""}`.toLowerCase() === accountLower); const fieldMatch = fields.includes(accountLower); return matchKeyword && (teamMatch || fieldMatch); }); return filtered.slice(0, limit); }
  • Helper function used by listProjectsForAccount to make authenticated API calls to ZenTao.
    async function callZenTao({ path, method = "GET", query, body, headers = {}, forceTokenRefresh = false, }) { assertConfig(); const token = await fetchToken(forceTokenRefresh); const url = buildUrl(path, query); const res = await fetch(url, { method, headers: { "Content-Type": "application/json", Token: token, ...headers, }, body: body ? JSON.stringify(body) : undefined, }); const text = await res.text(); const data = safeJson(text); if (!res.ok) { throw new Error( `Request failed ${res.status}: ${text || res.statusText || "unknown"}` ); } return { status: res.status, headers: Object.fromEntries(res.headers.entries()), data: data ?? text, }; }
  • Helper to extract array from API response (handles various nesting). Used in listProjectsForAccount.
    function extractArray(payload, keys = []) { if (Array.isArray(payload)) return payload; for (const key of keys) { if (Array.isArray(payload?.[key])) return payload[key]; } if (Array.isArray(payload?.data)) return payload.data; return []; }

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/Valiant-Cat/zentao-mcp-server'

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