Skip to main content
Glama
Buu-AI

Buu AI MCP Server

genrequest_get_all

Retrieve all GenRequests associated with a specific subthread ID on the Buu AI MCP Server to manage and organize team data efficiently.

Instructions

[PRIVATE] - Get all team's GenRequests by subthread ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subthreadIdYesSubthread ID to retrieve all associated GenRequests

Implementation Reference

  • The handler function that executes the 'genrequest_get_all' tool logic: performs a GraphQL query using getSubthreadGenRequestsQuery for the given subthreadId and returns the JSON response or an error.
    async ({ subthreadId }) => {
      try {
        const response = await client.request(getSubthreadGenRequestsQuery, {
          subthreadId,
        });
        return { content: [{ type: 'text', text: JSON.stringify(response) }] };
      } catch (error) {
        console.error('Error calling genrequest_get_all:', error);
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `Error: Failed to retrieve GenRequests. ${error}`,
            },
          ],
        };
      }
    }
  • Input schema using Zod for the 'genrequest_get_all' tool, defining the required subthreadId parameter.
    {
      subthreadId: z.string().describe('Subthread ID to retrieve all associated GenRequests'),
    },
  • Registration of the 'genrequest_get_all' tool on the MCP server using server.tool(), including description, input schema, and handler function.
    server.tool(
      'genrequest_get_all',
      "[PRIVATE] - Get all team's GenRequests by subthread ID",
      {
        subthreadId: z.string().describe('Subthread ID to retrieve all associated GenRequests'),
      },
      async ({ subthreadId }) => {
        try {
          const response = await client.request(getSubthreadGenRequestsQuery, {
            subthreadId,
          });
          return { content: [{ type: 'text', text: JSON.stringify(response) }] };
        } catch (error) {
          console.error('Error calling genrequest_get_all:', error);
          return {
            isError: true,
            content: [
              {
                type: 'text',
                text: `Error: Failed to retrieve GenRequests. ${error}`,
              },
            ],
          };
        }
      }
    );
  • GraphQL query definition 'getSubthreadGenRequestsQuery' used by the genrequest_get_all handler to fetch GenRequests for a subthread.
    const getSubthreadGenRequestsQuery = gql`
      query GetSubthreadGenRequests($subthreadId: String!) {
        getSubthreadGenRequests(subthreadId: $subthreadId) {
          ... on GenRequestsPage {
            items {
              _id
              subthreadId
              teamId
              status
              metadata
              type
              images {
                alt
                keyS3
                size
                type
                url
              }
              model_mesh {
                alt
                keyS3
                size
                type
                url
              }
              timings {
                inference
              }
              credits
              createdAt
              updatedAt
              address
            }
            metadata {
              limit
              offset
              orderBy
              orderDirection
              numElements
              total
              page
              pages
            }
          }
          ... on HandledError {
            code
            message
          }
        }
      }
    `;
  • src/index.ts:47-47 (registration)
    Invocation of registerGenRequestTools which registers the genrequest_get_all tool (among others) to the MCP server instance.
    registerGenRequestTools(server, buuServerClient);

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