Skip to main content
Glama
Buu-AI

Buu AI MCP Server

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

TableJSON Schema
NameRequiredDescriptionDefault
filtersNoFilter criteria to narrow down thread results
paginationNoPagination settings for querying threads

Implementation Reference

  • 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}` }],
        };
      }
    }
  • 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'),
    },
  • 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);
  • 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
          }
        }
      }
    `;

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/Buu-AI/buu-mcp-server'

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