Skip to content

6.1 Design Considerations

6.1.1 Layered Tool Pattern

The MCP protocol can introduce excessive token consumption, posing a significant challenge for agents and their associated language models. This occurs because the agent processes the complete list of available tools, including all contextual descriptions, to select the most suitable one for its current task. Furthermore, intermediate results are retained when multiple sequential tool calls are executed. Descriptions, intermediate results, system prompts, and user prompts combined can result in significant token overhead, which may either exceed the context window of smaller language models or, more generally, lead to decreased accuracy and errors during tool calls. In large-scale deployments, this problem becomes particularly acute: tool schema definitions for enterprise software platforms can consume well over 100,000 tokens before any user input is processed.

A Common Service Entity (CSE) is the core element of a oneM2M architecture, supporting a broad range of functions and resource types. Consequently, an MCP server for oneM2M may expose a large number of tools with extensive contextual descriptions, making it a prime candidate for the Layered Tool Pattern [i.22]. This applies in particular when the IPE exposes nearly full control over oneM2M functionalities (as described in the third level of agent knowledge about oneM2M, representing the highest degree of CSE control, see Section 6.0), where the number of tools and parameter sets can grow substantially.

The Layered Tool Pattern structures the interaction between the AI agent and the MCP server into three successive phases, rather than exposing the full set of tool definitions upfront:

  • Discovery: The agent queries only a compact overview of the CSE's general capabilities, for example whether resources can be created, queried, or updated, without loading detailed schemas into the context window.

  • Planning: The agent selects a specific task and retrieves only the targeted information required for its execution. For instance, when intending to store sensor data, the agent determines that an Application Entity (AE) must be registered and a <container> resource created before <contentInstance> resource can be submitted.

  • Execution: The agent invokes the actual tools, fully informed and with minimal context overhead.

This step-by-step approach keeps token consumption low and reduces the risk of incorrect tool selection, even when the underlying CSE exposes a large and diverse set of resources and operations.

6.1.2 Agent Skills

AI agents need specialized instructions to perform well on specific tasks, but loading all relevant knowledge into context at once consumes excessive context window capacity. Skills [i.25] address this by packaging procedural knowledge into portable, version-controlled folders. The central component of each skill is SKILL.md, a markdown file containing exactly the knowledge an agent needs for a particular type of work, loaded into context only when needed. Because skills follow a common structure, they are reusable across different agents and can be shared, exchanged, or composed into larger systems without modification.

oneM2M-specific procedures can equally be described as skills. For example, a skill named onem2m-resource-subscribe might provide an agent with the procedural knowledge for operations such as creating a subscription on a <container> resource.

A skill package follows a defined directory structure:

onem2m-resource-subscribe/
├── SKILL.md      ← metadata + instructions
├── references/   ← domain-specific docs loaded on demand
├── scripts/      ← executable helpers
├── assets/       ← templates, example payloads, schemas
└── ...           ← any additional files or directories
Figure 6.1.2-1: Agent Skill folder structure

SKILL.md is the only required component. All other directories are optional and are consulted only when the specific situation requires them.

---
name: onem2m-resource-subscribe
description: Use this skill when an agent needs to create a subscription
  on a oneM2M resource to receive notifications on state changes.
---
Figure 6.1.2-2: Agent Skill SKILL.md header

Skills follow a progressive disclosure principle. The SKILL.md file is divided into two parts: the name and description as a header in YAML format [i.26] as shown in Figure 6.1.2-2, and the skill body containing the operational instructions. The header description is always present in the agent's context and serves exclusively as the criterion by which the language model decides whether to retrieve the skill body.

The full skill body is retrieved only when the language model evaluates the user's request and determines that it matches the skill's description. At that point, the language model loads the instructions into the agent's context, making them available for the current task. Supplementary resources in references/, scripts/, and assets/ are consulted only when the specific sub-task requires them. This ensures that an agent carries only the context directly relevant to its current operation.