Skip to main content
Glama

execute_delta_query

Track incremental changes to Microsoft Graph resources for efficient synchronization by using delta queries with tokens.

Instructions

Track incremental changes to Microsoft Graph resources using delta queries for efficient synchronization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceYesGraph resource path (e.g., /users, /groups)
deltaTokenNoDelta token from previous query

Implementation Reference

  • Core handler function that executes delta queries against Microsoft Graph resources, appending /delta to paths, handling deltaTokens, and parsing responses for tokens, links, and changes.
    async executeDeltaQuery(resource: string, deltaToken?: string): Promise<DeltaQueryResponse> { let apiPath = resource; // Add delta function to the path if (!apiPath.includes('/delta')) { apiPath = apiPath.endsWith('/') ? `${apiPath}delta` : `${apiPath}/delta`; } try { let request = this.graphClient.api(apiPath); // If we have a delta token, use it to get only changes since last query if (deltaToken) { request = request.query({ $deltatoken: deltaToken }); } const response = await request.get(); // Extract delta link and delta token from response const deltaLink = response['@odata.deltaLink']; const nextLink = response['@odata.nextLink']; let extractedDeltaToken = ''; if (deltaLink) { const tokenMatch = deltaLink.match(/\$deltatoken=([^&]+)/); extractedDeltaToken = tokenMatch ? decodeURIComponent(tokenMatch[1]) : ''; } return { value: response.value || [], deltaToken: extractedDeltaToken, deltaLink: deltaLink, nextLink: nextLink, hasMoreChanges: !!nextLink, changeCount: response.value ? response.value.length : 0, queriedAt: new Date().toISOString() }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Delta query failed: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • Zod input schema for validating parameters to the execute_delta_query tool.
    export const deltaQuerySchema = z.object({ resource: z.string().describe('Graph resource path (e.g., /users, /groups)'), deltaToken: z.string().optional().describe('Delta token from previous query') });
  • Tool metadata registration defining the execute_delta_query tool's description, title, and behavioral annotations.
    execute_delta_query: { description: "Track incremental changes to Microsoft Graph resources using delta queries for efficient synchronization.", title: "Graph Delta Query", annotations: { title: "Graph Delta Query", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true } },
  • TypeScript interface defining the structure of the response returned by delta queries.
    export interface DeltaQueryResponse { value: any[]; deltaToken: string; deltaLink?: string; nextLink?: string; hasMoreChanges: boolean; changeCount: number; queriedAt: string; }

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