Skip to main content
Glama
DynamicEndpoints

Microsoft 365 Core MCP Server

manage_sharepoint_lists

Destructive

Create, update, delete, and manage SharePoint lists and libraries including schema, items, views, and permissions within Microsoft 365 environments.

Instructions

Manage SharePoint lists and libraries including schema definition, items, views, and permissions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform on SharePoint list
siteIdYesSharePoint site ID containing the list
listIdNoSharePoint list ID for existing list operations
titleNoTitle for the SharePoint list
descriptionNoDescription of the SharePoint list
templateNoTemplate to use for list creation
columnsNoList column definitions
itemsNoItems to add to the list

Implementation Reference

  • Main handler function implementing SharePoint list management operations: get, create (with columns), update, delete, add_items, get_items using Microsoft Graph API.
    // SharePoint List Handler
    export async function handleSharePointList(
      graphClient: Client,
      args: SharePointListArgs
    ): Promise<{ content: { type: string; text: string }[] }> {
      switch (args.action) {
        case 'get': {
          const list = await graphClient
            .api(`/sites/${args.siteId}/lists/${args.listId}`)
            .get();
          return { content: [{ type: 'text', text: JSON.stringify(list, null, 2) }] };
        }
        case 'create': {
          // Create a new list
          const list = await graphClient
            .api(`/sites/${args.siteId}/lists`)
            .post({
              displayName: args.title,
              description: args.description,
              template: args.template || 'genericList',
            });
          
          // Add columns if provided
          if (args.columns?.length) {
            for (const column of args.columns) {
              await graphClient
                .api(`/sites/${args.siteId}/lists/${list.id}/columns`)
                .post({
                  name: column.name,
                  columnType: column.type,
                  required: column.required || false,
                  defaultValue: column.defaultValue,
                });
            }
          }
          
          return { content: [{ type: 'text', text: JSON.stringify(list, null, 2) }] };
        }
        case 'update': {
          await graphClient
            .api(`/sites/${args.siteId}/lists/${args.listId}`)
            .patch({
              displayName: args.title,
              description: args.description,
            });
          
          return { content: [{ type: 'text', text: 'SharePoint list updated successfully' }] };
        }
        case 'delete': {
          await graphClient
            .api(`/sites/${args.siteId}/lists/${args.listId}`)
            .delete();
          
          return { content: [{ type: 'text', text: 'SharePoint list deleted successfully' }] };
        }
        case 'add_items': {
          if (!args.items?.length) {
            throw new McpError(ErrorCode.InvalidParams, 'No items specified to add');
          }
          
          const results = [];
          for (const item of args.items) {
            const result = await graphClient
              .api(`/sites/${args.siteId}/lists/${args.listId}/items`)
              .post({
                fields: item,
              });
            
            results.push(result);
          }
          
          return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }] };
        }
        case 'get_items': {
          const items = await graphClient
            .api(`/sites/${args.siteId}/lists/${args.listId}/items?expand=fields`)
            .get();
          
          return { content: [{ type: 'text', text: JSON.stringify(items, null, 2) }] };
        }
        default:
          throw new McpError(ErrorCode.InvalidParams, `Invalid action: ${args.action}`);
      }
  • src/server.ts:499-518 (registration)
    MCP server tool registration for 'manage_sharepoint_lists' with schema, annotations, and handler invocation.
    this.server.tool(
      "manage_sharepoint_lists",
      "Manage SharePoint lists and libraries including schema definition, items, views, and permissions.",
      sharePointListSchema.shape,
      {"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false},
      wrapToolHandler(async (args: SharePointListArgs) => {
        // Validate credentials only when tool is executed (lazy loading)
        this.validateCredentials();
        try {
          return await handleSharePointList(this.getGraphClient(), args);
        } catch (error) {
          if (error instanceof McpError) {
            throw error;
          }
          throw new McpError(
            ErrorCode.InternalError,
            `Error executing tool: ${error instanceof Error ? error.message : 'Unknown error'}`
          );
        }
      })
  • Zod input schema defining parameters for SharePoint list operations including siteId, listId, title, columns, and items.
    export const sharePointListSchema = z.object({
      action: z.enum(['get', 'create', 'update', 'delete', 'add_items', 'get_items']).describe('Action to perform on SharePoint list'),
      siteId: z.string().describe('SharePoint site ID containing the list'),
      listId: z.string().optional().describe('SharePoint list ID for existing list operations'),
      title: z.string().optional().describe('Title for the SharePoint list'),
      description: z.string().optional().describe('Description of the SharePoint list'),
      template: z.string().optional().describe('Template to use for list creation'),
      columns: z.array(z.object({
        name: z.string().describe('Column name'),
        type: z.string().describe('Column type (Text, Number, DateTime, etc.)'),
        required: z.boolean().optional().describe('Whether the column is required'),
        defaultValue: z.any().optional().describe('Default value for the column'),
      })).optional().describe('List column definitions'),
      items: z.array(z.record(z.string(), z.any())).optional().describe('Items to add to the list'),
    });
  • Tool metadata with description, title, and annotations (readOnlyHint, destructiveHint, etc.) for 'manage_sharepoint_lists'.
    manage_sharepoint_lists: {
      description: "Manage SharePoint lists and libraries including schema definition, items, views, and permissions.",
      title: "SharePoint List Manager",
      annotations: { title: "SharePoint List Manager", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
  • TypeScript interface SharePointListArgs defining the input parameters for the SharePoint list handler.
    // SharePoint List Types
    export interface SharePointListArgs {
      action: 'get' | 'create' | 'update' | 'delete' | 'add_items' | 'get_items';
      siteId: string;
      listId?: string;
      title?: string;
      description?: string;
      template?: string;
      columns?: {
        name: string;
        type: string;
        required?: boolean;
        defaultValue?: any;
      }[];
      items?: Record<string, any>[];
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructiveHint=true, readOnlyHint=false, and idempotentHint=false, covering safety and idempotency. The description adds minimal behavioral context beyond this, such as the broad scope of management (schema, items, views, permissions), but doesn't detail side effects, auth needs, or rate limits. No contradiction with annotations exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy and waste, though it could be slightly more structured (e.g., separating scope items with commas). Overall, it's appropriately concise for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, destructive operations, no output schema) and rich annotations, the description is adequate but incomplete. It covers the general purpose but lacks details on return values, error handling, or operational constraints, leaving gaps for an agent to infer behavior from the schema and annotations alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description implies parameters relate to managing lists/libraries but doesn't add specific meaning beyond what the schema provides, such as explaining how 'action' interacts with other parameters. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Manage SharePoint lists and libraries including schema definition, items, views, and permissions.' It specifies the resource (SharePoint lists/libraries) and scope (schema, items, views, permissions), though it doesn't explicitly distinguish from sibling tools like 'manage_sharepoint_sites' or 'manage_sharepoint_governance_policies' beyond the general 'lists and libraries' focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, nor does it reference sibling tools for comparison. Users must infer usage from the action parameter and schema alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/DynamicEndpoints/m365-core-mcp'

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