subthread_get_all
Retrieve all subthreads for a team using pagination and filters to organize and manage thread data efficiently on Buu AI MCP Server.
Instructions
[PRIVATE] Get all team's subthreads.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filters | No | Filter criteria to narrow down thread results | |
| pagination | No | Pagination settings for querying threads |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"filters": {
"description": "Filter criteria to narrow down thread results"
},
"pagination": {
"description": "Pagination settings for querying threads"
}
},
"type": "object"
}
Implementation Reference
- src/tools/SubthreadTools.ts:158-169 (handler)The async handler function for the 'subthread_get_all' tool. It sends a GraphQL query to fetch subthreads using the provided pagination and filters, returns the JSON response, or an error message if the request fails.async ({ pagination, filters }) => { try { const response = await client.request(getSubthreadsQuery, { pagination, filters }); return { content: [{ type: 'text', text: JSON.stringify(response) }] }; } catch (error) { console.error('Error calling subthread_get_all:', error); return { isError: true, content: [{ type: 'text', text: `Error: Failed to retrieve subthreads. ${error}` }], }; } }
- src/tools/SubthreadTools.ts:154-157 (schema)Zod input schema defining optional 'pagination' and 'filters' parameters for the tool.{ pagination: z.any().optional().describe('Pagination settings for querying threads'), filters: z.any().optional().describe('Filter criteria to narrow down thread results'), },
- src/tools/SubthreadTools.ts:151-170 (registration)Direct registration of the 'subthread_get_all' tool via server.tool() call within registerSubthreadTools function.server.tool( 'subthread_get_all', "[PRIVATE] Get all team's subthreads.", { pagination: z.any().optional().describe('Pagination settings for querying threads'), filters: z.any().optional().describe('Filter criteria to narrow down thread results'), }, async ({ pagination, filters }) => { try { const response = await client.request(getSubthreadsQuery, { pagination, filters }); return { content: [{ type: 'text', text: JSON.stringify(response) }] }; } catch (error) { console.error('Error calling subthread_get_all:', error); return { isError: true, content: [{ type: 'text', text: `Error: Failed to retrieve subthreads. ${error}` }], }; } } );
- src/index.ts:48-48 (registration)Invocation of registerSubthreadTools in the main server setup, which registers the subthread_get_all tool among others.registerSubthreadTools(server, buuServerClient);
- src/tools/SubthreadTools.ts:51-84 (helper)GraphQL query definition 'getSubthreadsQuery' used by the subthread_get_all handler to fetch subthreads.const getSubthreadsQuery = gql` query GetSubthreads($pagination: Pagination, $filters: SubthreadFilter) { getSubthreads(pagination: $pagination, filters: $filters) { ... on SubthreadsPage { items { _id createdAt updatedAt teamId threadId prompt style imageUrl strength address } metadata { limit offset orderBy orderDirection numElements total page pages } } ... on HandledError { code message } } } `;