Skip to content

Commit 5640cb2

Browse files
[MCP Bundle] Fix documentation attribute placement
1 parent dc04f24 commit 5640cb2

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

docs/bundles/mcp-bundle.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,32 +113,32 @@ Dynamic resources with parameters:
113113

114114
All capabilities are automatically discovered in the ``src/`` directory when the server starts.
115115

116-
.. warning::
116+
Attribute Placement Patterns
117+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117118

118-
The MCP Bundle also ** supports the invokable pattern** where attributes are placed on classes
119-
with an ``__invoke()`` method.
119+
The MCP SDK, and therefore the MCP Bundle, supports two patterns for placing attributes on your capabilities:
120120

121-
** Invokable ** :
121+
**Invokable Pattern** - Attribute on a class with ``__invoke()`` method::
122122

123-
#[McpTool(name: 'my-tool')]
124-
class MyTool
123+
#[McpTool(name: 'my-tool')]
124+
class MyTool
125+
{
126+
public function __invoke(string $param): string
125127
{
126-
public function __invoke(string $param): string
127-
{
128-
// Implementation
129-
}
128+
// Implementation
130129
}
130+
}
131131

132-
** Method Based ** :
132+
**Method-Based Pattern** - Multiple attributes on individual methods::
133133

134-
class MyTools
135-
{
136-
#[McpTool(name: 'tool-one')]
137-
public function toolOne(): string { }
134+
class MyTools
135+
{
136+
#[McpTool(name: 'tool-one')]
137+
public function toolOne(): string { }
138138

139-
#[McpTool(name: 'tool-two')]
140-
public function toolTwo(): string { }
141-
}
139+
#[McpTool(name: 'tool-two')]
140+
public function toolTwo(): string { }
141+
}
142142

143143
Transport Types
144144
...............

0 commit comments

Comments
 (0)