Skip to main content
Glama

API-get-background-result

Retrieve processed Notion page results from background operations to access completed data without waiting.

Instructions

Retrieve the result of a background processing request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_idYesIdentifier for the Notion page that was processed in background

Implementation Reference

  • Registers the 'API-get-background-result' tool in the tools list provided to MCP, including description and input schema requiring 'page_id'.
    const backgroundResultTool = {
      name: 'API-get-background-result',
      description: 'Retrieve the result of a background processing request',
      inputSchema: {
        type: 'object',
        properties: {
          page_id: {
            type: 'string',
            description: 'Identifier for the Notion page that was processed in background',
          },
        },
        required: ['page_id'],
      } as Tool['inputSchema'],
    };
    
    tools.push(backgroundResultTool);
    console.log(`- ${backgroundResultTool.name}: ${backgroundResultTool.description}`);
  • Tool call handler within MCP's CallToolRequestHandler that invokes getBackgroundProcessingResult and returns the result as JSON text content.
    // Handle background result retrieval
    if (name === 'API-get-background-result') {
      const result = this.getBackgroundProcessingResult(params?.page_id as string);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result),
          },
        ],
      };
    }
  • Executes the core logic of the tool by fetching the stored background result from the in-memory Map or returning a not_found message.
    public getBackgroundProcessingResult(pageId: string): any {
      return this.backgroundProcessingResults.get(pageId) || { 
        status: 'not_found',
        message: `No background processing result found for page ${pageId}`
      };
    }
  • In-memory storage Map for background processing results, used by the tool handler.
    private backgroundProcessingResults: Map<string, any> = new Map()
  • Helper method to store background processing results in the Map, called after background processing completes.
      this.backgroundProcessingResults.set(pageId, result);
    }

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/Taewoong1378/notion-readonly-mcp-server'

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