File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -113,32 +113,32 @@ Dynamic resources with parameters:
113113
114114All 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
143143Transport Types
144144...............
You can’t perform that action at this time.
0 commit comments