Skip to main content
Glama

strapi_list_authors

Retrieve a complete list of all authors from the Strapi CMS to manage content attribution and user permissions.

Instructions

List all authors

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for 'strapi_list_authors' tool. Fetches the list of authors from Strapi CMS using the content-manager API and returns the JSON response.
    async listAuthors (headers) {
      const response = await axios.get(
        `${this.strapiUrl}/content-manager/collection-types/api::author.author`,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
  • Input schema definition for the tool, registered in the ListToolsRequestHandler. No input parameters required.
    {
      name: 'strapi_list_authors',
      description: 'List all authors',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • index.js:380-553 (registration)
    Registration of the tool handler in the switch statement within setupHandlers() method, dispatching calls to listAuthors.
            case 'strapi_list_authors':
              return await this.listAuthors(headers)
    
            case 'strapi_list_categories':
              return await this.listCategories(headers)
    
            case 'strapi_list_tags':
              return await this.listTags(headers)
    
            // Tutorial operations
            case 'strapi_create_tutorial':
              return await this.createTutorial(headers, request.params.arguments)
    
            case 'strapi_list_tutorials':
              return await this.listTutorials(headers, request.params.arguments)
    
            case 'strapi_get_tutorial':
              return await this.getTutorial(headers, request.params.arguments)
    
            case 'strapi_update_tutorial':
              return await this.updateTutorial(headers, request.params.arguments)
    
            case 'strapi_publish_tutorial':
              return await this.publishTutorial(headers, request.params.arguments)
    
            // Event operations
            case 'strapi_create_event':
              return await this.createEvent(headers, request.params.arguments)
    
            case 'strapi_list_events':
              return await this.listEvents(headers, request.params.arguments)
    
            case 'strapi_get_event':
              return await this.getEvent(headers, request.params.arguments)
    
            case 'strapi_update_event':
              return await this.updateEvent(headers, request.params.arguments)
    
            case 'strapi_publish_event':
              return await this.publishEvent(headers, request.params.arguments)
    
            default:
              throw new Error(`Unknown tool: ${request.params.name}`)
          }
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error: ${error.message}`
            }],
            isError: true
          }
        }
      })
    }
    
    async createBlogPost (headers, args) {
      const data = {
        title: args.title,
        content: args.content,
        description: args.description,
        author: args.author_id,
        category: args.category_id,
        tags: args.tag_ids,
        publishedAt: args.publishedAt || null
      }
    
      const response = await axios.post(
        `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post`,
        data,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
    
    async listBlogPosts (headers, args = {}) {
      const { page = 1, pageSize = 25, status = 'all' } = args
    
      const response = await axios.get(
        `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post`,
        {
          headers,
          params: {
            page,
            pageSize
          }
        }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
    
    async getBlogPost (headers, args) {
      // Strapi 5 uses documentId for single document operations
      const response = await axios.get(
        `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post/${args.document_id}`,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
    
    async updateBlogPost (headers, args) {
      const data = {}
      if (args.title) data.title = args.title
      if (args.content) data.content = args.content
      if (args.description) data.description = args.description
      if (args.category_id) data.category = args.category_id
      if (args.tag_ids) data.tags = args.tag_ids
    
      // Strapi 5 uses documentId for single document operations
      const response = await axios.put(
        `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post/${args.document_id}`,
        data,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
    
    async publishBlogPost (headers, args) {
      const data = {
        publishedAt: args.publish ? new Date().toISOString() : null
      }
    
      // Strapi 5 uses documentId for single document operations
      const response = await axios.put(
        `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post/${args.document_id}`,
        data,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
    
    async listAuthors (headers) {
      const response = await axios.get(
        `${this.strapiUrl}/content-manager/collection-types/api::author.author`,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }

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/AINative-Studio/ainative-strapi-mcp-server'

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