Sanity Library Reference Docs
    Preparing search index...

    Function defineContextMcpEndpoint

    • Beta

      Defines a Context MCP endpoint that agents connect to.

      Parameters

      • parameters: BlueprintContextMcpEndpointConfig

        The MCP endpoint configuration

        Deploying Context via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.

        Configuration for a Context MCP endpoint. This feature is subject to breaking changes.

        • Optional BetagroqFilter?: string

          A GROQ filter for the documents that the dataset source serves. It requires a dataset source.

        • Optional Betainstructions?: string

          Instructions for agents that connect to the endpoint, up to 10,000 characters.

        • Betaname: string

          The endpoint name in the URL that agents connect to: lowercase letters, digits and single hyphens, up to 64 characters. The names by-name and mcp followed by 8 letters or digits are reserved. With the default deletion policy (allow), a change deletes the endpoint and creates a new endpoint with a new URL.

        • Betasources: (BlueprintContextKnowledgeBaseResource | ContextMcpEndpointSource)[]

          What the endpoint serves: any number of knowledge bases and at most one dataset. A knowledge base source can also be the resource that defineContextKnowledgeBase returns.

        • Betatitle: string

          The endpoint title, up to 100 characters.

      Returns BlueprintContextMcpEndpointResource

      The MCP endpoint resource

      The blueprint must be scoped to an organization.

      defineContextMcpEndpoint({
      name: 'support-agent',
      title: 'Support agent',
      sources: [{type: 'dataset', id: 'abc123.production'}],
      })
      const productDocs = defineContextKnowledgeBase({
      name: 'product-docs',
      title: 'Product docs',
      description: 'Everything about the product',
      })

      defineContextMcpEndpoint({
      name: 'support-agent',
      title: 'Support agent',
      sources: [productDocs, {type: 'dataset', id: 'abc123.production'}],
      instructions: 'Answer questions about the product.',
      groqFilter: '_type in ["article", "faq"]',
      })
      defineContextMcpEndpoint({
      name: 'editor-agent',
      title: 'Editor agent',
      sources: [{type: 'dataset', id: 'abc123.production', workspace: 'marketing', perspective: 'drafts', semanticSearch: false}],
      })