Skip to main content
Glama
srikanth-paladugula

Dynamics 365 MCP Server

get-associated-opportunities

Fetch sales opportunities linked to a specific account in Dynamics 365 to analyze customer potential and track business deals.

Instructions

Fetch opportunities for a given account from Dynamics 365

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYes

Implementation Reference

  • MCP tool handler: fetches opportunities via Dynamics365 client, formats as JSON text response or error message.
    async (req) => {
      try {
        const response = await d365.getAssociatedOpportunities(req.accountId);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${
                error instanceof Error ? error.message : "Unknown error"
              }, please check your input and try again.`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema: requires 'accountId' as string.
    { accountId: z.string() },
  • src/tools.ts:72-101 (registration)
    Registers the MCP tool 'get-associated-opportunities' with description, schema, and handler.
    server.tool(
      "get-associated-opportunities",
      "Fetch opportunities for a given account from Dynamics 365",
      { accountId: z.string() },
      async (req) => {
        try {
          const response = await d365.getAssociatedOpportunities(req.accountId);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : "Unknown error"
                }, please check your input and try again.`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Dynamics365 helper: validates accountId, builds OData filter query for opportunities, delegates to makeApiRequest.
    public async getAssociatedOpportunities(accountId: string): Promise<any> {
      if (!accountId) {
        throw new Error("Account ID is required to fetch opportunities.");
      }
    
      const endpoint = `api/data/v9.2/opportunities?$filter=_customerid_value eq ${accountId}`;
      return this.makeApiRequest(endpoint, "GET");
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'fetch' (implying a read operation) but doesn't cover critical aspects like authentication requirements, rate limits, error handling, or what the return format looks like (e.g., list of opportunities with fields). This leaves significant gaps for an agent to use it effectively.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to scan and understand quickly.

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

Completeness2/5

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

Given the complexity of fetching data from Dynamics 365, no annotations, no output schema, and low schema coverage, the description is incomplete. It lacks details on behavioral traits, parameter usage, and expected outputs, which are essential for an agent to invoke this tool correctly in a real-world context.

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 0%, so the description must compensate. It mentions 'for a given account,' which hints at the 'accountId' parameter's purpose, but doesn't explain the parameter's format (e.g., GUID), source, or constraints. This adds minimal value beyond the schema's structural definition, aligning with the baseline for low 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 action ('fetch') and target resource ('opportunities for a given account from Dynamics 365'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'fetch-accounts' or 'get-user-info' in terms of scope or relationship, which prevents a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives. The description implies it's for fetching opportunities linked to an account, but it doesn't specify prerequisites, exclusions, or compare it to other tools like 'fetch-accounts' for broader account data.

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/srikanth-paladugula/mcp-dyamics365-server'

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